[antlr-interest] Line number in AST

Martin Probst mail at martin-probst.com
Wed Apr 6 11:24:23 PDT 2005


Hi,

> I want to get the line number of java code while
> parsing the source code. How can I generate AST with
> line number in the node?

ASTs are generally generated with line numbers in them, BaseAST has a
method called "getLine()".

>  Because I am new to Antlr, I
> expect to see some examples about this. 

If you want to know how to get the full location (including column) read
the ANTLR manual.

Regards,
Martin



More information about the antlr-interest mailing list