public class Analyzer
extends java.lang.Object
| Constructor and Description |
|---|
Analyzer() |
| Modifier and Type | Method and Description |
|---|---|
Node |
analyze(Node node)
Analyzes a parse tree node by traversing all it's child nodes.
|
protected void |
child(Production node,
Node child)
Called when adding a child to a parse tree node.
|
protected void |
enter(Node node)
Called when entering a parse tree node.
|
protected Node |
exit(Node node)
Called when exiting a parse tree node.
|
protected Node |
getChildAt(Node node,
int pos)
Returns a child at the specified position.
|
protected java.util.ArrayList |
getChildValues(Node node)
Returns all the node values for all child nodes.
|
protected Node |
getChildWithId(Node node,
int id)
Returns the first child with the specified id.
|
protected int |
getIntValue(Node node,
int pos)
Returns the node integer value at the specified position.
|
protected java.lang.String |
getStringValue(Node node,
int pos)
Returns the node string value at the specified position.
|
protected java.lang.Object |
getValue(Node node,
int pos)
Returns the node value at the specified position.
|
protected Production |
newProduction(ProductionPattern pattern)
Factory method to create a new production node.
|
void |
reset()
Resets this analyzer when the parser is reset for another
input stream.
|
public void reset()
public Node analyze(Node node) throws ParserLogException
node - the parse tree node to processParserLogException - if the node analysis discovered
errorsprotected Production newProduction(ProductionPattern pattern)
pattern - the production patternprotected void enter(Node node) throws ParseException
node - the node being enteredParseException - if the node analysis discovered errorsprotected Node exit(Node node) throws ParseException
node - the node being exitedParseException - if the node analysis discovered errorsprotected void child(Production node, Node child) throws ParseException
node - the parent nodechild - the child node, or nullParseException - if the node analysis discovered errorsprotected Node getChildAt(Node node, int pos) throws ParseException
node - the parent nodepos - the child positionParseException - if either the node or the child node
was nullprotected Node getChildWithId(Node node, int id) throws ParseException
node - the parent nodeid - the child node idParseException - if the node was null, or a child node
couldn't be foundprotected java.lang.Object getValue(Node node, int pos) throws ParseException
node - the parse tree nodepos - the child positionParseException - if either the node or the value was nullprotected int getIntValue(Node node, int pos) throws ParseException
node - the parse tree nodepos - the child positionParseException - if either the node was null, or the
value wasn't an integerprotected java.lang.String getStringValue(Node node, int pos) throws ParseException
node - the parse tree nodepos - the child positionParseException - if either the node was null, or the
value wasn't a stringprotected java.util.ArrayList getChildValues(Node node)
node - the parse tree node