[antlr-interest] [SPAM] [SPAM] Optional expression rule alternative

Kevin J. Cummings cummings at kjchome.homeip.net
Fri Feb 11 09:44:22 PST 2011


On 02/11/2011 12:34 PM, Olivier Lefevre wrote:
> Is it possible to have a rule like this in ANTLR?
> 
>    rule[boolean z] : if (z) then rule1 else rule2 ;

rule[boolean z]
    : { z }? rule1
    | rule2
    ;

> Thanks,
> 
> -- O.L.

-- 
Kevin J. Cummings
kjchome at verizon.net
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)


More information about the antlr-interest mailing list