Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.3 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD

PerCederberg.Grammatica.Parser
Class Node

System.Object
   |
   +--Node

   in Node.cs
Direct Known Subclasses:
Production, Token

class Node
extends System.Object

An abstract parse tree node. This class is inherited by all nodes in the parse tree, i.e. by the token and production classes.


Method Summary
 void AddValue( object value )
          Adds a computed value to this node.
 void AddValues( ArrayList values )
          Adds a set of computed values to this node.
 ArrayList GetAllValues()
          Returns the list with all the computed values for this node.
 virtual Node GetChildAt( int index )
          Returns the child node with the specified index.
 virtual int GetChildCount()
          Returns the number of child nodes.
 int GetDescendantCount()
          Returns the number of descendant nodes.
 virtual int GetEndColumn()
          The column number of the last character in this node.
 virtual int GetEndLine()
          The line number of the last character in this node.
 abstract int GetId()
          Returns the node type id.
 abstract string GetName()
          Returns the node name.
 Node GetParent()
          Returns the parent node.
 virtual int GetStartColumn()
          The column number of the first character in this node.
 virtual int GetStartLine()
          The line number of the first character in this node.
 object GetValue( int pos )
          Returns a computed value of this node, if previously set.
 int GetValueCount()
          Returns the number of computed values associated with this node.
 internal virtual bool IsHidden()
          Checks if this node is hidden, i.
 void PrintTo( TextWriter output )
          Prints this node and all subnodes to the specified output stream.
 void RemoveAllValues()
          Removes all computed values stored in this node.
 internal void SetParent( Node parent )
          Sets the parent node.
 

Method Detail

AddValue

public void AddValue( object value );
Adds a computed value to this node. The computed value may be used for storing intermediate results in the parse tree during analysis.
Parameters:
value - the node value

AddValues

public void AddValues( ArrayList values );
Adds a set of computed values to this node.
Parameters:
values - the vector with node values

GetAllValues

public ArrayList GetAllValues();
Returns the list with all the computed values for this node. Note that the list is not a copy, so changes will affect the values in this node (as it is the same object).
Returns:
a list with all values, or null if no values have been set

GetChildAt

public virtual Node GetChildAt( int index );
Returns the child node with the specified index.
Parameters:
index - the child index, 0 <= index < count
Returns:
the child node found, or null if index out of bounds

GetChildCount

public virtual int GetChildCount();
Returns the number of child nodes.
Returns:
the number of child nodes

GetDescendantCount

public int GetDescendantCount();
Returns the number of descendant nodes.
Returns:
the number of descendant nodes
Since:
1.2

GetEndColumn

public virtual int GetEndColumn();
The column number of the last character in this node. If the node has child elements, this value will be fetched from the last child.
Returns:
the column number of the last token character, or -1 if not applicable

GetEndLine

public virtual int GetEndLine();
The line number of the last character in this node. If the node has child elements, this value will be fetched from the last child.
Returns:
the line number of the last token character, or -1 if not applicable

GetId

public abstract int GetId();
Returns the node type id. This value is set as a unique identifier for each type of node, in order to simplify later identification.
Returns:
the node type id

GetName

public abstract string GetName();
Returns the node name.
Returns:
the node name

GetParent

public Node GetParent();
Returns the parent node.
Returns:
the parent parse tree node

GetStartColumn

public virtual int GetStartColumn();
The column number of the first character in this node. If the node has child elements, this value will be fetched from the first child.
Returns:
the column number of the first token character, or -1 if not applicable

GetStartLine

public virtual int GetStartLine();
The line number of the first character in this node. If the node has child elements, this value will be fetched from the first child.
Returns:
the line number of the first character, or -1 if not applicable

GetValue

public object GetValue( int pos );
Returns a computed value of this node, if previously set. A value may be used for storing intermediate results in the parse tree during analysis.
Parameters:
pos - the value position, 0 <= pos < count
Returns:
the computed node value, or null if not set

GetValueCount

public int GetValueCount();
Returns the number of computed values associated with this node. Any number of values can be associated with a node through calls to AddValue().
Returns:
the number of values associated with this node

IsHidden

 internal virtual bool IsHidden();
Checks if this node is hidden, i.e. if it should not be visible outside the parser.
Returns:
true if the node should be hidden, or false otherwise

PrintTo

public void PrintTo( TextWriter output );
Prints this node and all subnodes to the specified output stream.
Parameters:
output - the output stream to use

RemoveAllValues

public void RemoveAllValues();
Removes all computed values stored in this node.

SetParent

 internal void SetParent( Node parent );
Sets the parent node.
Parameters:
parent - the new parent node

 Overview   Project   Class   Tree   Deprecated   Index 
Grammatica 1.3 Documentation
FRAMES    NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD