public class BailErrorStrategy extends DefaultErrorStrategy
myparser.setErrorHandler(new BailErrorStrategy());
_factory, errorRecoveryMode, lastErrorIndex, lastErrorStates
Constructor and Description |
---|
BailErrorStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
recover(Parser recognizer,
RecognitionException e)
Instead of recovering from exception
e , re-throw it wrapped
in a ParseCancellationException so it is not caught by the
rule function catches. |
Token |
recoverInline(Parser recognizer)
Make sure we don't attempt to recover inline; if the parser
successfully recovers, it won't throw an exception.
|
void |
sync(Parser recognizer)
Make sure we don't attempt to recover from problems in subrules.
|
beginErrorCondition, consumeUntil, endErrorCondition, escapeWSAndQuote, getErrorRecoverySet, getExpectedTokens, getMissingSymbol, getSymbolText, getSymbolType, getTokenErrorDisplay, inErrorRecoveryMode, reportError, reportFailedPredicate, reportInputMismatch, reportMissingToken, reportNoViableAlternative, reportUnwantedToken, setTokenFactory, singleTokenDeletion, singleTokenInsertion
public void recover(Parser recognizer, RecognitionException e)
e
, re-throw it wrapped
in a ParseCancellationException
so it is not caught by the
rule function catches. Use Throwable.getCause()
to get the
original RecognitionException
.recover
in interface ANTLRErrorStrategy
recover
in class DefaultErrorStrategy
public Token recoverInline(Parser recognizer) throws RecognitionException
recoverInline
in interface ANTLRErrorStrategy
recoverInline
in class DefaultErrorStrategy
RecognitionException
public void sync(Parser recognizer)
sync
in interface ANTLRErrorStrategy
sync
in class DefaultErrorStrategy
Copyright © 1992-2013 ANTLR. All Rights Reserved.