public class ErrorStrategy
extends org.antlr.v4.runtime.BailErrorStrategy
ParseCancellationException. The implementation ensures that the
ParserRuleContext.exception field is set for all parse tree nodes
that were not completed prior to encountering the error.
This error strategy is useful in the following scenarios.
BailErrorStrategy.sync(org.antlr.v4.runtime.Parser) improves the performance of
the first stage.BailErrorStrategy avoids wasting work on recovering from errors
when the result will be ignored either way.
myparser.setErrorHandler(new BailErrorStrategy());
Parser.setErrorHandler(ANTLRErrorStrategy)| Constructor and Description |
|---|
ErrorStrategy() |
| Modifier and Type | Method and Description |
|---|---|
void |
sync(org.antlr.v4.runtime.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, reportMatch, reportMissingToken, reportNoViableAlternative, reportUnwantedToken, reset, singleTokenDeletion, singleTokenInsertionpublic void sync(org.antlr.v4.runtime.Parser recognizer)
sync in interface org.antlr.v4.runtime.ANTLRErrorStrategysync in class org.antlr.v4.runtime.BailErrorStrategyrecognizer - Copyright © 2019. All rights reserved.