[antlr-interest] LineNumber of JavaSource

Matthias Gutheil matthias.gutheil at informatik.uni-mannheim.de
Wed Jan 25 11:25:29 PST 2006


Hello,

I am using the java15.g grammar from

http://www.antlr.org/grammar/1090713067533/index.html.

I need the linenumbers for all TokenTypes in my AST. I extended the 
AST-class and have linenumbers. But e.g. for CLASS_DEF or others there 
are no line numbers generated.

I coded a bit in the Recognizer and there are lineNumers for these 
Tokens, but then only

astFactory.create(CLASS_DEF, "CLASS_DEF")) is called, which constructs a 
node without linenumber.

When I change the grammer, I get another Recognizer and it would work. 
But I am not an expert in that (not yet), but I checked this for CLASS_DEF.

Is there another solution? The one with getting the linenumber from 
childs is not 100% correct.

Cheers
Matthias
			

-- 
Matthias Gutheil, Dipl. Inform.
Universität Mannheim
Lehrstuhl für Softwaretechnik
A5, 6, Gebäudeteil B
68131 Mannheim
Germany

E-Mail: matthias.gutheil at informatik.uni-mannheim.de
Tel: (+49) 621 181 3913


More information about the antlr-interest mailing list