[antlr-interest] ASTs: copying info to imaginary nodes
Gavin Lambert
antlr at mirality.co.nz
Fri Oct 17 14:12:53 PDT 2008
At 09:31 18/10/2008, Bill Andersen wrote:
>What I'd like to do is to set the text of the generated
>AS_NAME node to the text of NAME. The book isn't clear
>on this case. Anything wrong with the following:
>
>name
> : t=NAME -> ^(AS_NAME[$t])
>
>??
What happened when you tried it?
If you just want the text alone copied over (and not the
line/column/index info) then you should use $t.text
instead. Using $t (or just t, I forget which) will try to copy
all characteristics of the "real" token and just change the token
type.
More information about the antlr-interest
mailing list