[antlr-interest] Conditional lexing

Jim Idle jimi at temporal-wave.com
Fri Sep 14 09:56:12 PDT 2012


Yes - that is parser context not lexer context. An @members variable is
probably just fine, though sometimes you need a context variable.

Jim


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Mike Lischke
> Sent: Friday, September 14, 2012 6:48 AM
> To: ANTLR Mailing List
> Subject: Re: [antlr-interest] Conditional lexing
>
>
> > The next step is now to keep a global flag to track when a version
> comment is active so I can properly handle the trailing '*/' part. What
> is usually used for such a flag, USERx?
>
>
> Using USERx doesn't work for at least two reasons: the lexer state
> seems to be reset for each token run and using it in a gated semantic
> predicate leads to a dfa which excludes the gated expression, so it is
> not even attempted to match it. Solved by using a member var.
>
> 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