reportAmbiguity method

  1. @override
void reportAmbiguity(
  1. Parser recognizer,
  2. DFA dfa,
  3. int startIndex,
  4. int stopIndex,
  5. bool exact,
  6. BitSet? ambigAlts,
  7. ATNConfigSet configs,
)
override

This method is called by the parser when a full-context prediction results in an ambiguity.

Each full-context prediction which does not result in a syntax error will call either {@link #reportContextSensitivity} or {@link #reportAmbiguity}.

When [ambigAlts] is not null, it contains the set of potentially viable alternatives identified by the prediction algorithm. When [ambigAlts] is null, use {@link ATNConfigSet#getAlts} to obtain the represented alternatives from the [configs] argument.

When [exact] is [true], all of the potentially viable alternatives are truly viable, i.e. this is reporting an exact ambiguity. When [exact] is [false], at least two of the potentially viable alternatives are viable for the current input, but the prediction algorithm terminated as soon as it determined that at least the minimum potentially viable alternative is truly viable.

When the {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} prediction mode is used, the parser is required to identify exact ambiguities so [exact] will always be [true].

This method is not used by lexers.

@param recognizer the parser instance @param dfa the DFA for the current decision @param startIndex the input index where the decision started @param stopIndex the input input where the ambiguity was identified @param exact true if the ambiguity is exactly known, otherwise false. This is always true when {@link PredictionMode#LL_EXACT_AMBIG_DETECTION} is used. @param ambigAlts the potentially ambiguous alternatives, or null to indicate that the potentially ambiguous alternatives are the complete set of represented alternatives in configs @param configs the ATN configuration set where the ambiguity was identified

Implementation

@override
void reportAmbiguity(
  Parser recognizer,
  DFA dfa,
  int startIndex,
  int stopIndex,
  bool exact,
  BitSet? ambigAlts,
  ATNConfigSet configs,
) {}