[antlr-interest] "Actions, however, can ask for the hidden channel tokens."
Terence Parr
parrt at cs.usfca.edu
Mon Mar 17 09:59:55 PDT 2008
I think it was Ric Klaren and I that were discussing something like
this...can't remember who or when. Decided that, for now, it's
better to use an action to get off-channel tokens...might have helper
functions in CommonTokenStream.
Ter
On Mar 17, 2008, at 10:51 AM, Martin Probst wrote:
> Hi,
>
>> the token stream has a buffer of all tokens on all channels. if
>> your token is t, then i=t.getTokenIndex() or whatever will give
>> you an index. Then look at tokensStream.get(i-1) and -2 etc... to
>> see if their t.getChannel() is hidden.
>
> Ok, that might work. Though that's not quite what I hoped for. Any
> chance of doing something like this:
> someRule options {
> channels = [0, 1, HIDDEN];
> }: FOO BAR WS BAZ;
>
> ? That'd be really cool, at least for my use case ;-)
>
> Regards,
> Martin
More information about the antlr-interest
mailing list