[antlr-interest] how to get hold of individual nodes in a tree parser
Benjamin Shropshire
shro8822 at vandals.uidaho.edu
Tue Feb 26 16:49:23 PST 2008
Benjamin Shropshire wrote:
> I have a tree grammar with a rule like this:
>
> name : ^(NAME name_literal+) { ; }
>
> I need to do a foreach over the name_literal nodes but I can't seem to
> find anywhere in the manual that inserts action rules for repeated
> nodes in a tree parser. Anyone known how to do this?
>
I'm still stumped
Looking at the generated code it looks like the parsed subtrees are
discarded (or if I refer to name_literal all but the last one is). Is
this the the planned behavior?
It seems that "look for a list of foo's and then let me at them" is
common enough that there would be some special way to make it easy.
Something like "$name_literal.List". Is this not the case?
Am I approaching this wrong? I want to do stuff with the list of
name_literals. Working with each name_literal by it's self is useless to me.
More information about the antlr-interest
mailing list