Class AbstractParser

java.lang.Object
org.antlr.runtime.BaseRecognizer
org.antlr.runtime.Parser
io.protostuff.parser.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 final boolean
     

    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

    Modifier and Type
    Method
    Description
    (package private) static int
     
    void
    displayRecognitionError(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[]
     
    (package private) static byte[]
     
    (package private) static byte[]
     
    (package private) static String
     
    (package private) static String
     
    (package private) static void
    info(String msg)
     
    static void
    load(InputStream in, Proto proto)
     
    (package private) static void
    warn(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 Details

    • SUPPRESS_WARNINGS

      static final boolean SUPPRESS_WARNINGS
  • Constructor Details

    • 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 Details

    • displayRecognitionError

      public void displayRecognitionError(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(InputStream in, Proto proto) throws Exception
      Throws:
      Exception
    • getStringFromStringLiteral

      static String getStringFromStringLiteral(String literal)
    • getString

      static String getString(String value)
    • getBytesFromStringLiteral

      static byte[] getBytesFromStringLiteral(String literal)
    • getBytes

      static byte[] getBytes(String value)
    • getBytesFromHexString

      static byte[] getBytesFromHexString(String value)
    • decimalFromHex

      static int decimalFromHex(char c)
    • info

      static void info(String msg)
    • warn

      static void warn(String msg)