It means install your own version of recoverFromMismatchedToken and basically don't consume or insert but reset any flags etc.
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Justin Murray > Sent: Tuesday, December 21, 2010 10:53 AM > To: [email protected] > Subject: [antlr-interest] [C target] mismatchRecover() > > Hello, > > > > I am trying to turn off single token insertion and deletion error > recovery in my parser (C target). I found the following comment in > antlr3baserecognizer.c above the match() function. > > > > /// Match current input symbol against ttype. Upon error, do one token > > /// insertion or deletion if possible. > > /// To turn off single token insertion or deletion error > > /// recovery, override mismatchRecover() and have it call > > /// plain mismatch(), which does not recover. Then any error > > /// in a rule will cause an exception and immediate exit from > > /// rule. Rule would recover by resynchronizing to the set of > > /// symbols that can follow rule ref. > > /// > > > > This seems fairly straightforward at first glance, but then I > discovered that there is no mismatchRecover() function to override. > Digging through the code, I suspect that this function was renamed to > recoverFromMismatchedToken(), but I cannot simply override it with > mismatch() because their prototypes do not match. > > > > void * (*recoverFromMismatchedToken) (struct > ANTLR3_BASE_RECOGNIZER_struct * recognizer, > > ANTLR3_UINT32 ttype, > > pANTLR3_BITSET_LIST > follow); > > > > void (*mismatch) (struct > ANTLR3_BASE_RECOGNIZER_struct * recognizer, > > ANTLR3_UINT32 ttype, > > pANTLR3_BITSET_LIST follow); > > > > As you can see, one returns a void *, and the other returns void. What > is the correct way to do this? > > > > Thanks, > > > > Justin Murray > Software Engineer > [email protected] > > Aerotech, Inc. > 101 Zeta Drive > Pittsburgh, PA 15238 > 412-963-7470 > > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your- > email-address 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.
