[antlr-interest] Manual tree construction problem with VC 7.1

Martin Probst mail at martin-probst.com
Tue Apr 18 22:56:23 PDT 2006


You have to give the tree returned by the subrule a label to  
reference it, simply it's name doesn't work:

a: mylabel:b EOF { ## = #(#[...], #mylabel); };

will do the trick.

Martin

Am 19.04.2006 um 04:40 schrieb Thun:

> a: b EOF {#shader = #([ITK_A], b);} ;
>
>
> b: "B";
>
> I get the following error when compilng the generated code from the  
> parser above:
>
> error C2664: 'antlr::ASTArray::add' : cannot convert parameter 1  
> from 'void (void)' to 'antlr::RefAST'
> a_AST = antlr::RefAST(astFactory->make((new antlr::ASTArray(2))->add 
> (astFactory->create(ITK_A))->add(b)));
>
> The problem is with the '->add(b)'.
>
> b is the matching method for the b rule, it returns void.
>
> It cant compile in VS 2003 C++ 7.1, is there a way to fix it?
>
>
> Thanks
>
>
>



More information about the antlr-interest mailing list