[antlr-interest] Fwd: Simple question, Hard answer?
Gavin Lambert
antlr at mirality.co.nz
Wed Sep 3 14:13:49 PDT 2008
At 23:13 3/09/2008, Kausch, Robert wrote:
>You can ignore tokens by sending them on a different channel.
The
>following grammar ignores everything that is not 'okko' and
works
>for me:
>
>grammar test;
>
>start: (T1)*;
>
>T1: 'okko';
>T2: ~(T1) { $channel = HIDDEN; } ;
T1 is a sequence. ~ is intended to operate on sets (alternatives
of single characters/tokens). Odd things happen if you try to use
~ on a sequence. (It does actually compile, but it doesn't run
properly.)
Using "T2: .;" ought to work, though. Or just making it a
filtering lexer.
More information about the antlr-interest
mailing list