[antlr-interest] How can I use 3 predicates in one rule?

Gavin Lambert antlr at mirality.co.nz
Fri Mar 20 12:31:11 PDT 2009


At 10:30 20/03/2009, YINGAnnie wrote:
>Why I can not use 3 predicates together? What is the right format 
>to do this?
>
>callExpression
>     : ^(CALL_EXPRESSION memberExpression indexSuffix * 
> propertyReferenceSuffix* argumentSuffix*)
>     ({$memberExpression.text.equals("Math.ceil")}? 
> ->mathceil(x={"int"},y={$argumentSuffix.text}))
>     ({$memberExpression.text.equals("Math.abs")}? 
> ->mathabs(x={$argumentSuffix.text},y={"<0?"},z={"* -1 :"}))
>     ({$memberExpression.text.equals("Math.floor")}? 
> ->mathfloor(x={"int"},y={$argumentSuffix.text})
>     ;

IIRC, you need the predicate on the other side of the -> arrow.



More information about the antlr-interest mailing list