[antlr-interest] crash in C runtime during PREPORTERROR()

Ben Ratzlaff antlr at daishiva.com
Thu Jan 15 11:03:05 PST 2009


Howdy, just finished generating code for my first try at antlr, and it
crashes during parsing (pardon me if this is a known issue, still finding my
way around the website/wiki)
It's erroring during parsing, and crashing while printing the error message,
Looks like I still have work to do on my grammar =)

antlr3commontoken.c line 346
token->tokText.text    = token->strFactory->newStr8(token->strFactory,
(pANTLR3_UINT8)"<EOF>");

the strFactory pointer is not valid in my case. I have not yet found where
strFactory is assigned to. I can get around this by setting up the factory
manually:

pANTLR3_INPUT_STREAM            input = ...
pFactoringLexer                             lexer = ...

pANTLR3_STRING_FACTORY        stringFactory = antlr3StringFactoryNew();
lexer->pLexer->rec->state->tokSource->eofToken.strFactory = stringFactory;

pANTLR3_COMMON_TOKEN_STREAM        lexTokens =
antlr3CommonTokenStreamSourceNew(...);
pFactoringParser                parser = ...
parser->progStart(parser); // crash here
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090115/c6e46218/attachment.html 


More information about the antlr-interest mailing list