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 Details

    • parser

      protected MCParser parser
    • CONTEXT_SEPARATOR

      public static final char CONTEXT_SEPARATOR
      This character (NO-BREAK SPACE) separates the error message from the context where the error occurred.
      See Also:
  • Constructor Details

    • MCErrorListener

      public MCErrorListener(MCParser parser)
  • 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:
      syntaxError in interface org.antlr.v4.runtime.ANTLRErrorListener
      Overrides:
      syntaxError in class org.antlr.v4.runtime.BaseErrorListener
    • extractNoKeywordTokens

      protected static List<String> extractNoKeywordTokens(org.antlr.v4.runtime.Recognizer<?,?> recognizer, Set<Map.Entry<Integer,String>> epsilonRules)
    • containsRule

      protected boolean containsRule(org.antlr.v4.runtime.misc.IntervalSet set, org.antlr.v4.runtime.Vocabulary vocabulary, String needle)
      Parameters:
      set - an IntervalSet of tokens
      vocabulary - the token vocabulary
      needle - 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

      protected String getOffendingLine(String entireInput, int tokenIndex)
      Parameters:
      entireInput - the entire input text
      tokenIndex - 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 to ATN.getExpectedTokens(int, RuleContext), but we also return the rule numbers
      Parameters:
      atn - the atn
      stateNumber - the current state
      vocabulary - Vocabulary
      visitedStates - the already visited states
      expected - a set of ruleIndex -to- expected token(s) entries
      Returns:
      whether an empty input is accepted