[antlr-interest] C target - Disabling lexer output for groups of tokens

Jim Idle jimi at temporal-wave.com
Thu Apr 14 08:41:26 PDT 2011


Implement your own next token method. There are two functions, this one
and nextToken - copy them and make the change then install your pointer
before calling the lexer.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of A Z
> Sent: Thursday, April 14, 2011 8:03 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] C target - Disabling lexer output for groups
> of tokens
>
> Is there way to persistantly switch the lexer output on or off? Channel
> assignments only last for one token. I know I can use skip() but then I
> have to add the same code to every lexer rule(I have hundreds) where it
> checks a boolean and then executes skip(). I also looked at changing
> the default channel but I don't how that can be done as the following
> isn't a function pointer that can be reassigned:
>
> ANTLR3_INLINE static pANTLR3_COMMON_TOKEN
> nextTokenStr        (pANTLR3_TOKEN_SOURCE toksource)
> {
> ...
>             lexer->rec->state->channel                        =
> ANTLR3_TOKEN_DEFAULT_CHANNEL;
> ...
> }
>
> Is there another way of doing this?
>
> Thanks
>
> 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