[antlr-interest] [C target] ANTLR 3.1 issues with token offsets and generated AST return types
Sven Van Echelpoel
sven.van.echelpoel at empolis.com
Thu Aug 21 01:47:27 PDT 2008
[Trying again, sent too quickly before]
> Try the released runtime, correcting your grammar and make sure that
> you are using the UCS2 input stream. Use the built in references for
> $pos and so on in the lexer and see what you get.
>
OK, I managed to build everything with the released 3.1 now. There was
some environment variable that still pointed to the b2 version in my
build system. Deeply sorry for all the noise concerning it not building.
Yet with the released 3.1 I still get 0 for the token indexes. Here's
how I get at the indexes:
ANTLR3_BASE_TREE_struct* mAST;
ANTLR3_COMMON_TOKEN_struct* mToken = mAST->getToken( mAST );
unsigned index = mToken->start;
but I also tried
unsigned index = mToken->getStartIndex( mToken );
Is this the correct way of getting at the token indexes? If not, can you
point me to the functions in the documentation that I need in order to
get the correct indexes?
Thanks,
Sven
More information about the antlr-interest
mailing list