Kay Röpke wrote:
Hi Andy!
On Apr 12, 2009, at 6:59 PM, Andy Grove wrote:
My grammar defines whitespace as:
Whitespace : ( '\t' | ' ' | '\r' | '\n' )+ { $channel = HIDDEN; }
;
funny, that should cause them to be there.
Do you know how I can access tokens on the hidden channel in C? I
also generate Java parser from the same grammer and the whitespace
tokens are available there.
After setting up my inputstream/lexer/tokenstream, i'm doing this:
ctx->token_vector = ctx->tokens->getTokens(ctx->tokens);
Where ctx->token_vector is
pANTLR3_VECTOR token_vector;
Later I'm retrieving the tokens by index (because this entire thing is
wired up to a script language - which uses 1-based indices, hence the
-1):
token = token_vector->get(token_vector, ndx-1);
I'm definitely seeing all tokens on all channels. I'm assuming you
haven't set any channels to be discarded using discardOffChannel or
discardSet?
Discarding happens during fillBuffer, so those tokens would never end
up in the tokens vector.
Which runtime library version are you using (I'm on the latest
released one, 3.1.3 IIRC)? Worst case I'd fire up the debugger and
watch fillBuffer() do its thing.
I believe that there is a fix for getting off channel tokens in the
3.1.3 runtime as a by-product of fixing something else. It should work
fine in 3.1.3
Jim
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
|
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address