[antlr-interest] Getting Token Text in C
Florian Leitner-Fischer
mail at florian-leitner.de
Tue Jun 9 06:13:37 PDT 2009
Dear All,
I'm currently using the following C code to parse Java files for a
university project.
This works very nice and I get an output like
package
identifier
;
and so on for my Java File.
The only thing I am missing now is to get the name of the identifier.
Is this somehow possible?
...
{
ANTLR3_INT32 T;
T = 0;
while (T != ANTLR3_TOKEN_EOF)
{
T = tstream->tstream->istream->_LA(tstream->tstream->istream, 1);
tstream->tstream->istream->consume(tstream->tstream->istream);
printf("%s \n", (psr->pParser->rec->state->tokenNames)[T], T);
}
}
...
Best Regards and thanks in advance,
Florian
--------------------------------------------
Florian Leitner-Fischer
Duchtlinger Str. 4d
78247 Hilzingen
phone +49 (0) 7731 9125 095
mobile +49 (0) 151 196 908 42
--------------------------------------------
More information about the antlr-interest
mailing list