Note
When constructing trees, ANTLR can build any kind of tree; it can even use Token objects as trees if you add a child list to your tokens. This is a tree node without any payload; just navigation and factory stuff.
| Modifier and Type | Field and Description |
|---|---|
| public static final Tree |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Object | |
| public Tree | |
| public void | |
| public Tree | |
| public List | |
| public int | |
| public Tree | |
| public int | |
| public int | |
| public int | |
| public Tree | |
| public String | |
| public int | getTokenStartIndex()
What is the smallest token index (indexing from 0) for this node and its children? |
| public int | getTokenStopIndex()
What is the largest token index (indexing from 0) for this node and its children? |
| public int | |
| public boolean | |
| public boolean | isNil()
Indicates the node is a nil node but may still have children, meaning the tree is a flat list. |
| public void | replaceChildren(int startChildIndex, int stopChildIndex, Object t)
Delete children from start to stop and replace with t even if t is a list (nil-root tree). |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public String | |
| public String |
| INVALID_NODE | back to summary |
|---|---|
| public static final Tree INVALID_NODE | |
| addChild | back to summary |
|---|---|
| public void addChild(Tree t) Add t as a child to this node. If t is null, do nothing. If t is nil, add all children of t to this' children. | |
| deleteChild | back to summary |
|---|---|
| public Object deleteChild(int i) | |
| dupNode | back to summary |
|---|---|
| public Tree dupNode() | |
| freshenParentAndChildIndexes | back to summary |
|---|---|
| public void freshenParentAndChildIndexes() Set the parent and child index values for all children | |
| getAncestor | back to summary |
|---|---|
| public Tree getAncestor(int ttype) Walk upwards and get first ancestor with this token type. | |
| getAncestors | back to summary |
|---|---|
| public List 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. | |
| getCharPositionInLine | back to summary |
|---|---|
| public int getCharPositionInLine() | |
| getChild | back to summary |
|---|---|
| public Tree getChild(int i) | |
| getChildCount | back to summary |
|---|---|
| public int getChildCount() | |
| getChildIndex | back to summary |
|---|---|
| public int getChildIndex() This node is what child index? 0..n-1 | |
| getLine | back to summary |
|---|---|
| public int getLine() In case we don't have a token payload, what is the line for errors? | |
| getParent | back to summary |
|---|---|
| public Tree getParent() | |
| getText | back to summary |
|---|---|
| public String getText() | |
| getTokenStartIndex | back to summary |
|---|---|
| public int getTokenStartIndex() What is the smallest token index (indexing from 0) for this node and its children? | |
| getTokenStopIndex | back to summary |
|---|---|
| public int getTokenStopIndex() What is the largest token index (indexing from 0) for this node and its children? | |
| getType | back to summary |
|---|---|
| public int getType() Return a token type; needed for tree parsing | |
| hasAncestor | back to summary |
|---|---|
| public boolean hasAncestor(int ttype) Is there is a node above with token type ttype? | |
| isNil | back to summary |
|---|---|
| public boolean isNil() Indicates the node is a nil node but may still have children, meaning the tree is a flat list. | |
| replaceChildren | back to summary |
|---|---|
| public void replaceChildren(int startChildIndex, int stopChildIndex, Object t) 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. | |
| setChild | back to summary |
|---|---|
| public void setChild(int i, Tree t) Set ith child (0..n-1) to t; t must be non-null and non-nil node | |
| setChildIndex | back to summary |
|---|---|
| public void setChildIndex(int index) | |
| setParent | back to summary |
|---|---|
| public void setParent(Tree t) | |
| setTokenStartIndex | back to summary |
|---|---|
| public void setTokenStartIndex(int index) | |
| setTokenStopIndex | back to summary |
|---|---|
| public void setTokenStopIndex(int index) | |
| toString | back to summary |
|---|---|
public String toString()
| |
| toStringTree | back to summary |
|---|---|
| public String toStringTree() | |