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

Jim Idle jimi at temporal-wave.com
Tue Sep 9 07:23:02 PDT 2008


On Tue, 2008-09-09 at 17:49 +0800, Ronghui Yu wrote:
> 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


I'll take a look - perhaps the value should not be reset.

Jim

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


More information about the antlr-interest mailing list