[antlr-interest] Line number in AST

Bharath Sundararaman Bharath.Sundararaman at starthis.com
Wed Apr 6 11:27:43 PDT 2005


Hi Martin,

This link might be useful to you:
http://www.milk.com/kodebase/antlr-tutorial/

Bharath.

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Martin Probst
Sent: Wednesday, April 06, 2005 1:24 PM
To: FC
Cc: ANTLR Interest
Subject: Re: [antlr-interest] Line number in AST

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