[antlr-interest] Is this a bug of ANTLR3.1?

Ronghui Yu stoneyrh at gmail.com
Tue Sep 9 02:49:07 PDT 2008


I have figured out why this happen. In our product, the parser object (ctx)
can be reuseable for parsing different statements, but before parsing each
statement, there is a functio called *reinitLexerAndParser* to prepare
whatever need, one of functions called to re-initialize the parser object is
*setTokenStream*.

Before ANTLR3.1, this function doesn't reset the pointer
ctx->pParser->rec->state->tokenNames, so everything went well for my parser,
but in ANTLR3.1, this function set this pointer to NULL, so when parsing
another statement with this parser object again, the parser encounters a
NULL pointer when calling *getMissingSymbol*
I wonder if this is a must to reset this pointer to NULL.

My current solution is to save this pointer before calling this function,
and restore it after.
It works fine, but I still hope there is an offical approval.

Thanks

-- 
===========================
Regards
Ronghui Yu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080909/af23f3f3/attachment.html 


More information about the antlr-interest mailing list