dcsimg
Generated code if token has literal fails to compile
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Benjamin_Harper
Posted On:   Wednesday, August 3, 2005 05:32 AM

I am porting some code from the Java to C# that used ANTLR for parsing an input string (SQL). The tokens section of the grammar file was as follows: EXECUTE="execute"; INSERT="insert" ; Unfortunately this grammar causes invalid code to be generated in to the parser. 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.SelectA   More>>

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


The tokens section of the grammar file was as follows:


			
EXECUTE="execute"; INSERT="insert" ;



Unfortunately this grammar causes invalid code to be generated in to the parser.


			
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,
Benjamin

   <<Less
About | Sitemap | Contact