public class CommonTree extends BaseTree
Modifier and Type | Field and Description |
---|---|
int |
childIndex
What index is this node in the child list? Range: 0..n-1
|
CommonTree |
parent
Who is the parent node of this node; if null, implies node is root
|
protected int |
startIndex
What token indexes bracket all tokens associated with this node
and below?
|
protected int |
stopIndex
What token indexes bracket all tokens associated with this node
and below?
|
Token |
token
A single token is the payload
|
INVALID_NODE
Constructor and Description |
---|
CommonTree() |
CommonTree(CommonTree node) |
CommonTree(Token t) |
Modifier and Type | Method and Description |
---|---|
Tree |
dupNode() |
int |
getCharPositionInLine() |
int |
getChildIndex()
BaseTree doesn't track child indexes.
|
int |
getLine()
In case we don't have a token payload, what is the line for errors?
|
Tree |
getParent()
BaseTree doesn't track parent pointers.
|
String |
getText() |
Token |
getToken() |
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 |
setChildIndex(int index) |
void |
setParent(Tree t) |
void |
setTokenStartIndex(int index) |
void |
setTokenStopIndex(int index) |
void |
setUnknownTokenBoundaries()
For every node in this subtree, make sure it's start/stop token's
are set.
|
String |
toString()
Override to say how a node (not a tree) should look as text
|
addChild, addChildren, createChildrenList, deleteChild, freshenParentAndChildIndexes, freshenParentAndChildIndexes, freshenParentAndChildIndexesDeeply, freshenParentAndChildIndexesDeeply, getAncestor, getAncestors, getChild, getChildCount, getChildren, getFirstChildWithType, hasAncestor, insertChild, replaceChildren, sanityCheckParentAndChildIndexes, sanityCheckParentAndChildIndexes, setChild, toStringTree
public Token token
protected int startIndex
protected int stopIndex
public CommonTree parent
public int childIndex
public CommonTree()
public CommonTree(CommonTree node)
public CommonTree(Token t)
public Token getToken()
public Tree dupNode()
public boolean isNil()
Tree
public int getType()
Tree
public String getText()
public int getLine()
Tree
public int getCharPositionInLine()
getCharPositionInLine
in interface Tree
getCharPositionInLine
in class BaseTree
public int getTokenStartIndex()
Tree
public void setTokenStartIndex(int index)
public int getTokenStopIndex()
Tree
public void setTokenStopIndex(int index)
public void setUnknownTokenBoundaries()
public int getChildIndex()
BaseTree
getChildIndex
in interface Tree
getChildIndex
in class BaseTree
public Tree getParent()
BaseTree
public void setParent(Tree t)
public void setChildIndex(int index)
setChildIndex
in interface Tree
setChildIndex
in class BaseTree
Copyright © 1992–2015 ANTLR. All rights reserved.