Class Parser

java.lang.Object
org.apache.avro.io.parsing.Parser
Direct Known Subclasses:
SkipParser

public class Parser extends Object
Parser is the class that maintains the stack for parsing. This class is used by encoders, which are not required to skip.
  • Field Details

  • Constructor Details

  • Method Details

    • advance

      public final Symbol advance(Symbol input) throws IOException
      Recursively replaces the symbol at the top of the stack with its production, until the top is a terminal. Then checks if the top symbol matches the terminal symbol suppled terminal.
      Parameters:
      input - The symbol to match against the terminal at the top of the stack.
      Returns:
      The terminal symbol at the top of the stack unless an implicit action resulted in another symbol, in which case that symbol is returned.
      Throws:
      IOException
    • processImplicitActions

      public final void processImplicitActions() throws IOException
      Performs any implicit actions at the top the stack, expanding any production (other than the root) that may be encountered. This method will fail if there are any repeaters on the stack.
      Throws:
      IOException
    • processTrailingImplicitActions

      public final void processTrailingImplicitActions() throws IOException
      Performs any "trailing" implicit actions at the top the stack.
      Throws:
      IOException
    • pushProduction

      public final void pushProduction(Symbol sym)
      Pushes the production for the given symbol sym. If sym is a repeater and input is either Symbol.ARRAY_END or Symbol.MAP_END pushes nothing.
      Parameters:
      sym -
    • popSymbol

      public Symbol popSymbol()
      Pops and returns the top symbol from the stack.
    • topSymbol

      public Symbol topSymbol()
      Returns the top symbol from the stack.
    • pushSymbol

      public void pushSymbol(Symbol sym)
      Pushes sym on to the stack.
    • depth

      public int depth()
      Returns the depth of the stack.
    • reset

      public void reset()