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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe parser knows how to handle the terminal and non-terminal symbols. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected Symbol[]protected final Parser.ActionHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal SymbolRecursively replaces the symbol at the top of the stack with its production, until the top is a terminal.intdepth()Returns the depth of the stack.Pops and returns the top symbol from the stack.final voidPerforms any implicit actions at the top the stack, expanding any production (other than the root) that may be encountered.final voidPerforms any "trailing" implicit actions at the top the stack.final voidpushProduction(Symbol sym) Pushes the production for the given symbol sym.voidpushSymbol(Symbol sym) Pushes sym on to the stack.voidreset()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_ENDorSymbol.MAP_ENDpushes 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()
-