|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.syntax.CSTNode
public abstract class CSTNode extends java.lang.Object
An abstract base class for nodes in the concrete syntax tree that is the result of parsing. Note that the CSTNode is inextricably linked with the Token in that every CSTNode has a Token as it's root.
Method Summary | |
---|---|
CSTNode
|
add(CSTNode element)
Adds an element to the node. |
void
|
addChildrenOf(CSTNode of)
|
Reduction
|
asReduction()
|
boolean
|
canMean(int type)
Returns true if the node can be coerced to the specified type. |
int
|
children()
Returns the number of non-root elements in the node. |
CSTNode
|
get(int index)
Returns the specified element, or null. |
CSTNode
|
get(int index, boolean safe)
|
java.lang.String
|
getDescription()
Returns a description of the node. |
int
|
getMeaning()
Returns the meaning of this node. |
int
|
getMeaningAs(int[] types)
Returns the first matching meaning of the specified types. |
Token
|
getRoot()
Returns the root of the node. |
Token
|
getRoot(boolean safe)
|
java.lang.String
|
getRootText()
Returns the text of the root. |
int
|
getStartColumn()
Returns the starting column of the node. |
int
|
getStartLine()
Returns the starting line of the node. |
int
|
getType()
Returns the actual type of the node. |
boolean
|
hasChildren()
|
boolean
|
isA(int type)
Returns true if the node's meaning matches the specified type. |
boolean
|
isAllOf(int[] types)
Returns true if the node's meaning matches all of the specified types. |
boolean
|
isAnExpression()
Returns true if the node is a complete expression. |
boolean
|
isEmpty()
Returns true if the node is completely empty (no root, even). |
boolean
|
isOneOf(int[] types)
Returns true if the node's meaning matches any of the specified types. |
void
|
markAsExpression()
Marks the node a complete expression. |
CSTNode
|
set(int index, CSTNode element)
Sets an element node in at the specified index. |
CSTNode
|
setMeaning(int meaning)
Sets the meaning for this node (and it's root Token). |
int
|
size()
Returns the number of elements in the node (including root). |
java.lang.String
|
toString()
Formats the node as a |
void
|
write(java.io.PrintWriter writer)
|
protected void
|
write(java.io.PrintWriter writer, java.lang.String indent)
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Method Detail |
---|
public CSTNode add(CSTNode element)
public void addChildrenOf(CSTNode of)
public Reduction asReduction()
public boolean canMean(int type)
public int children()
public CSTNode get(int index)
public CSTNode get(int index, boolean safe)
public java.lang.String getDescription()
public int getMeaning()
public int getMeaningAs(int[] types)
public Token getRoot()
isEmpty()
.
public Token getRoot(boolean safe)
public java.lang.String getRootText()
getRoot(true)
to get the root, so you will only receive null in return if the
root token returns it.
public int getStartColumn()
public int getStartLine()
public int getType()
public boolean hasChildren()
public boolean isA(int type)
public boolean isAllOf(int[] types)
public boolean isAnExpression()
public boolean isEmpty()
public boolean isOneOf(int[] types)
public void markAsExpression()
public CSTNode set(int index, CSTNode element)
public CSTNode setMeaning(int meaning)
public int size()
public java.lang.String toString()
String
and returns it.
public void write(java.io.PrintWriter writer)
protected void write(java.io.PrintWriter writer, java.lang.String indent)
Groovy Documentation