[antlr-interest] Problems with generated code

Micheal J open.zone at virgin.net
Wed Aug 3 09:24:50 PDT 2005


> I am having a problem with the generated parser, specifically 
> the ASTFactory initialisation.
> 
> My tokens are defines as follows (in the grammar file):
> 
> 	EXECUTE="execute";  
> 	
> INSERT="insert"<AST=SystemsUnion.Reporting.Server.Execution.SQ
> LParser.Insert
> AST>;
> 	...
> 
> When I generate the parser and lexer the following code is 
> generated which does not compile:
> 
> 	static public void initializeASTFactory( ASTFactory factory ) {
> 		factory.setMaxNodeType(79);
> 		factory.setTokenTypeASTNodeType("insert",
> "SystemsUnion.Reporting.Server.Execution.SQLParser.InsertAST");
> 		factory.setTokenTypeASTNodeType("select",
> "SystemsUnion.Reporting.Server.Execution.SQLParser.SelectAST");
> 		...
> 
> The first argument to setTokenTypeAsTNodeType should be an 
> int and not a string. 
> 
> Does anyone have any suggestions? 

What version of ANTLR are you using?. 2.7.5 is the latest 

[I should note that Ric Klaren and Scott Stansfield distribute more recent
variants of 2.7.5 (Scott calls his 2.7.6).]

In the meantime, I'll do a quick test here myself...

Micheal



More information about the antlr-interest mailing list