antlr3.tree.TreeVisitor Class Reference

Do a depth first walk of a tree, applying pre() and post() actions we go. More...

List of all members.

Public Member Functions

def __init__
def visit
 Visit every node in tree t and trigger an action for each node before/after having visited all of its children.

Public Attributes

 adaptor


Detailed Description

Do a depth first walk of a tree, applying pre() and post() actions we go.

Definition at line 2488 of file tree.py.


Member Function Documentation

def antlr3.tree.TreeVisitor.__init__ (   self,
  adaptor = None 
)

Definition at line 2490 of file tree.py.

def antlr3.tree.TreeVisitor.visit (   self,
  t,
  pre_action = None,
  post_action = None 
)

Visit every node in tree t and trigger an action for each node before/after having visited all of its children.

Bottom up walk. Execute both actions even if t has no children. Ignore return results from transforming children since they will have altered the child list of this node (their parent). Return result of applying post action to this node.

The Python version differs from the Java version by taking two callables 'pre_action' and 'post_action' instead of a class instance that wraps those methods. Those callables must accept a TreeNode as their single argument and return the (potentially transformed or replaced) TreeNode.

Definition at line 2510 of file tree.py.


Member Data Documentation

Definition at line 2492 of file tree.py.


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

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