Class JavascriptParserErrorStrategy

  • All Implemented Interfaces:
    org.antlr.v4.runtime.ANTLRErrorStrategy

    class JavascriptParserErrorStrategy
    extends org.antlr.v4.runtime.DefaultErrorStrategy
    Allows for proper error handling in the ANTLR 4 parser
    • Field Summary

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

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void recover​(org.antlr.v4.runtime.Parser recognizer, org.antlr.v4.runtime.RecognitionException re)
      Ensures the ANTLR parser will throw an exception after the first error
      org.antlr.v4.runtime.Token recoverInline​(org.antlr.v4.runtime.Parser recognizer)
      Ensures the ANTLR parser will throw an exception after the first error
      void sync​(org.antlr.v4.runtime.Parser recognizer)
      Do not allow syncing after errors to ensure the ANTLR parser will throw an exception
      • Methods inherited from class org.antlr.v4.runtime.DefaultErrorStrategy

        beginErrorCondition, consumeUntil, endErrorCondition, escapeWSAndQuote, getErrorRecoverySet, getExpectedTokens, getMissingSymbol, getSymbolText, getSymbolType, getTokenErrorDisplay, inErrorRecoveryMode, reportError, reportFailedPredicate, reportInputMismatch, reportMatch, reportMissingToken, reportNoViableAlternative, reportUnwantedToken, reset, singleTokenDeletion, singleTokenInsertion
      • Methods inherited from class java.lang.Object

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

      • JavascriptParserErrorStrategy

        JavascriptParserErrorStrategy()
    • Method Detail

      • recover

        public void recover​(org.antlr.v4.runtime.Parser recognizer,
                            org.antlr.v4.runtime.RecognitionException re)
        Ensures the ANTLR parser will throw an exception after the first error
        Specified by:
        recover in interface org.antlr.v4.runtime.ANTLRErrorStrategy
        Overrides:
        recover in class org.antlr.v4.runtime.DefaultErrorStrategy
        Parameters:
        recognizer - the parser being used
        re - the original exception from the parser
      • recoverInline

        public org.antlr.v4.runtime.Token recoverInline​(org.antlr.v4.runtime.Parser recognizer)
                                                 throws org.antlr.v4.runtime.RecognitionException
        Ensures the ANTLR parser will throw an exception after the first error
        Specified by:
        recoverInline in interface org.antlr.v4.runtime.ANTLRErrorStrategy
        Overrides:
        recoverInline in class org.antlr.v4.runtime.DefaultErrorStrategy
        Parameters:
        recognizer - the parser being used
        Returns:
        no actual return value
        Throws:
        org.antlr.v4.runtime.RecognitionException - not used as a ParseException wrapped in a RuntimeException is thrown instead
      • sync

        public void sync​(org.antlr.v4.runtime.Parser recognizer)
        Do not allow syncing after errors to ensure the ANTLR parser will throw an exception
        Specified by:
        sync in interface org.antlr.v4.runtime.ANTLRErrorStrategy
        Overrides:
        sync in class org.antlr.v4.runtime.DefaultErrorStrategy
        Parameters:
        recognizer - the parser being used