[antlr-interest] Token position 0, -1

Jim Idle jimi at temporal-wave.com
Mon Jul 9 10:53:03 PDT 2012


Ask the node for its start and end tokens, the start position of the first
token and the end position of the end token give you the span of input
text.

jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Mike Lischke
> Sent: Monday, July 09, 2012 5:29 AM
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Token position 0, -1
>
>
> 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) ;
>
> 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
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list