[antlr-interest] Getting correct line information

mzukowski at bco.com mzukowski at bco.com
Wed Feb 13 07:40:39 PST 2002


Sounds like you need to tweak your scanner so that when it creates Tokens it
fills in the line info properly.  

If you use an ANTLR scanner then you simply need to call newline() whenever
you want to increment the line count.

Monty

> -----Original Message-----
> From: braden_mcdaniel [mailto:braden at endoframe.com]
> Sent: Wednesday, February 13, 2002 7:38 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Getting correct line information
> 
> 
> I'm using a C++ ANTLR parser with a hand-written scanner that derives
> from TokenStream.  It basically works, but the line information in the
> error messages is wrong (generally I get some huge number that looks
> like an uninitialized value).
> 
> Looking around in the ANTLR library source, it looks like I probably
> want to derive from CharScanner rather than TokenStream in order to
> make the line information work. I'm hoping someone can give me a
> clearer roadmap to follow, though. Assuming I'm on the right track,
> what methods do I need to override to get sane results? Any other
> special steps I need to take? Thanks...
> 
> Braden
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list