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

A Z asicaddress at gmail.com
Thu Apr 14 08:03:02 PDT 2011


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


More information about the antlr-interest mailing list