Class AbstractParser

  • Direct Known Subclasses:
    ProtoParser

    public abstract class AbstractParser
    extends org.antlr.runtime.Parser
    Base parser
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static boolean SUPPRESS_WARNINGS  
      • Fields inherited from class org.antlr.runtime.Parser

        input
      • Fields inherited from class org.antlr.runtime.BaseRecognizer

        DEFAULT_TOKEN_CHANNEL, HIDDEN, INITIAL_FOLLOW_STACK_SIZE, MEMO_RULE_FAILED, MEMO_RULE_UNKNOWN, NEXT_TOKEN_RULE_NAME, state
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractParser​(org.antlr.runtime.TokenStream input)  
      protected AbstractParser​(org.antlr.runtime.TokenStream input, org.antlr.runtime.RecognizerSharedState state)
      Create a new parser instance, pre-supplying the input token stream and the shared state.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static int decimalFromHex​(char c)  
      void displayRecognitionError​(java.lang.String[] tokenNames, org.antlr.runtime.RecognitionException e)
      Creates the error/warning message that we need to show users/IDEs when ANTLR has found a parsing error, has recovered from it and is now telling us that a parsing exception occurred.
      (package private) static byte[] getBytes​(java.lang.String value)  
      (package private) static byte[] getBytesFromHexString​(java.lang.String value)  
      (package private) static byte[] getBytesFromStringLiteral​(java.lang.String literal)  
      (package private) static java.lang.String getString​(java.lang.String value)  
      (package private) static java.lang.String getStringFromStringLiteral​(java.lang.String literal)  
      (package private) static void info​(java.lang.String msg)  
      static void load​(java.io.InputStream in, Proto proto)  
      (package private) static void warn​(java.lang.String msg)  
      • Methods inherited from class org.antlr.runtime.Parser

        getCurrentInputSymbol, getMissingSymbol, getSourceName, getTokenStream, reset, setTokenStream, traceIn, traceOut
      • Methods inherited from class org.antlr.runtime.BaseRecognizer

        alreadyParsedRule, beginResync, combineFollows, computeContextSensitiveRuleFOLLOW, computeErrorRecoverySet, consumeUntil, consumeUntil, emitErrorMessage, endResync, failed, getBacktrackingLevel, getErrorHeader, getErrorMessage, getGrammarFileName, getNumberOfSyntaxErrors, getRuleInvocationStack, getRuleInvocationStack, getRuleMemoization, getRuleMemoizationCacheSize, getTokenErrorDisplay, getTokenNames, match, matchAny, memoize, mismatchIsMissingToken, mismatchIsUnwantedToken, pushFollow, recover, recoverFromMismatchedSet, recoverFromMismatchedToken, reportError, setBacktrackingLevel, toStrings, traceIn, traceOut
      • Methods inherited from class java.lang.Object

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

      • SUPPRESS_WARNINGS

        static final boolean SUPPRESS_WARNINGS
    • Constructor Detail

      • AbstractParser

        protected AbstractParser​(org.antlr.runtime.TokenStream input)
      • AbstractParser

        protected AbstractParser​(org.antlr.runtime.TokenStream input,
                                 org.antlr.runtime.RecognizerSharedState state)
        Create a new parser instance, pre-supplying the input token stream and the shared state.

        This is only used when a grammar is imported into another grammar, but we must supply this constructor to satisfy the super class contract.

        Parameters:
        input - The stream of tokesn that will be pulled from the lexer
        state - The shared state object created by an interconnectd grammar
    • Method Detail

      • displayRecognitionError

        public void displayRecognitionError​(java.lang.String[] tokenNames,
                                            org.antlr.runtime.RecognitionException e)
        Creates the error/warning message that we need to show users/IDEs when ANTLR has found a parsing error, has recovered from it and is now telling us that a parsing exception occurred.
        Overrides:
        displayRecognitionError in class org.antlr.runtime.BaseRecognizer
        Parameters:
        tokenNames - token names as known by ANTLR (which we ignore)
        e - The exception that was thrown
      • load

        public static void load​(java.io.InputStream in,
                                Proto proto)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getStringFromStringLiteral

        static java.lang.String getStringFromStringLiteral​(java.lang.String literal)
      • getString

        static java.lang.String getString​(java.lang.String value)
      • getBytesFromStringLiteral

        static byte[] getBytesFromStringLiteral​(java.lang.String literal)
      • getBytes

        static byte[] getBytes​(java.lang.String value)
      • getBytesFromHexString

        static byte[] getBytesFromHexString​(java.lang.String value)
      • decimalFromHex

        static int decimalFromHex​(char c)
      • info

        static void info​(java.lang.String msg)
      • warn

        static void warn​(java.lang.String msg)