[antlr-interest] getCharPositionInLine

Martin Kohl martin.kohl at gmail.com
Thu Sep 6 07:17:06 PDT 2007


Hiya,

I'm trying to keep track of where all my identifiers are at. The following
is from my TreeWalker grammar:

String id; int idLine, idCol;

identifier
    :    IDENT
        {    id= $IDENT.text;
            idLine=    $IDENT.getLine();
            idCol=    $IDENT.getCharPositionInLine();
        }

the id.text works, as does getLine(). getCharPositionInLine() always gives
me 0 though, target language being java.

Any ideas?

Thanks and kind Regards,
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070906/94df40dc/attachment.html 


More information about the antlr-interest mailing list