|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.syntax.CSTNode
org.codehaus.groovy.syntax.Token
public class Token
A CSTNode
produced by the Lexer
.
Parser
,
Token
,
Reduction
,
Types
Field Summary | |
---|---|
static Token |
EOF
|
static Token |
NULL
|
Constructor Summary | |
---|---|
Token(int type,
String text,
int startLine,
int startColumn)
Initializes the Token with the specified information. |
Method Summary | |
---|---|
Reduction |
asReduction()
Creates a Reduction from this token. |
Reduction |
asReduction(CSTNode second)
Creates a Reduction from this token, adding the supplied
node as the second element. |
Reduction |
asReduction(CSTNode second,
CSTNode third)
Creates a Reduction from this token, adding the supplied
nodes as the second and third element, respectively. |
Reduction |
asReduction(CSTNode second,
CSTNode third,
CSTNode fourth)
Creates a Reduction from this token, adding the supplied
nodes as the second, third, and fourth element, respectively. |
Token |
dup()
Returns a copy of this Token. |
CSTNode |
get(int index)
Returns the specified element, or null. |
int |
getMeaning()
Returns the meaning of this node. |
Token |
getRoot()
Returns the root of the node. |
String |
getRootText()
Returns the text of the root node. |
int |
getStartColumn()
Returns the starting column of the node. |
int |
getStartLine()
Returns the starting line of the node. |
String |
getText()
Returns the text of the token. |
int |
getType()
Returns the actual type of the node. |
static Token |
newDecimal(String text,
int startLine,
int startColumn)
Creates a token that represents a decimal number. |
static Token |
newIdentifier(String text,
int startLine,
int startColumn)
Creates a token that represents an identifier. |
static Token |
newInteger(String text,
int startLine,
int startColumn)
Creates a token that represents an integer. |
static Token |
newKeyword(String text,
int startLine,
int startColumn)
Creates a token that represents a keyword. |
static Token |
newPlaceholder(int type)
Creates a token with the specified meaning. |
static Token |
newString(String text,
int startLine,
int startColumn)
Creates a token that represents a double-quoted string. |
static Token |
newSymbol(int type,
int startLine,
int startColumn)
Creates a token that represents a symbol, using a library for the text. |
static Token |
newSymbol(String type,
int startLine,
int startColumn)
Creates a token that represents a symbol, using a library for the type. |
CSTNode |
setMeaning(int meaning)
Sets the meaning for this node (and it's root Token). |
void |
setText(String text)
Not advisable, but if you need to adjust the token's text, this will do it. |
int |
size()
Returns the number of elements in the node (including root). |
Methods inherited from class org.codehaus.groovy.syntax.CSTNode |
---|
add, addChildrenOf, canMean, children, get, getDescription, getMeaningAs, getRoot, hasChildren, isA, isAllOf, isAnExpression, isEmpty, isOneOf, markAsExpression, set, toString, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Token NULL
public static final Token EOF
Constructor Detail |
---|
public Token(int type, String text, int startLine, int startColumn)
Method Detail |
---|
public Token dup()
public int getMeaning()
getMeaning
in class CSTNode
public CSTNode setMeaning(int meaning)
setMeaning
in class CSTNode
public int getType()
getType
in class CSTNode
public int size()
size
in class CSTNode
public CSTNode get(int index)
get
in class CSTNode
public Token getRoot()
isEmpty()
.
getRoot
in class CSTNode
public String getRootText()
getRoot(true)
to get the root, so you will only receive null in return if the
root token returns it.
getRootText
in class CSTNode
public String getText()
getRootText()
when called directly.
public void setText(String text)
public int getStartLine()
getStartLine
in class CSTNode
public int getStartColumn()
getStartColumn
in class CSTNode
public Reduction asReduction()
Reduction
from this token. Returns self if the
node is already a Reduction
.
asReduction
in class CSTNode
public Reduction asReduction(CSTNode second)
Reduction
from this token, adding the supplied
node as the second element.
public Reduction asReduction(CSTNode second, CSTNode third)
Reduction
from this token, adding the supplied
nodes as the second and third element, respectively.
public Reduction asReduction(CSTNode second, CSTNode third, CSTNode fourth)
Reduction
from this token, adding the supplied
nodes as the second, third, and fourth element, respectively.
public static Token newKeyword(String text, int startLine, int startColumn)
public static Token newString(String text, int startLine, int startColumn)
public static Token newIdentifier(String text, int startLine, int startColumn)
public static Token newInteger(String text, int startLine, int startColumn)
public static Token newDecimal(String text, int startLine, int startColumn)
public static Token newSymbol(int type, int startLine, int startColumn)
public static Token newSymbol(String type, int startLine, int startColumn)
public static Token newPlaceholder(int type)
|
Copyright © 2003-2009 The Codehaus. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |