Define 2 error recovery productions to use inside your parser productions:
// ErrorReplace production called when string was interpreted as string.
void ErrorReplace(String parsed, String expected) throws ParseAbortException
// ErrorMissing production called when the token was missing
void ErrorMissing(String skipped) throws ParseAbortException
and one error recovery method to be used in catch clauses:
// ErrorSkipto called to consume all tokens up to the first one of kind
// The error message in is also printed.
void ErrorSkipto(int stoptoken, Error e) throws ParseAbortException
void ErrorSkipto(int stoptoken, Exception e) throws ParseAbortException
(The 2 separate definitions are needed to handle lexical errors which are errors
and parse errors which are exceptions).