[antlr-interest] How to compare the value of token in tree grammar?

YINGAnnie yimm8369 at hotmail.com
Tue Mar 10 21:35:20 PDT 2009


 

Hi everyone:

 

Here is my tree grammar, what I want to do is when IDENTIFIER is equal to Number , then use template of fortype to change the Number to int.

 

forqualifiedName 
    : ^(FOR_QUALIFIED_NAME id=IDENTIFIER DOT* IDENTIFIER*)     {$IDENTIFIER.text.equals("Number")}? ->fortype(x={"int"})                                           
    | ^(FOR_QUALIFIED_NAME VOID)   
    ;

 

but an error occur said "java.lang.Error: Unresolved compilation problem: 
 The method getText() is undefined for the type Object"

 

Is there something worng with        $IDENTIFIER.text.equals("Number")   ?

 

 

Thanks in advance.

 

 

 

 

 

_________________________________________________________________
MSN 表情魔法书,改变你的对话时代!
http://im.live.cn/emoticons/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090311/8da558e4/attachment.html 


More information about the antlr-interest mailing list