Package de.monticore.antlr4
Class MCErrorListener
java.lang.Object
org.antlr.v4.runtime.BaseErrorListener
de.monticore.antlr4.MCErrorListener
- All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorListener
public class MCErrorListener
extends org.antlr.v4.runtime.BaseErrorListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThis character (NO-BREAK SPACE) separates the error message from the context where the error occurred.protected MCParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancontainsRule(org.antlr.v4.runtime.misc.IntervalSet set, org.antlr.v4.runtime.Vocabulary vocabulary, String needle) extractNoKeywordTokens(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Set<Map.Entry<Integer, String>> epsilonRules) booleangetExpectedRulesWithTokens(org.antlr.v4.runtime.atn.ATN atn, int stateNumber, org.antlr.v4.runtime.Vocabulary vocabulary, Map<Integer, Boolean> visitedStates, Set<Map.Entry<Integer, String>> expected) Similiar toATN.getExpectedTokens(int, RuleContext), but we also return the rule numbersgetLineContext(org.antlr.v4.runtime.CharStream stream, int startIndex, int charPositionInLine) protected StringgetOffendingLine(String entireInput, int tokenIndex) voidsyntaxError(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException e) Methods inherited from class org.antlr.v4.runtime.BaseErrorListener
reportAmbiguity, reportAttemptingFullContext, reportContextSensitivity
-
Field Details
-
parser
-
CONTEXT_SEPARATOR
public static final char CONTEXT_SEPARATORThis character (NO-BREAK SPACE) separates the error message from the context where the error occurred.- See Also:
-
-
Constructor Details
-
MCErrorListener
-
-
Method Details
-
syntaxError
public void syntaxError(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException e) - Specified by:
syntaxErrorin interfaceorg.antlr.v4.runtime.ANTLRErrorListener- Overrides:
syntaxErrorin classorg.antlr.v4.runtime.BaseErrorListener
-
extractNoKeywordTokens
-
containsRule
protected boolean containsRule(org.antlr.v4.runtime.misc.IntervalSet set, org.antlr.v4.runtime.Vocabulary vocabulary, String needle) - Parameters:
set- an IntervalSet of tokensvocabulary- the token vocabularyneedle- the rule display name to search for- Returns:
- Whether the interval set contains a rule with the display name of needle
-
getLineContext
public String getLineContext(org.antlr.v4.runtime.CharStream stream, int startIndex, int charPositionInLine) -
getOffendingLine
- Parameters:
entireInput- the entire input texttokenIndex- the index of a token to find return its line- Returns:
- the line
-
getExpectedRulesWithTokens
public boolean getExpectedRulesWithTokens(org.antlr.v4.runtime.atn.ATN atn, int stateNumber, org.antlr.v4.runtime.Vocabulary vocabulary, Map<Integer, Boolean> visitedStates, Set<Map.Entry<Integer, String>> expected) Similiar toATN.getExpectedTokens(int, RuleContext), but we also return the rule numbers- Parameters:
atn- the atnstateNumber- the current statevocabulary-VocabularyvisitedStates- the already visited statesexpected- a set of ruleIndex -to- expected token(s) entries- Returns:
- whether an empty input is accepted
-