Antlr.Runtime.Tree.ITree Interface Reference

What does a tree look like? ANTLR has a number of support classes such as CommonTreeNodeStream that work on these kinds of trees. You don't have to make your trees implement this interface, but if you do, you'll be able to use more support code. More...

Inheritance diagram for Antlr.Runtime.Tree.ITree:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void FreshenParentAndChildIndexes ()
 Set (or reset) the parent and child index values for all children.
ITree GetChild (int i)
void AddChild (ITree t)
 Add t as a child to this node. If t is null, do nothing. If t is nil, add all children of t to this' children.
void SetChild (int i, ITree t)
 Set ith child (0..n-1) to t; t must be non-null and non-nil node.
object DeleteChild (int i)
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). num 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.
ITree DupNode ()
string ToStringTree ()
string ToString ()

Properties

int ChildCount [get]
ITree Parent [get, set]
int ChildIndex [get, set]
 This node is what child index? 0..n-1.
bool IsNil [get]
 Indicates the node is a nil node but may still have children, meaning the tree is a flat list.
int Type [get]
 Return a token type; needed for tree parsing.
string Text [get]
int Line [get]
 In case we don't have a token payload, what is the line for errors?
int CharPositionInLine [get]
int TokenStartIndex [get, set]
 What is the smallest token index (indexing from 0) for this node and its children?
int TokenStopIndex [get, set]
 What is the largest token index (indexing from 0) for this node and its children?


Detailed Description

What does a tree look like? ANTLR has a number of support classes such as CommonTreeNodeStream that work on these kinds of trees. You don't have to make your trees implement this interface, but if you do, you'll be able to use more support code.

NOTE: When constructing trees, ANTLR can build any kind of tree; it can even use Token objects as trees if you add a child list to your tokens.

This is a tree node without any payload; just navigation and factory stuff.

Definition at line 51 of file ITree.cs.


Member Function Documentation

void Antlr.Runtime.Tree.ITree.FreshenParentAndChildIndexes (  ) 

Set (or reset) the parent and child index values for all children.

Implemented in Antlr.Runtime.Tree.BaseTree.

ITree Antlr.Runtime.Tree.ITree.GetChild ( int  i  ) 

Implemented in Antlr.Runtime.Tree.BaseTree.

void Antlr.Runtime.Tree.ITree.AddChild ( ITree  t  ) 

Add t as a child to this node. If t is null, do nothing. If t is nil, add all children of t to this' children.

Parameters:
t Tree to add

Implemented in Antlr.Runtime.Tree.BaseTree.

void Antlr.Runtime.Tree.ITree.SetChild ( int  i,
ITree  t 
)

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

Implemented in Antlr.Runtime.Tree.BaseTree.

object Antlr.Runtime.Tree.ITree.DeleteChild ( int  i  ) 

Implemented in Antlr.Runtime.Tree.BaseTree.

void Antlr.Runtime.Tree.ITree.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). num 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.

Implemented in Antlr.Runtime.Tree.BaseTree.

ITree Antlr.Runtime.Tree.ITree.DupNode (  ) 

string Antlr.Runtime.Tree.ITree.ToStringTree (  ) 

Implemented in Antlr.Runtime.Tree.BaseTree.

string Antlr.Runtime.Tree.ITree.ToString (  ) 


Property Documentation

int Antlr.Runtime.Tree.ITree.ChildCount [get]

Implemented in Antlr.Runtime.Tree.BaseTree.

Definition at line 54 of file ITree.cs.

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

Implemented in Antlr.Runtime.Tree.BaseTree, and Antlr.Runtime.Tree.CommonTree.

Definition at line 62 of file ITree.cs.

int Antlr.Runtime.Tree.ITree.ChildIndex [get, set]

This node is what child index? 0..n-1.

Implemented in Antlr.Runtime.Tree.BaseTree, and Antlr.Runtime.Tree.CommonTree.

Definition at line 69 of file ITree.cs.

bool Antlr.Runtime.Tree.ITree.IsNil [get]

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

Implemented in Antlr.Runtime.Tree.BaseTree, Antlr.Runtime.CommonErrorNode, and Antlr.Runtime.Tree.CommonTree.

Definition at line 82 of file ITree.cs.

int Antlr.Runtime.Tree.ITree.Type [get]

string Antlr.Runtime.Tree.ITree.Text [get]

int Antlr.Runtime.Tree.ITree.Line [get]

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

Implemented in Antlr.Runtime.Tree.BaseTree, and Antlr.Runtime.Tree.CommonTree.

Definition at line 101 of file ITree.cs.

int Antlr.Runtime.Tree.ITree.CharPositionInLine [get]

Implemented in Antlr.Runtime.Tree.BaseTree, and Antlr.Runtime.Tree.CommonTree.

Definition at line 106 of file ITree.cs.

int Antlr.Runtime.Tree.ITree.TokenStartIndex [get, set]

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

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

Definition at line 137 of file ITree.cs.

int Antlr.Runtime.Tree.ITree.TokenStopIndex [get, set]

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

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

Definition at line 143 of file ITree.cs.


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

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