Package org.apache.avro.io.parsing
Class Parser
java.lang.Object
org.apache.avro.io.parsing.Parser
- Direct Known Subclasses:
SkipParser
Parser is the class that maintains the stack for parsing. This class is used
by encoders, which are not required to skip.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
The parser knows how to handle the terminal and non-terminal symbols. -
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected Symbol[]
protected final Parser.ActionHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal Symbol
Recursively replaces the symbol at the top of the stack with its production, until the top is a terminal.int
depth()
Returns the depth of the stack.Pops and returns the top symbol from the stack.final void
Performs any implicit actions at the top the stack, expanding any production (other than the root) that may be encountered.final void
Performs any "trailing" implicit actions at the top the stack.final void
pushProduction
(Symbol sym) Pushes the production for the given symbol sym.void
pushSymbol
(Symbol sym) Pushes sym on to the stack.void
reset()
Returns the top symbol from the stack.
-
Field Details
-
symbolHandler
-
stack
-
pos
protected int pos
-
-
Constructor Details
-
Parser
-
-
Method Details
-
advance
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
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
Performs any "trailing" implicit actions at the top the stack.- Throws:
IOException
-
pushProduction
Pushes the production for the given symbol sym. If sym is a repeater and input is eitherSymbol.ARRAY_END
orSymbol.MAP_END
pushes nothing.- Parameters:
sym
-
-
popSymbol
Pops and returns the top symbol from the stack. -
topSymbol
Returns the top symbol from the stack. -
pushSymbol
Pushes sym on to the stack. -
depth
public int depth()Returns the depth of the stack. -
reset
public void reset()
-