Grammatica
Public Member Functions | Properties | List of all members
PerCederberg.Grammatica.Runtime.Node Class Reference

An abstract parse tree node. More...

Inheritance diagram for PerCederberg.Grammatica.Runtime.Node:
PerCederberg.Grammatica.Runtime.Production PerCederberg.Grammatica.Runtime.Token

Public Member Functions

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

Properties

abstract int Id [get]
 The node type id property (read-only). More...
 
abstract string Name [get]
 The node name property (read-only). More...
 
virtual int StartLine [get]
 The line number property of the first character in this node (read-only). More...
 
virtual int StartColumn [get]
 The column number property of the first character in this node (read-only). More...
 
virtual int EndLine [get]
 The line number property of the last character in this node (read-only). More...
 
virtual int EndColumn [get]
 The column number property of the last character in this node (read-only). More...
 
Node Parent [get]
 The parent node property (read-only). More...
 
virtual int Count [get]
 The child node count property (read-only). More...
 
virtual Node this[int index] [get]
 The child node index (read-only). More...
 
ArrayList Values [get, set]
 The node values property. More...
 

Detailed Description

An abstract parse tree node.

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

Author
Per Cederberg
Version
1.5

Member Function Documentation

void PerCederberg.Grammatica.Runtime.Node.AddValue ( object  value)
inline

Adds a computed value to this node.

The computed value may be used for storing intermediate results in the parse tree during analysis.

Parameters
valuethe node value
See also
Values
Deprecated:
Use the Values property and the Values.Add method instead.
void PerCederberg.Grammatica.Runtime.Node.AddValues ( ArrayList  values)
inline

Adds a set of computed values to this node.

Parameters
valuesthe vector with node values
See also
Values
Deprecated:
Use the Values property and the Values.AddRange method instead.
ArrayList PerCederberg.Grammatica.Runtime.Node.GetAllValues ( )
inline

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
See also
Values
Deprecated:
Use the Values property instead. Note that the Values property will never be null, but possibly empty.
virtual Node PerCederberg.Grammatica.Runtime.Node.GetChildAt ( int  index)
inlinevirtual

Returns the child node with the specified index.

Parameters
indexthe child index, 0 <= index < count
Returns
the child node found, or null if index out of bounds
Deprecated:
Use the class indexer instead.
virtual int PerCederberg.Grammatica.Runtime.Node.GetChildCount ( )
inlinevirtual

Returns the number of child nodes.

Returns
the number of child nodes
Deprecated:
Use the Count property instead.
int PerCederberg.Grammatica.Runtime.Node.GetDescendantCount ( )
inline

Returns the number of descendant nodes.

Returns
the number of descendant nodes
Since
1.2
virtual int PerCederberg.Grammatica.Runtime.Node.GetEndColumn ( )
inlinevirtual

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
See also
EndColumn
Deprecated:
Use the EndColumn property instead.
virtual int PerCederberg.Grammatica.Runtime.Node.GetEndLine ( )
inlinevirtual

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
See also
EndLine
Deprecated:
Use the EndLine property instead.
virtual int PerCederberg.Grammatica.Runtime.Node.GetId ( )
inlinevirtual

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
See also
Id
Deprecated:
Use the Id property instead.
virtual string PerCederberg.Grammatica.Runtime.Node.GetName ( )
inlinevirtual

Returns the node name.

Returns
the node name
See also
Name
Deprecated:
Use the Name property instead.
Node PerCederberg.Grammatica.Runtime.Node.GetParent ( )
inline

Returns the parent node.

Returns
the parent parse tree node
See also
Parent
Deprecated:
Use the Parent property instead.
virtual int PerCederberg.Grammatica.Runtime.Node.GetStartColumn ( )
inlinevirtual

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
See also
StartColumn
Deprecated:
Use the StartColumn property instead.
virtual int PerCederberg.Grammatica.Runtime.Node.GetStartLine ( )
inlinevirtual

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
See also
StartLine
Deprecated:
Use the StartLine property instead.
object PerCederberg.Grammatica.Runtime.Node.GetValue ( int  pos)
inline

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
posthe value position, 0 <= pos < count
Returns
the computed node value, or null if not set
See also
Values
Deprecated:
Use the Values property and it's array indexer instead.
int PerCederberg.Grammatica.Runtime.Node.GetValueCount ( )
inline

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
See also
Values
Deprecated:
Use the Values and Values.Count properties instead.
void PerCederberg.Grammatica.Runtime.Node.PrintTo ( TextWriter  output)
inline

Prints this node and all subnodes to the specified output stream.

Parameters
outputthe output stream to use
void PerCederberg.Grammatica.Runtime.Node.RemoveAllValues ( )
inline

Removes all computed values stored in this node.

See also
Values
Deprecated:
Use the Values property and the Values.Clear method instead. Alternatively the Values property can be set to null.

Property Documentation

virtual int PerCederberg.Grammatica.Runtime.Node.Count
get

The child node count property (read-only).

Since
1.5
virtual int PerCederberg.Grammatica.Runtime.Node.EndColumn
get

The column number property of the last character in this node (read-only).

If the node has child elements, this value will be fetched from the last child.

Since
1.5
virtual int PerCederberg.Grammatica.Runtime.Node.EndLine
get

The line number property of the last character in this node (read-only).

If the node has child elements, this value will be fetched from the last child.

Since
1.5
abstract int PerCederberg.Grammatica.Runtime.Node.Id
get

The node type id property (read-only).

This value is set as a unique identifier for each type of node, in order to simplify later identification.

Since
1.5
abstract string PerCederberg.Grammatica.Runtime.Node.Name
get

The node name property (read-only).

Since
1.5
Node PerCederberg.Grammatica.Runtime.Node.Parent
get

The parent node property (read-only).

Since
1.5
virtual int PerCederberg.Grammatica.Runtime.Node.StartColumn
get

The column number property of the first character in this node (read-only).

If the node has child elements, this value will be fetched from the first child.

Since
1.5
virtual int PerCederberg.Grammatica.Runtime.Node.StartLine
get

The line number property of the first character in this node (read-only).

If the node has child elements, this value will be fetched from the first child.

Since
1.5
virtual Node PerCederberg.Grammatica.Runtime.Node.this[int index]
get

The child node index (read-only).

Parameters
indexthe child index, 0 <= index < Count
Returns
the child node found, or null if index out of bounds
Since
1.5
ArrayList PerCederberg.Grammatica.Runtime.Node.Values
getset

The node values property.

This property provides direct access to the list of computed values associated with this node during analysis. Note that setting this property to null will remove all node values. Any operation on the value array list is allowed and is immediately reflected through the various value reading and manipulation methods.

Since
1.5

The documentation for this class was generated from the following file: