[antlr-interest] "Actions, however, can ask for the hidden channel tokens."

Martin Probst mail at martin-probst.com
Mon Mar 17 09:51:19 PDT 2008


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