[antlr-interest] AST nodes in v3

Kay Roepke kroepke at classdump.org
Mon Oct 9 03:47:20 PDT 2006


On 9. Oct 2006, at 12:42 Uhr, Kay Roepke wrote:

> 1) Just copy the info (type, line, column):
> 	-> (DIRECTIVE_STATEMENT[$ad] AXI_DIRECTIVE identifier)
> 	(this isn't too useful in this example, as you could just make the  
> AXI_DIRECTIVE the root node, but you'd use it to set the type of  
> the imaginary token to the type of a different real token, e.g. the  
> opening '{' of a block)
> 2) Just set the text but keep the token type of DIRECTIVE_STATEMENT  
> (I guess this is what you actually wanted to know ;):
> 	-> (DIRECTIVE_STATEMENT["directive statement"] AXI_DIRECTIVE  
> identifier)
> 3) Set both:
> 	-> (DIRECTIVE_STATEMENT[$ad, "directive statement"] AXI_DIRECTIVE  
> identifier)

Oops, I'm missing the ^ in front of the rewrites, of course. Just to  
be complete.

-k





More information about the antlr-interest mailing list