public interface Tree
Modifier and Type | Field and Description |
---|---|
static Tree |
INVALID_NODE |
Modifier and Type | Method and Description |
---|---|
void |
addChild(Tree t)
Add t as a child to this node.
|
Object |
deleteChild(int i) |
Tree |
dupNode() |
void |
freshenParentAndChildIndexes()
Set the parent and child index values for all children
|
Tree |
getAncestor(int ttype)
Walk upwards and get first ancestor with this token type.
|
List<?> |
getAncestors()
Return a list of all ancestors of this node.
|
int |
getCharPositionInLine() |
Tree |
getChild(int i) |
int |
getChildCount() |
int |
getChildIndex()
This node is what child index? 0..n-1
|
int |
getLine()
In case we don't have a token payload, what is the line for errors?
|
Tree |
getParent() |
String |
getText() |
int |
getTokenStartIndex()
What is the smallest token index (indexing from 0) for this node
and its children?
|
int |
getTokenStopIndex()
What is the largest token index (indexing from 0) for this node
and its children?
|
int |
getType()
Return a token type; needed for tree parsing
|
boolean |
hasAncestor(int ttype)
Is there is a node above with token type ttype?
|
boolean |
isNil()
Indicates the node is a nil node but may still have children, meaning
the tree is a flat list.
|
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).
|
void |
setChild(int i,
Tree t)
Set ith child (0..n-1) to t; t must be non-null and non-nil node
|
void |
setChildIndex(int index) |
void |
setParent(Tree t) |
void |
setTokenStartIndex(int index) |
void |
setTokenStopIndex(int index) |
String |
toString() |
String |
toStringTree() |
static final Tree INVALID_NODE
Tree getChild(int i)
int getChildCount()
Tree getParent()
void setParent(Tree t)
boolean hasAncestor(int ttype)
Tree getAncestor(int ttype)
List<?> getAncestors()
int getChildIndex()
void setChildIndex(int index)
void freshenParentAndChildIndexes()
void addChild(Tree t)
void setChild(int i, Tree t)
Object deleteChild(int i)
void replaceChildren(int startChildIndex, int stopChildIndex, Object t)
boolean isNil()
int getTokenStartIndex()
void setTokenStartIndex(int index)
int getTokenStopIndex()
void setTokenStopIndex(int index)
Tree dupNode()
int getType()
String getText()
int getLine()
int getCharPositionInLine()
String toStringTree()
Copyright © 1992–2015 ANTLR. All rights reserved.