[antlr-interest] Re: Getting correct line information
braden at endoframe.com
Wed Feb 13 08:42:13 PST 2002
--- In antlr-interest at y..., mzukowski at b... wrote:
> Sounds like you need to tweak your scanner so that when it creates
> Tokens it fills in the line info properly.
Actually, I am doing that. I instantiate a CommonToken and call
setLine on it. I have used CommonToken::getLine inside the scanner to
confirm that the value in the Token is correct. This value doesn't
appear to have any effect on the line number returned in parser error
> If you use an ANTLR scanner then you simply need to call newline()
> whenever you want to increment the line count.
Meaning I could derive from CharScanner and just override nextToken as
I do now, but call newline instead of (in addition to?) setting
this information directly on the Token?
The source code for my scanner is included inline in my ANTLR grammar,
which an be viewed here:
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest