Hi,
I have a tree grammar which looks like:
document :
^(DOCUMENT (type_def {templates.add($type_def.st);})*)
;
type_def:
struct | enum | foo | ... | bar
;
where struct, enum, foo, bar and the other are rules which return
string templates.
This doesn't work because the type_def rule doesn't return the string
template returned by the subrules.
I tried other things like the following:
type_def: a=(struct | enum |...) {templates.add($a.st);}
type_def: (a=struct | a=enum | ...) {templates.add($a.st);}
type_def @init {templates.add($type_def.st);}
: struct | enum | ...;
None of them work. The only solution I found was to duplicate the
action on all subrules.
--
Damien Cassou
http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---