[antlr-interest] treewalker $expression.text?

Martin Kohl martin.kohl at gmail.com
Thu Sep 6 10:06:00 PDT 2007


Hello,

Why can't I use the form $ruleName.text in my actions in the tree walker
grammar? For example:

rule :
   eitherRule {System.out.println($rule.text);}
|  orRule
;

works just fine if it's in the normal Parser Grammar, but not if I try to do
it in the TreeWalker grammar. Is there any way around this? Also, I notice I
can do this with Tokens in the TreeGrammar without problems. So I can get it
to print an IDENT, but if there's an expression specifying that IDENT to
follow, I can't print that in the TreeWalker.

Please help, I like the Tree Walker concept and would hate to have to revert
to moving all the actions to the normal Parser Grammar.

Thanks!
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070906/bba419ff/attachment.html 


More information about the antlr-interest mailing list