[antlr-interest] Re: How to set text in a tree node?

bjsp123 bjsp123 at yahoo.com
Tue Nov 4 06:09:10 PST 2003


--- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...> wrote:
> > work because the #j is not handled correctly -- when generating 
C++, 
> > it emits a simple 'j', whereas the variable is actually 
> > called 'j_AST'.  The following works for C++:
> 
> Which antlr version is this ? Could you try a development snapshot 
from
> http://wwwhome.cs.utwente.nl/~klaren/antlr/ and see if the problem
> persists?
> 

Thanks for your reply.

I downloaded this version, but it doesn't work with my MSVC6 project 
(at least, not within the time I have).  Of course it's not 
impossible that this is an MSVC6-specific issue... 


> Longshot: try turning off AST generation for the complete rule and 
remove
> the ! from the tokens/references in the rule. Something like this:
> 
> > strct !
> >   :   "struct"
> >       j:identifier
> >       LCURLY m:member_list RCURLY
> >       { #strct = #([STRCT, #j->getText()], #m); }
> >   ;


No go... it just doesn't expand #labels correctly when they're in the 
second parameter of a [] node-creation block.  I can work around that 
by just manually writing out the node-creation code in an action, but 
then my grammar would be C++ specific.


Benjamin




 

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




More information about the antlr-interest mailing list