dcsimg
MultiLexer with input sharing: a strange error
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pierluigi_Chiusolo
Posted On:   Saturday, August 21, 2004 07:54 AM

Hi, I'was spending many nights triyng to solve a parser mismatch while using multiple lexer and finally decided to test and debug one of antlr package examples, that is multiLexer, and surprise ... the example won't work, too Here's what I found referring to this example: JAVADOC_CLOSE in the javaParserTokeTypes got value 8, while JAVADOC_CLOSE in the javadocParserTokeTypes and javadocLexerTokeTypes table got value 9, so the following code block: match(JAVADOC_OPEN); DemoJavaDocParser jdocparser = new DemoJavaDocParser(getInputState()); jdocparser.content(); match(JAVADOC_CLOSE); generated a recognition exception on the last match because LA(1) returns value    More>>

Hi,
I'was spending many nights triyng to solve a parser mismatch while using multiple lexer and finally decided to test and debug one of antlr package examples, that is multiLexer, and surprise ... the example won't work, too
Here's what I found referring to this example:
JAVADOC_CLOSE in the javaParserTokeTypes got value 8, while JAVADOC_CLOSE in the javadocParserTokeTypes and javadocLexerTokeTypes table got value 9, so the following code block:

			

match(JAVADOC_OPEN);

DemoJavaDocParser jdocparser = new DemoJavaDocParser(getInputState());
jdocparser.content();

match(JAVADOC_CLOSE);


generated a recognition exception on the last match because LA(1) returns value 9 while it expects value 8
In my experience, this common situation worked well only when the required tokentype had the same values
Now my question is ... was this behaviour caused by a library bug or something wrong with me?

Thanks in advance    <<Less
About | Sitemap | Contact