Packageorg.antlr.runtime.tree
Interfacepublic interface Tree
ImplementorsBaseTree, BaseTreeAdaptor, CommonTreeNodeStream

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.



Public Properties
 PropertyDefined by
  charPositionInLine : int
[read-only]
Tree
  childCount : int
[read-only]
Tree
  childIndex : int
This node is what child index? 0..n-1
Tree
  isNil : Boolean
[read-only] Indicates the node is a nil node but may still have children, meaning the tree is a flat list.
Tree
  line : int
[read-only] In case we don't have a token payload, what is the line for errors?
Tree
  parent : Tree
Tree
  text : String
[read-only]
Tree
  tokenStartIndex : int
What is the smallest token index (indexing from 0) for this node and its children?
Tree
  tokenStopIndex : int
What is the largest token index (indexing from 0) for this node and its children?
Tree
  type : int
[read-only] Return a token type; needed for tree parsing
Tree
Public Methods
 MethodDefined by
  
addChild(t:Tree):void
Add t as a child to this node.
Tree
  
deleteChild(i:int):Object
Tree
  
Tree
  
Set the parent and child index values for all children
Tree
  
getChild(i:int):Tree
Tree
  
replaceChildren(startChildIndex:int, stopChildIndex:int, t:Object):void
Delete children from start to stop and replace with t even if t is a list (nil-root tree).
Tree
  
setChild(i:int, t:Tree):void
Set ith child (0..n-1) to t; t must be non-null and non-nil node
Tree
  
toStringTree():String
Tree
Property detail
charPositionInLineproperty
charPositionInLine:int  [read-only]Implementation
    public function get charPositionInLine():int
childCountproperty 
childCount:int  [read-only]Implementation
    public function get childCount():int
childIndexproperty 
childIndex:int  [read-write]

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

Implementation
    public function get childIndex():int
    public function set childIndex(value:int):void
isNilproperty 
isNil:Boolean  [read-only]

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

Implementation
    public function get isNil():Boolean
lineproperty 
line:int  [read-only]

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

Implementation
    public function get line():int
parentproperty 
parent:Tree  [read-write]Implementation
    public function get parent():Tree
    public function set parent(value:Tree):void
textproperty 
text:String  [read-only]Implementation
    public function get text():String
tokenStartIndexproperty 
tokenStartIndex:int  [read-write]

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

Implementation
    public function get tokenStartIndex():int
    public function set tokenStartIndex(value:int):void
tokenStopIndexproperty 
tokenStopIndex:int  [read-write]

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

Implementation
    public function get tokenStopIndex():int
    public function set tokenStopIndex(value:int):void
typeproperty 
type:int  [read-only]

Return a token type; needed for tree parsing

Implementation
    public function get type():int
Method detail
addChild()method
public function addChild(t:Tree):void

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
deleteChild()method 
public function deleteChild(i:int):ObjectParameters
i:int

Returns
Object
dupNode()method 
public function dupNode():Tree

Returns
Tree
freshenParentAndChildIndexes()method 
public function freshenParentAndChildIndexes():void

Set the parent and child index values for all children

getChild()method 
public function getChild(i:int):TreeParameters
i:int

Returns
Tree
replaceChildren()method 
public function replaceChildren(startChildIndex:int, stopChildIndex:int, t:Object):void

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.

Parameters
startChildIndex:int
 
stopChildIndex:int
 
t:Object
setChild()method 
public function setChild(i:int, t:Tree):void

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

Parameters
i:int
 
t:Tree
toStringTree()method 
public function toStringTree():String

Returns
String