Packageorg.antlr.runtime.tree
Classpublic class CommonTree
InheritanceCommonTree Inheritance BaseTree
SubclassesCommonErrorNode

A tree node that is wrapper for a Token object. After 3.0 release while building tree rewrite stuff, it became clear that computing parent and child index is very difficult and cumbersome. Better to spend the space in every tree node. If you don't want these extra fields, it's easy to cut them out in your own BaseTree subclass.



Public Properties
 PropertyDefined by
  charPositionInLine : int
[read-only]
CommonTree
 InheritedchildCount : int
BaseTree
  childIndex : int
CommonTree
 Inheritedchildren : Array
Get the children internal List; note that if you directly mess with the list, do so at your own risk.
BaseTree
  isNil : Boolean
[read-only]
CommonTree
  line : int
[read-only]
CommonTree
  parent : Tree
CommonTree
  startIndex : int = -1
What token indexes bracket all tokens associated with this node and below?
CommonTree
  text : String
[read-only]
CommonTree
  token : Token
[read-only]
CommonTree
  tokenStartIndex : int
CommonTree
  tokenStopIndex : int
CommonTree
  type : int
[read-only]
CommonTree
Protected Properties
 PropertyDefined by
  _childIndex : int = -1
What index is this node in the child list? Range: 0..n-1
CommonTree
 Inherited_children : Array
BaseTree
  _parent : CommonTree
Who is the parent node of this node; if null, implies node is root
CommonTree
  _token : Token
A single token is the payload
CommonTree
Public Methods
 MethodDefined by
  
CommonTree(node:CommonTree = null)
CommonTree
 Inherited
addChild(t:Tree):void
Add t as child of this node.
BaseTree
 Inherited
addChildren(kids:Array):void
Add all elements of kids list as children of this node
BaseTree
  
[static]
CommonTree
 Inherited
deleteChild(i:int):Object
BaseTree
  
CommonTree
 Inherited
Set the parent and child index values for all child of t
BaseTree
 Inherited
BaseTree
 Inherited
getChild(i:int):Tree
BaseTree
 Inherited
BaseTree
 Inherited
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).
BaseTree
 Inherited
BaseTree
 Inherited
BaseTree
 Inherited
setChild(i:int, t:Tree):void
BaseTree
  
toString():String
CommonTree
 Inherited
toStringTree():String
Print out a whole tree not just a node
BaseTree
Property detail
charPositionInLineproperty
charPositionInLine:int  [read-only]Implementation
    public function get charPositionInLine():int
_childIndexproperty 
protected var _childIndex:int = -1

What index is this node in the child list? Range: 0..n-1

childIndexproperty 
childIndex:int  [read-write]Implementation
    public function get childIndex():int
    public function set childIndex(value:int):void
isNilproperty 
isNil:Boolean  [read-only]Implementation
    public function get isNil():Boolean
lineproperty 
line:int  [read-only]Implementation
    public function get line():int
_parentproperty 
protected var _parent:CommonTree

Who is the parent node of this node; if null, implies node is root

parentproperty 
parent:Tree  [read-write]Implementation
    public function get parent():Tree
    public function set parent(value:Tree):void
startIndexproperty 
public var startIndex:int = -1

What token indexes bracket all tokens associated with this node and below?

textproperty 
text:String  [read-only]Implementation
    public function get text():String
_tokenproperty 
protected var _token:Token

A single token is the payload

tokenproperty 
token:Token  [read-only]Implementation
    public function get token():Token
tokenStartIndexproperty 
tokenStartIndex:int  [read-write]Implementation
    public function get tokenStartIndex():int
    public function set tokenStartIndex(value:int):void
tokenStopIndexproperty 
tokenStopIndex:int  [read-write]Implementation
    public function get tokenStopIndex():int
    public function set tokenStopIndex(value:int):void
typeproperty 
type:int  [read-only]Implementation
    public function get type():int
Constructor detail
CommonTree()constructor
public function CommonTree(node:CommonTree = null)Parameters
node:CommonTree (default = null)
Method detail
createFromToken()method
public static function createFromToken(t:Token):CommonTreeParameters
t:Token

Returns
CommonTree
dupNode()method 
public override function dupNode():Tree

Returns
Tree
toString()method 
public function toString():String

Returns
String