[antlr-interest] multiplicity in TreeParser
Rusty Burchfield
GICodeWarrior+antlr at gmail.com
Mon Feb 25 23:30:38 PST 2008
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.
Any assistance is greatly appreciated.
Thank you,
Rusty Burchfield
More information about the antlr-interest
mailing list