[antlr-interest] #setType (C++)

Trey Spiva Trey.Spiva at embarcadero.com
Thu Dec 5 06:34:02 PST 2002


The syntax should be:

unaryExpr
:    
    p:PLUS^ { #p->setType(UNARY_PLUS); } ...
    ...
;

-----Original Message-----
From: Hrvoje Nezic [mailto:hrvoje.nezic at envox-lab.hr] 
Sent: Thursday, December 05, 2002 6:36 AM
To: ANTLR mailing list
Subject: [antlr-interest] #setType (C++)

Is it possible to use #setType in C++?
 
In options I declared:
    buildAST = true;

and then tried to use #setType in rules:

unaryExpr
:    
    PLUS^ { #PLUS.setType(UNARY_PLUS); } ...
    ...
;

This is translated into:

    antlr::RefAST tmp19_AST = antlr::nullAST;
    tmp19_AST.setType(UNARY_PLUS);

and cannot be compiled, because ASTRefCount doesn't have 
the setType method (RefAST is defined as ASTRefCount<AST>).

Is there a workaround for this, or am I doing something wrong?

Regards,
Hrvoje Nezic



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list