[antlr-interest] C "skip" function

Clifford Heath clifford.heath at gmail.com
Tue Nov 20 15:17:18 PST 2007


Jim Idle wrote:
> I forgot to implement the skip in the last runtime release. Sorry about 
> that, it was just an oversight. For now, you will need to set the type 
> to HIDDEN, which means it will be in the token stream but the parser 
> will tune it out. Obviously SKIP(); will need to be implemented as 
> sometimes there may be vast amounts of tokens that you don’t want to 
> push into the token stream. I will make sure it is in the next release.

BTW, the same is true for the Ruby version, and the definition HIDDEN=99
is missing also. Since you can't debug in ANTLRWorks without a compatible
skip(), I have this at the top of my grammars:

@lexer::members {
        # The Ruby template lacks skip(), but the WS rule below needs it for ANTLRworks
        def skip; @channel = 99; end
}

I hope that helps someone. Perhaps the same thing is feasible in the C
version, as a work-around?

Clifford Heath.



More information about the antlr-interest mailing list