|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Tree
What does a tree look like? ANTLR has a number of support classes such as CommonTreeNodeStream that work on these kinds of trees. You don't have to make your trees implement this interface, but if you do, you'll be able to use more support code. 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.
Field Summary | |
---|---|
static Tree |
INVALID_NODE
|
Method Summary | |
---|---|
void |
addChild(Tree t)
Add t as a child to this node. |
Tree |
dupNode()
|
Tree |
dupTree()
|
int |
getCharPositionInLine()
|
Tree |
getChild(int i)
|
int |
getChildCount()
|
int |
getLine()
In case we don't have a token payload, what is the line for errors? |
java.lang.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 |
isNil()
Indicates the node is a nil node but may still have children, meaning the tree is a flat list. |
void |
setTokenStartIndex(int index)
|
void |
setTokenStopIndex(int index)
|
java.lang.String |
toString()
|
java.lang.String |
toStringTree()
|
Field Detail |
---|
static final Tree INVALID_NODE
Method Detail |
---|
Tree getChild(int i)
int getChildCount()
void addChild(Tree t)
t
- boolean isNil()
int getTokenStartIndex()
void setTokenStartIndex(int index)
int getTokenStopIndex()
void setTokenStopIndex(int index)
Tree dupTree()
Tree dupNode()
int getType()
java.lang.String getText()
int getLine()
int getCharPositionInLine()
java.lang.String toStringTree()
java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |