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 |
Definition at line 2488 of file tree.py.
def antlr3.tree.TreeVisitor.__init__ | ( | self, | ||
adaptor = None | ||||
) |
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.