Antlr.Runtime.Tree.BaseTree Class Reference

A generic tree implementation with no payload. You must subclass to actually have any user data. ANTLR v3 uses a list of children approach instead of the child-sibling approach in v2. A flat tree (a list) is an empty node whose children represent the list. An empty, but non-null node is called "nil". More...

Inheritance diagram for Antlr.Runtime.Tree.BaseTree:

Inheritance graph
[legend]
Collaboration diagram for Antlr.Runtime.Tree.BaseTree:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 BaseTree ()
 BaseTree (ITree node)
 Create a new node from an existing node does nothing for BaseTree as there are no fields other than the children list, which cannot be copied as the children are not considered part of this node.
virtual ITree GetChild (int i)
virtual void AddChild (ITree t)
 Add t as child of this node.
void AddChildren (IList kids)
 Add all elements of kids list as children of this node.
virtual void SetChild (int i, ITree t)
 Set ith child (0..n-1) to t; t must be non-null and non-nil node.
virtual object DeleteChild (int i)
virtual void ReplaceChildren (int startChildIndex, int stopChildIndex, object t)
 Delete children from start to stop and replace with t even if t is a list (nil-root tree).
virtual void FreshenParentAndChildIndexes ()
 Set the parent and child index values for all child of t.
virtual void FreshenParentAndChildIndexes (int offset)
virtual void SanityCheckParentAndChildIndexes ()
virtual void SanityCheckParentAndChildIndexes (ITree parent, int i)
virtual string ToStringTree ()
 Print out a whole tree not just a node.
abstract override string ToString ()
 Force base classes override and say how a node (not a tree) should look as text.
abstract ITree DupNode ()

Protected Member Functions

virtual internal IList CreateChildrenList ()
 Override in a subclass to change the impl of children list.

Protected Attributes

IList children

Properties

virtual int ChildCount [get]
virtual bool IsNil [get]
 Indicates the node is a nil node but may still have children, meaning the tree is a flat list.
virtual int Line [get]
 In case we don't have a token payload, what is the line for errors?
virtual int CharPositionInLine [get]
IList Children [get]
 Get the children internal list of children. Manipulating the list directly is not a supported operation (i.e. you do so at your own risk).
virtual int ChildIndex [get, set]
 BaseTree doesn't track child indexes.
virtual ITree Parent [get, set]
 BaseTree doesn't track parent pointers.
abstract int Type [get]
 Return a token type; needed for tree parsing.
abstract int TokenStartIndex [get, set]
 What is the smallest token index (indexing from 0) for this node and its children?
abstract int TokenStopIndex [get, set]
 What is the largest token index (indexing from 0) for this node and its children?
abstract string Text [get]


Detailed Description

A generic tree implementation with no payload. You must subclass to actually have any user data. ANTLR v3 uses a list of children approach instead of the child-sibling approach in v2. A flat tree (a list) is an empty node whose children represent the list. An empty, but non-null node is called "nil".

Definition at line 49 of file BaseTree.cs.


Constructor & Destructor Documentation

Antlr.Runtime.Tree.BaseTree.BaseTree (  ) 

Definition at line 51 of file BaseTree.cs.

Antlr.Runtime.Tree.BaseTree.BaseTree ( ITree  node  ) 

Create a new node from an existing node does nothing for BaseTree as there are no fields other than the children list, which cannot be copied as the children are not considered part of this node.

Definition at line 59 of file BaseTree.cs.


Member Function Documentation

virtual ITree Antlr.Runtime.Tree.BaseTree.GetChild ( int  i  )  [virtual]

Implements Antlr.Runtime.Tree.ITree.

Definition at line 92 of file BaseTree.cs.

virtual void Antlr.Runtime.Tree.BaseTree.AddChild ( ITree  t  )  [virtual]

Add t as child of this node.

Warning: if t has no children, but child does and child isNil then this routine moves children to t via t.children = child.children; i.e., without copying the array.

Parameters:
t 

Implements Antlr.Runtime.Tree.ITree.

Definition at line 119 of file BaseTree.cs.

void Antlr.Runtime.Tree.BaseTree.AddChildren ( IList  kids  ) 

Add all elements of kids list as children of this node.

Parameters:
kids 

Definition at line 174 of file BaseTree.cs.

virtual void Antlr.Runtime.Tree.BaseTree.SetChild ( int  i,
ITree  t 
) [virtual]

Set ith child (0..n-1) to t; t must be non-null and non-nil node.

Implements Antlr.Runtime.Tree.ITree.

Definition at line 183 of file BaseTree.cs.

virtual object Antlr.Runtime.Tree.BaseTree.DeleteChild ( int  i  )  [virtual]

Implements Antlr.Runtime.Tree.ITree.

Definition at line 202 of file BaseTree.cs.

virtual void Antlr.Runtime.Tree.BaseTree.ReplaceChildren ( int  startChildIndex,
int  stopChildIndex,
object  t 
) [virtual]

Delete children from start to stop and replace with t even if t is a list (nil-root tree).

