Class RecoveringDescriptiveErrorStrategy
- All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorStrategy
DescriptiveErrorStrategy.
Uses ANTLR's default resync / single-token repair so multiple recognition
errors can be reported in one pass (IDE editing). Prefer construction via
DescriptiveErrorStrategy.create(CharStream, boolean).
Callers must parse with LL prediction and error listeners installed. Hosts
should read diagnostics from
ErrorCollector: a partial tree may still
fail during AST building after recovery.
-
Field Summary
Fields inherited from class org.antlr.v4.runtime.DefaultErrorStrategy
errorRecoveryMode, lastErrorIndex, lastErrorStates, nextTokensContext, nextTokensState -
Constructor Summary
ConstructorsConstructorDescriptionRecoveringDescriptiveErrorStrategy(org.antlr.v4.runtime.CharStream charStream) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateFailedPredicateErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e) Format a failed-predicate diagnostic.protected StringcreateInputMismatchErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e) protected StringcreateNoViableAlternativeErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e) protected voidreportFailedPredicate(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e) protected voidreportInputMismatch(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e) protected voidreportNoViableAlternative(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e) Methods inherited from class org.antlr.v4.runtime.DefaultErrorStrategy
beginErrorCondition, constructToken, consumeUntil, endErrorCondition, escapeWSAndQuote, getErrorRecoverySet, getExpectedTokens, getMissingSymbol, getSymbolText, getSymbolType, getTokenErrorDisplay, inErrorRecoveryMode, notifyErrorListeners, recover, recoverInline, reportError, reportMatch, reportMissingToken, reportUnwantedToken, reset, singleTokenDeletion, singleTokenInsertion, sync
-
Constructor Details
-
RecoveringDescriptiveErrorStrategy
public RecoveringDescriptiveErrorStrategy(org.antlr.v4.runtime.CharStream charStream) - Parameters:
charStream- source character stream used for snippet extraction
-
-
Method Details
-
createNoViableAlternativeErrorMessage
protected String createNoViableAlternativeErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e) -
reportNoViableAlternative
protected void reportNoViableAlternative(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e) - Overrides:
reportNoViableAlternativein classorg.antlr.v4.runtime.DefaultErrorStrategy
-
createInputMismatchErrorMessage
protected String createInputMismatchErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e) -
reportInputMismatch
protected void reportInputMismatch(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e) - Overrides:
reportInputMismatchin classorg.antlr.v4.runtime.DefaultErrorStrategy
-
createFailedPredicateErrorMessage
protected String createFailedPredicateErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e) Format a failed-predicate diagnostic.recognizeris part of the protected hook surface (parity withcreateNoViableAlternativeErrorMessage(org.antlr.v4.runtime.Parser, org.antlr.v4.runtime.NoViableAltException)/createInputMismatchErrorMessage(org.antlr.v4.runtime.Parser, org.antlr.v4.runtime.InputMismatchException)) so subclasses can include parser state when customising the message. -
reportFailedPredicate
protected void reportFailedPredicate(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e) - Overrides:
reportFailedPredicatein classorg.antlr.v4.runtime.DefaultErrorStrategy
-