Dear Jim

If there's an EOF in the grammar, the C target crashes on input with certain syntax errors. I wrote this quick fix. I hope it at least helps you pinpointing the problem.

Any thoughts/comments?


Thanks
Marco
--- libantlr3c-3.2/src/antlr3baserecognizer-orig.c      2009-12-11 
23:54:59.000000000 +0100
+++ libantlr3c-3.2/src/antlr3baserecognizer.c   2011-02-03 14:39:59.942609300 
+0100
@@ -2216,7 +2216,7 @@
 
        if      (text != NULL)
        {
-               text->append8(text, (const char 
*)recognizer->state->tokenNames[expectedTokenType]);
+               text->append8(text, expectedTokenType == EOF ? (const char 
*)"EOF" : (const char *)recognizer->state->tokenNames[expectedTokenType]);
                text->append8(text, (const char *)">");
        }
        
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to