[antlr-interest] #setType (C++)
Ric Klaren
klaren at cs.utwente.nl
Thu Dec 5 06:02:43 PST 2002
Hi,
On Thu, Dec 05, 2002 at 02:36:21PM +0100, Hrvoje Nezic wrote:
> 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?
Shouldn't you use #PLUS->setType( .. ) ? Due to the Refcounter you need to
use -> operator in stead of the dot.
Cheers,
Ric
--
-----+++++*****************************************************+++++++++-------
---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722 ----
-----+++++*****************************************************+++++++++-------
"Don't call me stupid." "Oh, right. To call you stupid would be an insult
to stupid people. I've known sheep that could outwit you! I've worn
dresses with higher IQs!" --- A Fish Called Wanda
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list