[antlr-interest] How can I modify a tree node value according to the value of another tree node ?

YINGAnnie yimm8369 at hotmail.com
Mon Mar 16 14:18:13 PDT 2009


 

Hi everyone,

 

 

What I want to do is to replace var t:Number=Math.ceil(1.5);  to  var t:int=int(1.5); The tree I got is something like this:

 

PROPERTY_DECL (VARIABLE_STATEMENT (VAR_DECL_LIST (VAR_ID_DECL t (QUALIFIED_NAME Number)) = (ASSIGNMENT_EXPRESSION (CONDITION_EXPRESSION (...........(QUALIFIED_NAME Math . ceil))) (ARGUMENT_SUFFIX (.........(PRIMARY_EXPRESSION 1.5))))

 

....... stands for some other nodes.

 

 

Replacing Math.ceil(1.5) to int(1.5) is easy to implement.But cos Number rule and Math.ceil rule belong to different tree, how can I replace Number to int when value of the other tree's node equals to Math.ceil? 

 

Thanks in advance!

 

 

Annie

_________________________________________________________________
上Windows Live 中国首页,下载最新版 MSN!
http://im.live.cn/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090317/56797e40/attachment.html 


More information about the antlr-interest mailing list