org.antlr.runtime.tree
Interface Tree

All Known Implementing Classes:
BaseTree, CommonTree, DoubleLinkTree, ParseTree

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

INVALID_NODE

static final Tree INVALID_NODE
Method Detail

getChild

Tree getChild(int i)

getChildCount

int getChildCount()

addChild

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.

Parameters:
t -

isNil

boolean isNil()
Indicates the node is a nil node but may still have children, meaning the tree is a flat list.


getTokenStartIndex

int getTokenStartIndex()
What is the smallest token index (indexing from 0) for this node and its children?


setTokenStartIndex

void setTokenStartIndex(int index)

getTokenStopIndex

int getTokenStopIndex()
What is the largest token index (indexing from 0) for this node and its children?


setTokenStopIndex

void setTokenStopIndex(int index)

dupTree

Tree dupTree()

dupNode

Tree dupNode()

getType

int getType()
Return a token type; needed for tree parsing


getText

java.lang.String getText()

getLine

int getLine()
In case we don't have a token payload, what is the line for errors?


getCharPositionInLine

int getCharPositionInLine()

toStringTree

java.lang.String toStringTree()

toString

java.lang.String toString()
Overrides:
toString in class java.lang.Object