Number of children can increase or decrease. For huge child lists, inserting children can force walking rest of children to set their childindex; could be slow.

Implements Antlr.Runtime.Tree.ITree.

Definition at line 224 of file BaseTree.cs.

virtual internal IList Antlr.Runtime.Tree.BaseTree.CreateChildrenList (  )  [protected, virtual]

Override in a subclass to change the impl of children list.

Definition at line 300 of file BaseTree.cs.

virtual void Antlr.Runtime.Tree.BaseTree.FreshenParentAndChildIndexes (  )  [virtual]

Set the parent and child index values for all child of t.

Implements Antlr.Runtime.Tree.ITree.

Definition at line 306 of file BaseTree.cs.

virtual void Antlr.Runtime.Tree.BaseTree.FreshenParentAndChildIndexes ( int  offset  )  [virtual]

Definition at line 311 of file BaseTree.cs.

virtual void Antlr.Runtime.Tree.BaseTree.SanityCheckParentAndChildIndexes (  )  [virtual]

Definition at line 322 of file BaseTree.cs.

virtual void Antlr.Runtime.Tree.BaseTree.SanityCheckParentAndChildIndexes ( ITree  parent,
int  i 
) [virtual]

Definition at line 327 of file BaseTree.cs.

virtual string Antlr.Runtime.Tree.BaseTree.ToStringTree (  )  [virtual]

Print out a whole tree not just a node.

Implements Antlr.Runtime.Tree.ITree.

Definition at line 362 of file BaseTree.cs.

abstract override string Antlr.Runtime.Tree.BaseTree.ToString (  )  [pure virtual]

abstract ITree Antlr.Runtime.Tree.BaseTree.DupNode (  )  [pure virtual]


Member Data Documentation

Definition at line 90 of file BaseTree.cs.


Property Documentation

virtual int Antlr.Runtime.Tree.BaseTree.ChildCount [get]

Implements Antlr.Runtime.Tree.ITree.

Definition at line 64 of file BaseTree.cs.

virtual bool Antlr.Runtime.Tree.BaseTree.IsNil [get]

Indicates the node is a nil node but may still have children, meaning the tree is a flat list.

Implements Antlr.Runtime.Tree.ITree.

Reimplemented in Antlr.Runtime.CommonErrorNode, and Antlr.Runtime.Tree.CommonTree.

Definition at line 76 of file BaseTree.cs.

virtual int Antlr.Runtime.Tree.BaseTree.Line [get]

In case we don't have a token payload, what is the line for errors?

Implements Antlr.Runtime.Tree.ITree.

Reimplemented in Antlr.Runtime.Tree.CommonTree.

Definition at line 81 of file BaseTree.cs.

virtual int Antlr.Runtime.Tree.BaseTree.CharPositionInLine [get]

Implements Antlr.Runtime.Tree.ITree.

Reimplemented in Antlr.Runtime.Tree.CommonTree.

Definition at line 86 of file BaseTree.cs.

IList Antlr.Runtime.Tree.BaseTree.Children [get]

Get the children internal list of children. Manipulating the list directly is not a supported operation (i.e. you do so at your own risk).

Definition at line 106 of file BaseTree.cs.

virtual int Antlr.Runtime.Tree.BaseTree.ChildIndex [get, set]

BaseTree doesn't track child indexes.

Implements Antlr.Runtime.Tree.ITree.

Reimplemented in Antlr.Runtime.Tree.CommonTree.

Definition at line 347 of file BaseTree.cs.

virtual ITree Antlr.Runtime.Tree.BaseTree.Parent [get, set]

BaseTree doesn't track parent pointers.

Implements Antlr.Runtime.Tree.ITree.

Reimplemented in Antlr.Runtime.Tree.CommonTree.

Definition at line 354 of file BaseTree.cs.

abstract int Antlr.Runtime.Tree.BaseTree.Type [get]

abstract int Antlr.Runtime.Tree.BaseTree.TokenStartIndex [get, set]

What is the smallest token index (indexing from 0) for this node and its children?

Implements Antlr.Runtime.Tree.ITree.

Reimplemented in Antlr.Runtime.Debug.RemoteDebugEventSocketListener.ProxyTree, Antlr.Runtime.Tree.CommonTree, and Antlr.Runtime.Tree.ParseTree.

Definition at line 405 of file BaseTree.cs.

abstract int Antlr.Runtime.Tree.BaseTree.TokenStopIndex [get, set]

What is the largest token index (indexing from 0) for this node and its children?

Implements Antlr.Runtime.Tree.ITree.

Reimplemented in Antlr.Runtime.Debug.RemoteDebugEventSocketListener.ProxyTree, Antlr.Runtime.Tree.CommonTree, and Antlr.Runtime.Tree.ParseTree.

Definition at line 411 of file BaseTree.cs.

abstract string Antlr.Runtime.Tree.BaseTree.Text [get]


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

Generated on Wed Oct 1 14:13:32 2008 for ANTLR API by  doxygen 1.5.5