At 17:24 25/11/2009, David-Sarah Hopwood wrote:
 >Jim Idle wrote:
 >> expr : ae+=andExpr (OR ae+=andExpr)* -> ^(OR $ae+) ;
 >
 >That isn't what the poster asked for: it will produce '(OR a)'
 >when the input is an andExpr, whereas what I posted above
 >should produce just 'a', if I haven't made a mistake.

I think the += based equivalent is this:

expr
   : (andExpr -> andExpr)
     ((OR ae+=andExpr)+ -> ^(OR $expr $ae+))?
   ;

A fair bit harder to read, although it can be expanded to do 
weirder things a bit easier. :)


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.


Reply via email to