org.antlr.runtime.tree.Tree Interface Reference

Inheritance diagram for org.antlr.runtime.tree.Tree:

Inheritance graph
[legend]
Collaboration diagram for org.antlr.runtime.tree.Tree:

Collaboration graph
[legend]

List of all members.

Public Member Functions

Tree getChild (int i)
int getChildCount ()
Tree getParent ()
void setParent (Tree t)
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 ()
String toString ()

Static Public Attributes

static final Tree INVALID_NODE = new CommonTree(Token.INVALID_TOKEN)


Detailed Description

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.

Definition at line 42 of file Tree.java.


Member Function Documentation

Tree org.antlr.runtime.tree.Tree.getChild ( int  i  ) 

int org.antlr.runtime.tree.Tree.getChildCount (  ) 

Tree org.antlr.runtime.tree.Tree.getParent (  ) 

void org.antlr.runtime.tree.Tree.setParent ( Tree  t  ) 

int org.antlr.runtime.tree.Tree.getChildIndex (  ) 

This node is what child index? 0..n-1

Implemented in org.antlr.runtime.tree.BaseTree, and org.antlr.runtime.tree.CommonTree.

void org.antlr.runtime.tree.Tree.setChildIndex ( int  index  ) 

void org.antlr.runtime.tree.Tree.freshenParentAndChildIndexes (  ) 

Set the parent and child index values for all children

Implemented in org.antlr.runtime.tree.BaseTree.

void org.antlr.runtime.tree.Tree.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.

Implemented in org.antlr.runtime.tree.BaseTree.

void org.antlr.runtime.tree.Tree.setChild ( int  i,
Tree  t 
)

Set ith child (0..n-1) to t; t must be non-null and non-nil node

Implemented in org.antlr.runtime.tree.BaseTree.

Object org.antlr.runtime.tree.Tree.deleteChild ( int  i  ) 

void org.antlr.runtime.tree.Tree.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.

Implemented in org.antlr.runtime.tree.BaseTree.

boolean org.antlr.runtime.tree.Tree.isNil (  ) 

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

Implemented in org.antlr.runtime.tree.BaseTree, org.antlr.runtime.tree.CommonErrorNode, and org.antlr.runtime.tree.CommonTree.

int org.antlr.runtime.tree.Tree.getTokenStartIndex (  ) 

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

Implemented in org.antlr.runtime.debug.RemoteDebugEventSocketListener.ProxyTree, org.antlr.runtime.tree.CommonTree, and org.antlr.runtime.tree.ParseTree.

void org.antlr.runtime.tree.Tree.setTokenStartIndex ( int  index  ) 

int org.antlr.runtime.tree.Tree.getTokenStopIndex (  ) 

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

Implemented in org.antlr.runtime.debug.RemoteDebugEventSocketListener.ProxyTree, org.antlr.runtime.tree.CommonTree, and org.antlr.runtime.tree.ParseTree.

void org.antlr.runtime.tree.Tree.setTokenStopIndex ( int  index  ) 

Tree org.antlr.runtime.tree.Tree.dupNode (  ) 

int org.antlr.runtime.tree.Tree.getType (  ) 

String org.antlr.runtime.tree.Tree.getText (  ) 

int org.antlr.runtime.tree.Tree.getLine (  ) 

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

Implemented in org.antlr.runtime.tree.BaseTree, and org.antlr.runtime.tree.CommonTree.

int org.antlr.runtime.tree.Tree.getCharPositionInLine (  ) 

String org.antlr.runtime.tree.Tree.toStringTree (  ) 

String org.antlr.runtime.tree.Tree.toString (  ) 


Member Data Documentation

Definition at line 43 of file Tree.java.


The documentation for this interface was generated from the following file:

Generated on Wed Oct 1 14:13:48 2008 for ANTLR API by  doxygen 1.5.5