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 | getToken |
def | dupNode |
def | isNil |
Indicates the node is a nil node but may still have children, meaning the tree is a flat list. | |
def | getType |
Return a token type; needed for tree parsing. | |
def | getText |
def | getLine |
In case we don't have a token payload, what is the line for errors? | |
def | getCharPositionInLine |
def | getTokenStartIndex |
What is the smallest token index (indexing from 0) for this node and its children? | |
def | setTokenStartIndex |
def | getTokenStopIndex |
What is the largest token index (indexing from 0) for this node and its children? | |
def | setTokenStopIndex |
def | setUnknownTokenBoundaries |
For every node in this subtree, make sure it's start/stop token's are set. | |
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 | toString |
Override to say how a node (not a tree) should look as text. | |
def | toStringTree |
Print out a whole tree not just a node. | |
Public Attributes | |
startIndex | |
stopIndex | |
parent | |
childIndex | |
token | |
Static Public Attributes | |
tuple | type = property(getType) |
tuple | text = property(getText) |
tuple | line = property(getLine) |
tuple | charPositionInLine = property(getCharPositionInLine) |
tuple | tokenStartIndex = property(getTokenStartIndex, setTokenStartIndex) |
tuple | tokenStopIndex = property(getTokenStopIndex, setTokenStopIndex) |
Static Private Attributes | |
__str__ = toString |
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.
Definition at line 1279 of file tree.py.
def antlr3.tree.CommonTree.__init__ | ( | self, | ||
node | ||||
) |
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 from antlr3.tree.BaseTree.
Reimplemented in antlr3.treewizard.TreePattern.
def antlr3.tree.CommonTree.dupNode | ( | self | ) |
def antlr3.tree.CommonTree.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.BaseTree.
Reimplemented in antlr3.tree.CommonErrorNode.
def antlr3.tree.CommonTree.getType | ( | self | ) |
Return a token type; needed for tree parsing.
Reimplemented from antlr3.tree.Tree.
Reimplemented in antlr3.tree.CommonErrorNode.
def antlr3.tree.CommonTree.getText | ( | self | ) |
def antlr3.tree.CommonTree.getLine | ( | self | ) |
In case we don't have a token payload, what is the line for errors?
Reimplemented from antlr3.tree.BaseTree.
def antlr3.tree.CommonTree.getCharPositionInLine | ( | self | ) |
def antlr3.tree.CommonTree.getTokenStartIndex | ( | self | ) |
What is the smallest token index (indexing from 0) for this node and its children?
Reimplemented from antlr3.tree.Tree.
def antlr3.tree.CommonTree.setTokenStartIndex | ( | self, | ||
index | ||||
) |
def antlr3.tree.CommonTree.getTokenStopIndex | ( | self | ) |
What is the largest token index (indexing from 0) for this node and its children?
Reimplemented from antlr3.tree.Tree.
def antlr3.tree.CommonTree.setTokenStopIndex | ( | self, | ||
index | ||||
) |
def antlr3.tree.CommonTree.setUnknownTokenBoundaries | ( | self | ) |
def antlr3.tree.CommonTree.getChildIndex | ( | self | ) |
def antlr3.tree.CommonTree.setChildIndex | ( | self, | ||
index | ||||
) |
def antlr3.tree.CommonTree.getParent | ( | self | ) |
def antlr3.tree.CommonTree.setParent | ( | self, | ||
t | ||||
) |
def antlr3.tree.CommonTree.toString | ( | self | ) |
Override to say how a node (not a tree) should look as text.
Reimplemented from antlr3.tree.BaseTree.
Reimplemented in antlr3.tree.CommonErrorNode, and antlr3.treewizard.TreePattern.
def antlr3.tree.CommonTree.toStringTree | ( | self | ) |
tuple antlr3.tree.CommonTree.type = property(getType) [static] |
tuple antlr3.tree.CommonTree.text = property(getText) [static] |
tuple antlr3.tree.CommonTree.line = property(getLine) [static] |
tuple antlr3.tree.CommonTree.charPositionInLine = property(getCharPositionInLine) [static] |
tuple antlr3.tree.CommonTree.tokenStartIndex = property(getTokenStartIndex, setTokenStartIndex) [static] |
tuple antlr3.tree.CommonTree.tokenStopIndex = property(getTokenStopIndex, setTokenStopIndex) [static] |
antlr3.tree.CommonTree.__str__ = toString [static, private] |