[antlr-interest] Source positions for imaginary tokens

Jim Idle jimi at temporal-wave.com
Tue Sep 11 12:08:37 PDT 2012


It is not a bug with the C target, as I have explained on numerous
occasions. The other targets rely on method signatures to select the
correct re-write. This is not available in C.

However, the information is erroneous anyway. Look at the generated code
and you will see that only root nodes are fixed up with positional info.

Finally, rewriting like that is very expensive. I don't recommend it
anyway.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Mike Lischke
> Sent: Monday, September 10, 2012 11:30 PM
> To: Guus Bonnema
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Source positions for imaginary tokens
>
>
> > For instance like this: lb=LBRACE block RBRACE ^(DUM[$lb,"SLIST"]
> > block)
> >
> > The imaginary token DUM will get the position information of the left
> > brace and will show in the AST tree as SLIST.
> >
> > I got this information from the reference (book of TParr).
>
>
> Unfortunately, this doesn't work with all targets. For instance the C
> target has a bug that prevents the use of things like DUM[$lb].
>
> 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