Package org.apache.groovy.parser.antlr4.internal

# Class RecoveringDescriptiveErrorStrategy

java.lang.Object
org.antlr.v4.runtime.DefaultErrorStrategy
org.apache.groovy.parser.antlr4.internal.RecoveringDescriptiveErrorStrategy

All Implemented Interfaces:
  `org.antlr.v4.runtime.ANTLRErrorStrategy`

public final class RecoveringDescriptiveErrorStrategy extends org.antlr.v4.runtime.DefaultErrorStrategy
Recovering parser error strategy with the same friendly diagnostics as `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.

See Also:
  - `DescriptiveErrorStrategy`
  - `CompilerConfiguration.ERROR_RECOVERY`

- ## Field Summary

  ### Fields inherited from class org.antlr.v4.runtime.DefaultErrorStrategy

  `errorRecoveryMode, lastErrorIndex, lastErrorStates, nextTokensContext, nextTokensState`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RecoveringDescriptiveErrorStrategy(org.antlr.v4.runtime.CharStream charStream)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String`
  `createFailedPredicateErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e)`
  Format a failed-predicate diagnostic.
  `protected String`
  `createInputMismatchErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e)`
  `protected String`
  `createNoViableAlternativeErrorMessage(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e)`
  `protected void`
  `reportFailedPredicate(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e)`
  `protected void`
  `reportInputMismatch(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e)`
  `protected void`
  `reportNoViableAlternative(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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.antlr.v4.runtime.ANTLRErrorStrategy

  `isSyncRequired`

- ## 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:
      `reportNoViableAlternative` in class `org.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:
      `reportInputMismatch` in class `org.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.

    `recognizer` is part of the protected hook surface (parity with `createNoViableAlternativeErrorMessage(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:
      `reportFailedPredicate` in class `org.antlr.v4.runtime.DefaultErrorStrategy`