dcsimg
How to specify the node type for an imaginary node?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Dave_Herman
Posted On:   Thursday, May 10, 2001 08:14 PM


When using imaginary nodes, how do I specify the node type? I thought it would work like this:



			tokens {
			
DEC_LIST ;
}

...

declarationList
: (declaration)+
{ #declarationList =
#(#[DEC_LIST,"decList"],
#declarationList); }
;



This doesn't seem to work -- it creates a node of the default AST node type, not of DeclarationList .




Thanks,

Dave

Re: How to specify the node type for an imaginary node?

Posted By:   Terence_Parr  
Posted On:   Friday, May 11, 2001 04:34 PM

Hi Dave. Interesting. I guess the factory would have to do this as statically ANTLR cannot know what is in your actions. If ANTLR doesn't know what type to build statically (i.e., when it's generating code), it uses something like:


astFactory.create(LT(1));


if I recall. Can you modify the factory or set your own?
About | Sitemap | Contact