[antlr-interest] praising setUnknownTokenBoundaries()

Jim Idle jimi at temporal-wave.com
Tue Aug 28 14:35:05 PDT 2012


If you use:


-> ^(X Y ^(Z A B C))

Then the indexes for Z are not calculated as that is only done for the X
node as the generated method is exited.

That is the only instance I know of where the start and stop will not be
set, so I always use subrules for those.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Pedro Francisco
> Sent: Tuesday, August 28, 2012 2:31 PM
> To: ANTLR interest
> Subject: [antlr-interest] praising setUnknownTokenBoundaries()
>
> Hello!
>
> I've recently found setUnknownTokenBoundaries() and finally
> CommonTree's
> getTokenStartIndex() and getTokenStopIndex() started making sense
> (i.e., working as expected :) ).
>
> Thing is, I always thought start and stop index would be calculated
> either automatically on Tree construction or on-demand when requested
> (which taking a quick look at the source would indicate so).
>
> So I'm missing something here? Why does it seem Start and Stop token
> aren't computed for a tree with a list of child nodes?
>
> Thanks in Advance,
> --
> Pedro
>
> 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