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

YINGAnnie yimm8369 at hotmail.com
Thu Mar 19 14:30:36 PDT 2009


 

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

_________________________________________________________________
MSN安全保护中心,免费修复系统漏洞,保护MSN安全!
http://im.live.cn/safe/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090320/93817026/attachment.html 


More information about the antlr-interest mailing list