[antlr-interest] Re: ANTLR C++ error?

marc_schellens m_schellens at hotmail.com
Wed Feb 27 02:36:38 PST 2002


> Why do you suspect this is an error? Is there weird behaviour? As
far as I
> can tell you have a treeparser with buildast on.
> 
> In the first case antlr cannot copy the incoming AST so it generates
a new
> one. In the second case the incoming ast (_t) can be copied (via
tmp58) to
> the output tree whilst overriding the text. The code may be
inefficient but
> it works.
> 
> I see no problem here.
> 
> Cheers,
>> Ric

As I see it, the problem is the first cast:

var_AST=astFactory.create(static_cast<antlr::RefAST>(
static_cast<antlr::RefAST>(tmp58_AST),i->getText()
));

because of which the expression is a comma expression instead of
to paramters. Consequently I get the following error:

my.tree.g: In method `void MyTreeParser::var
(antlr::ASTRefCount<DNode>)':
my.tree.g:316: no matching function for call to 
`antlr::ASTRefCount<antlr::AST>::ASTRefCount (string)'
antlr/ASTRefCount.hpp:66: candidates are: 
antlr::ASTRefCount<T>::ASTRefCount (const antlr::AST * = 0) [with T = 
antlr::AST]
antlr/ASTRefCount.hpp:70:                 
antlr::ASTRefCount<T>::ASTRefCount (const antlr::ASTRefCount<T> &) 
[with T = antlr::AST]

Do I miss something?
Maybe I got the wrong syntax?
I thought with #[TYPE,text] I would define a NEW node. I don't want
to copy something here.

marc


 

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



More information about the antlr-interest mailing list