[antlr-interest] Code generation error?

Richard Matthias richard at exaflop.org
Sat Jun 26 15:12:04 PDT 2004


Hi, 

I've got a problem here with the code generated by antlr (just downloaded the
latest - 2.7.4). If I have a tokens section:-

tokens {
	TRUE="true"<AST=mynamespace.iASTValue>;
	FALSE="false"<AST=mynamespace.iASTValue>;
}

According to the docs this is allowable and antlr doesn't produce any errors,
but the code generated is thus:

	static public void initializeASTFactory( ASTFactory factory )
	{
...
		factory.setTokenTypeASTNodeType("true",
"mynamespace.iASTValue");
		factory.setTokenTypeASTNodeType("false",
"mynamespace.iASTValue");
	}

This is for the C# code generator btw. if you hadn't already worked that out
:)

This doesn't compile because setTokenTypeASTNodeType() only takes int as its
first parameter. I'm guessing that the step that adds those string literals
to the hashtable used by the testliterals thingy has been left out (as you
can guess I'm not really an expert on antlr internals :)

I can get around this for now by using the <AST=> option on the token
reference in the rule where it's used instead.

Richard



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list