[antlr-interest] Strategy for mapping output to line numbers from a tree walker
Joe Schmoe
shambolic at gmail.com
Tue Aug 18 11:43:53 PDT 2009
I have a grammar that produces an AST and a tree walker, and I am coming up
blank trying to figure out a reasonable way to track line number information
in the tree walker so that I can map my output to source file lines.
The only solution I have come up with is incredibly wordy, which is to make
sure that every time I see a token name in the walker I track the line
number.
rule : ^(TOKENNAME .... ) { TrackLine($TOKENNAME.line) }
;
I am sure there are better solutions than this but I haven't been able to
figure out what they are.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090818/3115e5b2/attachment.html
More information about the antlr-interest
mailing list