Hello,
Working with ANTLR v3 + StringTemplate I often come across the following
situation:
One parser rule calls another rule and depending on the evaluation of that
called rule, I'd like to return different values using StringTemplate. As far
as I know, each rule alternative in ANTLR may only return one kind of
StringTemplate output. So if I want to return two kinds of outputs, I need two
parser rule alternatives. I then come up with parser rules of the following
style (using a semantic predicate), but this won't work:
R: // Alternative A
called_rule
{ (comeConditionDependingOn_Called_rule) }?
-> stringtemplate_output_A(...)
| // Alternative B
{ (!(comeConditionDependingOn_Called_rule)) }?
-> stringtemplate_output_B(...)
=> What is a smarter way of achieving the different desired outputs?
Thanks in advance for any feedback & best regards,
Ralf Cremerius
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.