[antlr-interest] Problems with generated code

Theo Harper Theo_Harper at systemsunion.com
Wed Aug 3 02:34:04 PDT 2005


I am porting some code from the Java that used ANTLR for parsing an input
string to C#.

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.SQLParser.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? 

Thanks,
Theo Harper



This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom it is addressed. If you have received this e-mail in error you must not copy, distribute or take any action in reliance on it. Please notify the sender by e-mail or telephone.
We utilise an anti-virus system and therefore any files sent via e-mail will have been checked for known viruses. You are however advised to run your own virus check before opening any attachments received as we will not in any event accept any liability whatsoever once an e-mail and/or any attachment is received. Any views expressed by an individual within this e-mail do not necessarily reflect the views of Systems Union Group plc or any of its subsidiary companies.


More information about the antlr-interest mailing list