antlr3.tree.BaseTree Class Reference

warnings.warn( "Using create() is deprecated, use createWithPayload()", DeprecationWarning, stacklevel=2 ) More...

Inheritance diagram for antlr3.tree.BaseTree:

Inheritance graph
[legend]
Collaboration diagram for antlr3.tree.BaseTree:

Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
 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.
def getChild
def getChildren
 Get the children internal List.
def getFirstChildWithType
def getChildCount
def addChild
 Add t as child of this node.
def addChildren
 Add all elements of kids list as children of this node.
def setChild
 Set ith child (0.
def deleteChild
def replaceChildren
 Delete children from start to stop and replace with t even if t is a list (nil-root tree).
def isNil
 Indicates the node is a nil node but may still have children, meaning the tree is a flat list.
def freshenParentAndChildIndexes
def sanityCheckParentAndChildIndexes
def getChildIndex
 BaseTree doesn't track child indexes.
def setChildIndex
 BaseTree doesn't track child indexes.
def getParent
 BaseTree doesn't track parent pointers.
def setParent
 BaseTree doesn't track parent pointers.
def hasAncestor
 Walk upwards looking for ancestor with this token type.
def getAncestor
 Walk upwards and get first ancestor with this token type.
def getAncestors
 Return a list of all ancestors of this node.
def toStringTree
 Print out a whole tree not just a node.
def getLine
 In case we don't have a token payload, what is the line for errors?
def getCharPositionInLine
def toString
 Override to say how a node (not a tree) should look as text.

Public Attributes

 children
 parent
 childIndex


Detailed Description

warnings.warn( "Using create() is deprecated, use createWithPayload()", DeprecationWarning, stacklevel=2 )

warnings.warn( "Using create() is deprecated, use createFromToken()", DeprecationWarning, stacklevel=2 ) warnings.warn( "Using create() is deprecated, use createFromToken()", DeprecationWarning, stacklevel=2 ) warnings.warn( "Using create() is deprecated, use createFromType()", DeprecationWarning, stacklevel=2 ) 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 732 of file tree.py.


Member Function Documentation

def antlr3.tree.BaseTree.__init__ (   self,
  node = None 
)

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.

Reimplemented in antlr3.tree.CommonTree, and antlr3.treewizard.TreePattern.

Definition at line 744 of file tree.py.

def antlr3.tree.BaseTree.getChild (   self,
  i 
)

Reimplemented from antlr3.tree.Tree.

Definition at line 752 of file tree.py.

def antlr3.tree.BaseTree.getChildren (   self  ) 

Get the children internal List.

Note that if you directly mess with the list, do so at your own risk.

Definition at line 765 of file tree.py.

def antlr3.tree.BaseTree.getFirstChildWithType (   self,
  treeType 
)

Definition at line 771 of file tree.py.

def antlr3.tree.BaseTree.getChildCount (   self  ) 

Reimplemented from antlr3.tree.Tree.

Definition at line 779 of file tree.py.

def antlr3.tree.BaseTree.addChild (   self,
  childTree 
)

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.

Reimplemented from antlr3.tree.Tree.

Definition at line 790 of file tree.py.

def antlr3.tree.BaseTree.addChildren (   self,
  children 
)

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

Definition at line 820 of file tree.py.

def antlr3.tree.BaseTree.setChild (   self,
  i,
  t 
)

Set ith child (0.

.n-1) to t; t must be non-null and non-nil node

Reimplemented from antlr3.tree.Tree.

Definition at line 825 of file tree.py.

def antlr3.tree.BaseTree.deleteChild (   self,
  i 
)

Reimplemented from antlr3.tree.Tree.

Definition at line 837 of file tree.py.

def antlr3.tree.BaseTree.replaceChildren (   self,
  startChildIndex,
  stopChildIndex,
  newTree 
)

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.

Reimplemented from antlr3.tree.Tree.

Definition at line 856 of file tree.py.

def antlr3.tree.BaseTree.isNil (   self  ) 

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

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree, and antlr3.tree.CommonErrorNode.

Definition at line 896 of file tree.py.

def antlr3.tree.BaseTree.freshenParentAndChildIndexes (   self,
  offset = 0 
)

Definition at line 900 of file tree.py.

def antlr3.tree.BaseTree.sanityCheckParentAndChildIndexes (   self,
  parent = None,
  i = -1 
)

Definition at line 906 of file tree.py.

def antlr3.tree.BaseTree.getChildIndex (   self  ) 

BaseTree doesn't track child indexes.

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 925 of file tree.py.

def antlr3.tree.BaseTree.setChildIndex (   self,
  index 
)

BaseTree doesn't track child indexes.

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 932 of file tree.py.

def antlr3.tree.BaseTree.getParent (   self  ) 

BaseTree doesn't track parent pointers.

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 939 of file tree.py.

def antlr3.tree.BaseTree.setParent (   self,
  t 
)

BaseTree doesn't track parent pointers.

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 945 of file tree.py.

def antlr3.tree.BaseTree.hasAncestor (   self,
  ttype 
)

Walk upwards looking for ancestor with this token type.

Reimplemented from antlr3.tree.Tree.

Definition at line 952 of file tree.py.

def antlr3.tree.BaseTree.getAncestor (   self,
  ttype 
)

Walk upwards and get first ancestor with this token type.

Reimplemented from antlr3.tree.Tree.

Definition at line 957 of file tree.py.

def antlr3.tree.BaseTree.getAncestors (   self  ) 

Return a list of all ancestors of this node.

The first node of list is the root and the last is the parent of this node.

Reimplemented from antlr3.tree.Tree.

Definition at line 972 of file tree.py.

def antlr3.tree.BaseTree.toStringTree (   self  ) 

Print out a whole tree not just a node.

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 987 of file tree.py.

def antlr3.tree.BaseTree.getLine (   self  ) 

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

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 1009 of file tree.py.

def antlr3.tree.BaseTree.getCharPositionInLine (   self  ) 

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 1013 of file tree.py.

def antlr3.tree.BaseTree.toString (   self  ) 

Override to say how a node (not a tree) should look as text.

Reimplemented from antlr3.tree.Tree.

Reimplemented in antlr3.tree.CommonTree, antlr3.tree.CommonErrorNode, and antlr3.treewizard.TreePattern.

Definition at line 1019 of file tree.py.


Member Data Documentation

Definition at line 747 of file tree.py.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 748 of file tree.py.

Reimplemented in antlr3.tree.CommonTree.

Definition at line 749 of file tree.py.


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

Generated on Mon Nov 29 17:24:29 2010 for ANTLR Python API by  doxygen 1.5.5