DiagnosticErrorListener

This implementation of {@link 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.

<ul> <li><b>Ambiguities</b>: These are cases where more than one path through the grammar can match the input.</li> <li><b>Weak context sensitivity</b>: These are cases where full-context prediction resolved an SLL conflict to a unique alternative which equaled the minimum alternative of the SLL conflict.</li> <li><b>Strong (forced) context sensitivity</b>: These are cases where the full-context prediction resolved an SLL conflict to a unique alternative, <em>and</em> 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.</li> </ul>

@author Sam Harwell

Constructors

this
this()

Initializes a new instance of {@link DiagnosticErrorListener} which only reports exact ambiguities.

this
this(bool exactOnly)

Initializes a new instance of {@link DiagnosticErrorListener}, specifying whether all ambiguities or only exact ambiguities are reported.

Members

Functions

getConflictingAlts
BitSet getConflictingAlts(BitSet reportedAlts, ATNConfigSet configs)

Computes the set of conflicting or ambiguous alternatives from a configuration set, if that information was not already provided by the parser.

getDecisionDescription
string getDecisionDescription(InterfaceParser recognizer, DFA dfa)
Undocumented in source. Be warned that the author may not have intended to support it.
reportAmbiguity
void reportAmbiguity(InterfaceParser recognizer, DFA dfa, size_t startIndex, size_t stopIndex, bool exact, BitSet ambigAlts, ATNConfigSet configs)

@uml @override

reportAttemptingFullContext
void reportAttemptingFullContext(InterfaceParser recognizer, DFA dfa, size_t startIndex, size_t stopIndex, BitSet conflictingAlts, ATNConfigSet configs)

@uml @override

reportContextSensitivity
void reportContextSensitivity(InterfaceParser recognizer, DFA dfa, size_t startIndex, size_t stopIndex, int prediction, ATNConfigSet configs)

@uml @override

Variables

exactOnly
bool exactOnly;

When {@code true}, only exactly known ambiguities are reported.

Meta