[antlr-interest] Getting line number and char position of current AST node

Scott Fortmann-Roe sfortma1 at swarthmore.edu
Thu Mar 29 09:25:31 PDT 2007


Hi,

Is there a way of getting the line number of the current AST node. All
I seem to be able to get is the line number of the next AST node using
the following:

(CommonTree)nodes.get(nodes.index())).getLine()

Maybe by "current" I mean previous. Basically, if an error occurs
during a symbol table look up I want access to the node that caused
that error, not the node after it.

This would be very useful for error reporting.

-Scott

-- 
Scott Fortmann-Roe
500 College Ave
Swarthmore, Pa 19081
(510) 866-5296


More information about the antlr-interest mailing list