Interface SemanticErrorReporter
- All Known Implementing Classes:
ErrorListener
ErrorListener.
The hundreds of rule/validator classes only ever need to emit semantic errors (and occasionally
check whether fuzzy suggestions are enabled, or fold a source-file name into a message). They have
no business reaching the error store, the mutable error-level/source-line configuration, or the
ANTLR syntaxError callback that the full ErrorListener also carries.
Depending on this interface instead of the concrete listener keeps those validators honest (they
cannot accidentally query or reconfigure the error store - ISP), decouples them from the concrete
implementation (DIP), and lets tests substitute a lightweight collecting sink. ErrorListener
is the production implementation; orchestrators that genuinely need the store/config/ANTLR roles
continue to depend on the concrete class.
-
Method Summary
Modifier and TypeMethodDescriptiongetShortNameOfSourceFile(IToken token) booleanvoidsemanticError(org.antlr.v4.runtime.Token offendingToken, String msg, ErrorListener.SemanticClassification classification) voidsemanticError(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification) voidsemanticError(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification, List<String> declaredParameterNames) A semantic error ABOUT A CALL'S ARGUMENT LIST, carrying the parameter names the called method declares, in order.voidsemanticError(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification, MatchResults results) voidsemanticWarning(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification)
-
Method Details
-
semanticError
void semanticError(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification, MatchResults results) -
semanticError
void semanticError(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification, List<String> declaredParameterNames) A semantic error ABOUT A CALL'S ARGUMENT LIST, carrying the parameter names the called method declares, in order. The rule that raises it is the only thing holding the resolved method at that moment, so it encodes them rather than leaving consumers to re-resolve the call from its text - seeErrorListener.ErrorDetails#getDeclaredParameterNames(). -
semanticError
void semanticError(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification) -
semanticError
void semanticError(org.antlr.v4.runtime.Token offendingToken, String msg, ErrorListener.SemanticClassification classification) -
semanticWarning
void semanticWarning(IToken offendingToken, String msg, ErrorListener.SemanticClassification classification) -
isFuzzySuggestionsEnabled
boolean isFuzzySuggestionsEnabled() -
getShortNameOfSourceFile
-