public class Parser extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Parser.ActionHandler
The parser knows how to handle the terminal and non-terminal
symbols.
|
Modifier and Type | Field and Description |
---|---|
protected int |
pos |
protected Symbol[] |
stack |
protected Parser.ActionHandler |
symbolHandler |
Constructor and Description |
---|
Parser(Symbol root,
Parser.ActionHandler symbolHandler) |
Modifier and Type | Method and Description |
---|---|
Symbol |
advance(Symbol input)
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.
|
Symbol |
popSymbol()
Pops and returns the top symbol from the stack.
|
void |
processImplicitActions()
Performs any implicit actions at the top the stack, expanding any
production (other than the root) that may be encountered.
|
void |
processTrailingImplicitActions()
Performs any "trailing" implicit actions at the top the stack.
|
void |
pushProduction(Symbol sym)
Pushes the production for the given symbol sym.
|
void |
pushSymbol(Symbol sym)
Pushes sym on to the stack.
|
void |
reset() |
Symbol |
topSymbol()
Returns the top symbol from the stack.
|
protected final Parser.ActionHandler symbolHandler
protected Symbol[] stack
protected int pos
public Parser(Symbol root, Parser.ActionHandler symbolHandler) throws IOException
IOException
public final Symbol advance(Symbol input) throws IOException
input
- The symbol to match against the terminal at the
top of the stack.IOException
public final void processImplicitActions() throws IOException
IOException
public final void processTrailingImplicitActions() throws IOException
IOException
public final void pushProduction(Symbol sym)
Symbol.ARRAY_END
or Symbol.MAP_END
pushes nothing.sym
- public Symbol popSymbol()
public Symbol topSymbol()
public void pushSymbol(Symbol sym)
public int depth()
public void reset()
Copyright © 2009–2016 The Apache Software Foundation. All rights reserved.