Class Ek9ErrorStrategy

java.lang.Object
org.antlr.v4.runtime.DefaultErrorStrategy
org.ek9lang.compiler.tokenizer.Ek9ErrorStrategy
All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorStrategy

public class Ek9ErrorStrategy extends org.antlr.v4.runtime.DefaultErrorStrategy
Custom error strategy for EK9 that produces human-readable error messages. Instead of cryptic ANTLR messages like "mismatched input '<INDENT, length=8, level=4>'", this produces messages like "unexpected indentation".
  • Field Summary

    Fields inherited from class org.antlr.v4.runtime.DefaultErrorStrategy

    errorRecoveryMode, lastErrorIndex, lastErrorStates, nextTokensContext, nextTokensState
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    getTokenErrorDisplay(org.antlr.v4.runtime.Token token)
     
    protected void
    reportInputMismatch(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e)
     
    protected void
    reportMissingToken(org.antlr.v4.runtime.Parser recognizer)
     
    protected void
    reportNoViableAlternative(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e)
     
    protected void
    reportUnwantedToken(org.antlr.v4.runtime.Parser recognizer)
     

    Methods inherited from class org.antlr.v4.runtime.DefaultErrorStrategy

    beginErrorCondition, consumeUntil, endErrorCondition, escapeWSAndQuote, getErrorRecoverySet, getExpectedTokens, getMissingSymbol, getSymbolText, getSymbolType, inErrorRecoveryMode, recover, recoverInline, reportError, reportFailedPredicate, reportMatch, reset, singleTokenDeletion, singleTokenInsertion, sync

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Ek9ErrorStrategy

      public Ek9ErrorStrategy()
  • Method Details

    • getTokenErrorDisplay

      protected String getTokenErrorDisplay(org.antlr.v4.runtime.Token token)
      Overrides:
      getTokenErrorDisplay in class org.antlr.v4.runtime.DefaultErrorStrategy
    • reportInputMismatch

      protected void reportInputMismatch(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e)
      Overrides:
      reportInputMismatch in class org.antlr.v4.runtime.DefaultErrorStrategy
    • reportNoViableAlternative

      protected void reportNoViableAlternative(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e)
      Overrides:
      reportNoViableAlternative in class org.antlr.v4.runtime.DefaultErrorStrategy
    • reportUnwantedToken

      protected void reportUnwantedToken(org.antlr.v4.runtime.Parser recognizer)
      Overrides:
      reportUnwantedToken in class org.antlr.v4.runtime.DefaultErrorStrategy
    • reportMissingToken

      protected void reportMissingToken(org.antlr.v4.runtime.Parser recognizer)
      Overrides:
      reportMissingToken in class org.antlr.v4.runtime.DefaultErrorStrategy