|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.percederberg.grammatica.parser.Analyzer
A parse tree analyzer. This class provides callback methods that may be used either during parsing, or for a parse tree traversal. This class should be subclassed to provide adequate handling of the parse tree nodes. The general contract for the analyzer class does not guarantee a strict call order for the callback methods. Depending on the type of parser, the enter() and exit() methods for production nodes can be called either in a top-down or a bottom-up fashion. The only guarantee provided by this API, is that the calls for any given node will always be in the order enter(), child(), and exit(). If various child() calls are made, they will be made from left to right as child nodes are added (to the right).
Constructor Summary | |
protected |
Analyzer()
Creates a new parse tree analyzer. |
Method Summary | |
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 |
process(Node node)
Processes a parse tree node and creates a new node that is the result of processing all children recursively. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Analyzer()
Method Detail |
protected Node process(Node node) throws ParseException
node
- the parse tree node to process
ParseException
- if the node analysis discovered errorsprotected void enter(Node node) throws ParseException
node
- the node being entered
ParseException
- if the node analysis discovered errorsprotected Node exit(Node node) throws ParseException
node
- the node being exited
ParseException
- if the node analysis discovered errorsprotected void child(Production node, Node child) throws ParseException
node
- the parent nodechild
- the child node, or null
ParseException
- if the node analysis discovered errors
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |