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

Terence Parr parrt at cs.usfca.edu
Thu Mar 19 14:37:57 PDT 2009


last one must not have predicate
Ter
On Mar 19, 2009, at 2:30 PM, YINGAnnie wrote:

>
> Hi ,
>
> What I want todo is to change Math.ceil(1.5),Math.floor(1.5) and  
> Math.abs(1.5) to int(1.5), int(1.5) +1 and nn<0?nn*-1:n.
>
> 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})
>     ;
>
> Thanks.
>
> Annie
>
> 使用新一代 Windows Live Messenger 轻松交流和共享! 立刻下载!
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list