These are called Semantic Predicates. Section 12.1 in TDAR. Specifically, look at page 295 of the PDF. If the predicate evaluates to false, the alternative is effectively switched off.
- Justin On 2/11/2011 1:04 PM, Olivier Lefevre wrote: > Great! Not to abuse but would you know in which section of > "The Definitive ANTLR Reference" this mentioned? I couldn't > find it. What is this syntax called? > > But in my real-world problem it was actually not a choice > between rule1 and rule2 but a question of whether to allow > an extra alternative in the z case without too much > verbatim repetition, i.e. (again in pseudo-code): > > rule[boolean z] : > rule1 | rule2 | ... | rule23 | (z ? rule24 : nothing) ; > > That is, allow rule24 if z otherwise stop at rule23. > > Thanks again, > > -- O.L. > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address 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 il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.