org.codehaus.groovy.syntax.parser
Class CSTNode

java.lang.Object
  extended byorg.codehaus.groovy.syntax.parser.CSTNode

public class CSTNode
extends java.lang.Object

Node in the concrete syntax tree.

Version:
$Id: CSTNode.java,v 1.8 2004/03/05 12:00:35 jstrachan Exp $
Author:
bob mcwhirter
See Also:
Parser, Token

Field Summary
static CSTNode[] EMPTY_ARRAY
           
 
Constructor Summary
CSTNode()
          Initializes the node with token set to null.
CSTNode(Token token)
          Initializes the node with the specified token.
 
Method Summary
 void addChild(CSTNode node)
          Appends a child node to the child list.
 java.util.Iterator childIterator()
          Returns an Iterator on the child list.
 int children()
          Returns the number of children.
 java.lang.String dump()
          Generates the pretty-printed representation of the node returned by toString.
protected  java.lang.String dump(java.lang.String indent)
          Does the actual work of generating the pretty-printing for this node.
 CSTNode getChild(int index)
          Returns the child at the specified index.
 CSTNode[] getChildren()
          Returns an array of all children.
 Token getToken()
          Returns the token set on construction, or null.
 boolean isEmpty()
          Returns true if the node is empty (no token, no children).
 void setToken(Token value)
          Changes the token set on construction.
 java.lang.String toString()
          Returns a pretty-printed representation of the node, including all descendents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static final CSTNode[] EMPTY_ARRAY
Constructor Detail

CSTNode

public CSTNode()
Initializes the node with token set to null.


CSTNode

public CSTNode(Token token)
Initializes the node with the specified token.

Method Detail

getToken

public Token getToken()
Returns the token set on construction, or null.


setToken

public void setToken(Token value)
Changes the token set on construction. Not generally a good idea. :-)


isEmpty

public boolean isEmpty()
Returns true if the node is empty (no token, no children).


addChild

public void addChild(CSTNode node)
Appends a child node to the child list.


getChild

public CSTNode getChild(int index)
Returns the child at the specified index.


getChildren

public CSTNode[] getChildren()
Returns an array of all children.


children

public int children()
Returns the number of children.


childIterator

public java.util.Iterator childIterator()
Returns an Iterator on the child list.


toString

public java.lang.String toString()
Returns a pretty-printed representation of the node, including all descendents.


dump

public java.lang.String dump()
Generates the pretty-printed representation of the node returned by toString.


dump

protected java.lang.String dump(java.lang.String indent)
Does the actual work of generating the pretty-printing for this node.



Copyright © 2003-2004 The Codehaus. All Rights Reserved.