[antlr-interest] newline() -> parser

Kaleb Pederson kibab at icehouse.net
Fri Jun 25 21:32:27 PDT 2004


On Friday 25 June 2004 4:01 pm, FranklinChen at cmu.edu wrote:
> Kaleb Pederson writes:
> > However, I want all the token information available to me in the parser. 
> > When I call getLine() or getColumn(), I get 0 and 0 returned.
>
> Since I heavily use ASTs, and delay a lot of semantic checks to the
> AST level (simplifying parsing), I use the following class.
>
> [To the ANTLR developers:  I suggest that something like this be made
> a standard part of the ANTLR distribution, since it is to useful.]

Thanks for the quick responses!  That makes perfect sense now; I was just 
using CommonAST as I didn't have an immediate need to subclass it.

Not being an Antlr expert, I find it totally counterintuitive that the 
functions getLine() and getColumn() exist, but, as far as I can tell, aren't 
immediately useful.  I would definitely expect the values to be defined when 
they are so readily available -- I would also expect functions without an 
implementation (ok, not technically correct) to be abstract.

Maybe there should be a small note in the sections on line and column numbers 
in the Lexer section.  That would have been sufficient to get me going in the 
right direction.  That said, I don't know why I didn't see it sooner.

Thanks again for the help.

--Kaleb


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list