Class DescriptiveErrorStrategy

java.lang.Object
org.antlr.v4.runtime.DefaultErrorStrategy
org.antlr.v4.runtime.BailErrorStrategy
org.apache.groovy.parser.antlr4.internal.DescriptiveErrorStrategy
All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorStrategy

public class DescriptiveErrorStrategy
extends org.antlr.v4.runtime.BailErrorStrategy
Provide friendly error messages when parsing errors occurred.
  • Field Summary

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

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

    Constructors 
    Constructor Description
    DescriptiveErrorStrategy​(org.antlr.v4.runtime.CharStream charStream)  
  • Method Summary

    Modifier and Type Method Description
    protected String createFailedPredicateErrorMessage​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e)  
    protected String createInputMismatchErrorMessage​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e)  
    protected String createNoViableAlternativeErrorMessage​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e)  
    void recover​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.RecognitionException e)  
    org.antlr.v4.runtime.Token recoverInline​(org.antlr.v4.runtime.Parser recognizer)  
    protected void reportFailedPredicate​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e)  
    protected void reportInputMismatch​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e)  
    protected void reportNoViableAlternative​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e)  

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

    sync

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

    beginErrorCondition, constructToken, consumeUntil, endErrorCondition, escapeWSAndQuote, getErrorRecoverySet, getExpectedTokens, getMissingSymbol, getSymbolText, getSymbolType, getTokenErrorDisplay, inErrorRecoveryMode, notifyErrorListeners, reportError, reportMatch, reportMissingToken, reportUnwantedToken, reset, singleTokenDeletion, singleTokenInsertion

    Methods inherited from class java.lang.Object

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

  • Method Details

    • recover

      public void recover​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.RecognitionException e)
      Specified by:
      recover in interface org.antlr.v4.runtime.ANTLRErrorStrategy
      Overrides:
      recover in class org.antlr.v4.runtime.BailErrorStrategy
    • recoverInline

      public org.antlr.v4.runtime.Token recoverInline​(org.antlr.v4.runtime.Parser recognizer) throws org.antlr.v4.runtime.RecognitionException
      Specified by:
      recoverInline in interface org.antlr.v4.runtime.ANTLRErrorStrategy
      Overrides:
      recoverInline in class org.antlr.v4.runtime.BailErrorStrategy
      Throws:
      org.antlr.v4.runtime.RecognitionException
    • createNoViableAlternativeErrorMessage

      protected String createNoViableAlternativeErrorMessage​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.NoViableAltException e)
    • 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
    • createInputMismatchErrorMessage

      protected String createInputMismatchErrorMessage​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.InputMismatchException e)
    • 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
    • createFailedPredicateErrorMessage

      protected String createFailedPredicateErrorMessage​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e)
    • reportFailedPredicate

      protected void reportFailedPredicate​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.FailedPredicateException e)
      Overrides:
      reportFailedPredicate in class org.antlr.v4.runtime.DefaultErrorStrategy