[antlr-interest] problem with line numbers in 2.7.2
atripp54321
atripp at comcast.net
Tue Jun 24 20:40:07 PDT 2003
Hi,
I just upgraded to antlr 2.7.2 because I want the
enhancement that a RecognitionException will show a line number.
Every time I get a RegocnitionException
in my lexer, it shows line number 1.
A quick look at my generated lexer code shows getLine()
is called to get the line number whenever a NoViableAltException
is created:
throw new NoViableAltForCharException((char)LA(1),
getFilename(), getLine(), getColumn());
And it looks like there is now a LineObject object
in my lexer, and THAT is where the true line number is being kept
(being incremented by the newline() method, for example).
However, there is no getLine() function in my lexer, it inherits
the one from CharScanner, which is getting the line number from
somewhere else.
And, sure enough, if I replace each getLine() call with
"lineObject.line", I get the proper line number.
Is this a bug? I apologize in advance if it's already been discussed.
Thanks,
Andy
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list