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

## [Java] Class DescriptiveErrorStrategy

- org.apache.groovy.parser.antlr4.internal.DescriptiveErrorStrategy

-     public class DescriptiveErrorStrategy
      extends AbstractFriendlyErrorStrategy

  Fail-fast parser error strategy with friendly diagnostics (default Parrot mode).

  Cancels the parse with ParseCancellationException after reporting, matching BailErrorStrategy. sync is a no-op so the SLL stage of two-stage parsing stays cheap. Diagnostics are emitted from recover: after a failed SLL probe the strategy may still be in ANTLR's internal recovery mode, which suppresses reportError, while `recover` still runs under LL.

  For IDE multi-error collection use create(CharStream, boolean) with `recover == true`, which selects RecoveringDescriptiveErrorStrategy. Hosts should treat ErrorCollector as the multi-error source of truth: recovery may still produce a partial tree that fails later during AST building.

  See Also:
    RecoveringDescriptiveErrorStrategy
    CompilerConfiguration.ERROR_RECOVERY

- - ### Constructor Summary

    Constructors
    Constructor and description
    `DescriptiveErrorStrategy(CharStream charStream)` Fail-fast strategy with friendly diagnostics.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static ANTLRErrorStrategy` | `create(CharStream charStream, boolean recover)` Select fail-fast or recovering strategy.
    `` | `public void` | `recover(Parser recognizer, RecognitionException e)`
    `` | `public Token` | `recoverInline(Parser recognizer)`
    `` | `public void` | `sync(Parser recognizer)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractFriendlyErrorStrategy` | `createFailedPredicateErrorMessage, createInputMismatchErrorMessage, createNoViableAlternativeErrorMessage, reportFailedPredicate, reportInputMismatch, reportNoViableAlternative`

- - ### Constructor Detail

    - #### public DescriptiveErrorStrategy(CharStream charStream)

      Fail-fast strategy with friendly diagnostics.

      Parameters:
        `charStream` - source character stream used for snippet extraction

  - ### Method Detail

    - #### public static ANTLRErrorStrategy create(CharStream charStream, boolean recover)

      Select fail-fast or recovering strategy.

      Parameters:
        `charStream` - source character stream used for snippet extraction
        `recover` - `true` for multi-error resync; `false` for fail-fast
      Returns:
        an error strategy instance (never `null`)

    - #### public void recover(Parser recognizer, RecognitionException e)

      Mark incomplete contexts, emit a friendly LL diagnostic, then cancel.

    - #### public Token recoverInline(Parser recognizer)

      Bail-style: never return a synthetic token; report then cancel.

    - #### public void sync(Parser recognizer)

      No-op (matches BailErrorStrategy) so SLL stays cheap.