[antlr-interest] Token position 0, -1

Stefan Mätje (d) Stefan.Maetje at esd-electronics.com
Mon Jul 9 06:12:09 PDT 2012


Hi Mike,

see my suggestion below:

Am 09.07.2012 14:29:17 schrieb(en) Mike Lischke:
> 
> Stefan,
> 
> > compoundStatement
> > 	:  lc='{' statement*  '}'
> > 		->  ^(SLIST[$lc]  statement*)
> > 	;
> 
> Is there a similar construct if you have a rule instead of a token? For
> instance:
> 
> target_table:
> 	qualified_identifier -> ^(TABLE_REF_ID qualified_identifier)
> ;

I use in some case the start attribute of the subrule:

target_table:
	qualified_identifier -> ^(TABLE_REF_ID[$qualified_identifier.start] 
qualified_identifier)

> Here I would like to give the synthetic TABLE_REF_ID token the location info
> from the qualified_identifier rule.
> 
> Mike
> -- 
> www.soft-gems.net



More information about the antlr-interest mailing list