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
Author:
David Yu
  • Field Summary

    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
    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.
    static void
    load(InputStream in, Proto proto)
     

    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 Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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