[antlr-interest] multiplicity in TreeParser
Rusty Burchfield
GICodeWarrior+antlr at gmail.com
Tue Feb 26 13:27:56 PST 2008
Rusty Burchfield wrote:
> If I have a parser rule like the following:
> example: TOKEN^ (object1 | object2 | object3)+;
>
> Is there a way to access a list of the objects in the tree parser.
> For example:
> example returns [ComplexObject o]
> : #(TOKEN o1=object1+ o2=object2+ o3=object3+) {
> // Loop over each o1, o2, o3 and add them to o
> };
>
> Basically, in the code block, I would like access to all the immediate
> children of TOKEN. More specifically the result of the tree parser
> rule for each child.
>
> This is being developed in v2 for the C++ target. Although, I am not
> sure how much it matters in this case.
Is something like the above possible? Would it be easier with the
latest 3.1 build and the C target?
If there is any further information I can provide to facilitate a
response, please let me know.
Thank you,
Rusty Burchfield
More information about the antlr-interest
mailing list