|
Grammatica 1.3 Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
System.Object
|
+--Analyzer
in Analyzer.csA 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 | |
Analyzer()
Creates a new parse tree analyzer. |
Method Summary | |
Node |
Analyze( Node node )
Analyzes a parse tree node by traversing all it's child nodes. |
virtual void |
Child( Production node, Node child )
Called when adding a child to a parse tree node. |
virtual void |
Enter( Node node )
Called when entering a parse tree node. |
virtual 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 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 string |
GetStringValue( Node node, int pos )
Returns the node string value at the specified position. |
protected object |
GetValue( Node node, int pos )
Returns the node value at the specified position. |
Constructor Detail |
public Analyzer();
Method Detail |
public Node Analyze( Node node );
node
- the parse tree node to processParserLogException
- if the node analysis discovered
errorspublic virtual void Child( Production node, Node child );
node
- the parent node
child
- the child node, or nullParseException
- if the node analysis discovered errorspublic virtual void Enter( Node node );
node
- the node being enteredParseException
- if the node analysis discovered errorspublic virtual Node Exit( Node node );
node
- the node being exitedParseException
- if the node analysis discovered errorsprotected Node GetChildAt( Node node, int pos );
node
- the parent node
pos
- the child positionParseException
- if either the node or the child node
was nullprotected ArrayList GetChildValues( Node node );
node
- the parse tree nodeprotected Node GetChildWithId( Node node, int id );
node
- the parent node
id
- the child node idParseException
- if the node was null, or a child node
couldn't be foundprotected int GetIntValue( Node node, int pos );
node
- the parse tree node
pos
- the child positionParseException
- if either the node was null, or the
value wasn't an integerprotected string GetStringValue( Node node, int pos );
node
- the parse tree node
pos
- the child positionParseException
- if either the node was null, or the
value wasn't a stringprotected object GetValue( Node node, int pos );
node
- the parse tree node
pos
- the child positionParseException
- if either the node or the value was null
|
Grammatica 1.3 Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |