[antlr-interest] Wondering about bogus getLine() implementation

Terence Parr parrt at cs.usfca.edu
Fri Aug 12 10:56:23 PDT 2005


On Aug 12, 2005, at 9:56 AM, Georg Lenz wrote:

>
>
> Hello
>
> I am just wondering about the bogus getLine() getColumn()  
> Implementation in
> BaseAST (not overwritten in any subtype)
>
>
>    public int getLine() {
>        return 0;
>    }
>
>    public int getColumn() {
>        return 0;
>    }
>
> Okay, in most cases you don't care about line numbers but in my  
> case I do.
> So what is the reason for this?! Do I miss anything?

Hi.  These days I store the token object in the AST and then override  
those methods to pull from the token.

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com



More information about the antlr-interest mailing list