[antlr-interest] Possible bug in code generated for Lexer?
Tim Clark
timgclark at gmail.com
Wed Jun 20 07:44:35 PDT 2007
Hi
I reported this before and got no response from anyone. Hopefully this time
I'll be more lucky.
I have the option:
TokenLabelType=SL3Token
in my parser, where SL3Token extends CommonToken. [I want to save the name
of included file in the tokens.]
This lexer rule:
INCLUDE
: 'include' (WS)? f=STRING ;
generates code like this:
public final void mINCLUDE() throws RecognitionException {
try {
int _type = INCLUDE;
SL3Token f=null;
..... stuff ......
f = new CommonToken(input, Token.INVALID_TOKEN_TYPE,
Token.DEFAULT_CHANNEL, fStart190, getCharIndex()-1);
..... more stuff .....
}
which unfortunately is a Java error since it's trying to assign a
CommonToken to an SL3Token. I think this must be an Antlr bug.
Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070620/42a68160/attachment.html
More information about the antlr-interest
mailing list