DiagnosticErrorListener class

This implementation of ANTLRErrorListener can be used to identify certain potential correctness and performance problems in grammars. "Reports" are made by calling {@link Parser#notifyErrorListeners} with the appropriate message.

  • Ambiguities: These are cases where more than one path through the grammar can match the input.
  • Weak context sensitivity: These are cases where full-context prediction resolved an SLL conflict to a unique alternative which equaled the minimum alternative of the SLL conflict.
  • Strong (forced) context sensitivity: These are cases where the full-context prediction resolved an SLL conflict to a unique alternative, and the minimum alternative of the SLL conflict was found to not be a truly viable alternative. Two-stage parsing cannot be used for inputs where this situation occurs.
Inheritance

Constructors

DiagnosticErrorListener([bool exactOnly = true])
Initializes a new instance of DiagnosticErrorListener, specifying whether all ambiguities or only exact ambiguities are reported.

Properties

exactOnly bool
When true, only exactly known ambiguities are reported.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getConflictingAlts(BitSet? reportedAlts, ATNConfigSet configs) → BitSet
Computes the set of conflicting or ambiguous alternatives from a configuration set, if that information was not already provided by the parser.
getDecisionDescription(Parser recognizer, DFA dfa) String
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reportAmbiguity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, bool exact, BitSet? ambigAlts, ATNConfigSet configs) → void
This method is called by the parser when a full-context prediction results in an ambiguity.
override
reportAttemptingFullContext(Parser recognizer, DFA dfa, int startIndex, int stopIndex, BitSet? conflictingAlts, ATNConfigSet configs) → void
This method is called when an SLL conflict occurs and the parser is about to use the full context information to make an LL decision.
override
reportContextSensitivity(Parser recognizer, DFA dfa, int startIndex, int stopIndex, int prediction, ATNConfigSet configs) → void
This method is called by the parser when a full-context prediction has a unique result.
override
syntaxError(Recognizer<ATNSimulator> recognizer, Object? offendingSymbol, int? line, int charPositionInLine, String msg, RecognitionException<IntStream>? e) → void
Upon syntax error, notify any interested parties. This is not how to recover from errors or compute error messages. ANTLRErrorStrategy specifies how to recover from syntax errors and how to compute error messages. This listener's job is simply to emit a computed message, though it has enough information to create its own message in many cases.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited