|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.codehaus.groovy.syntax.CSTNode org.codehaus.groovy.syntax.Token
public class Token extends CSTNode
A CSTNode
produced by the Lexer
.
Field Summary | |
---|---|
static Token |
EOF
|
static Token |
NULL
|
Constructor Summary | |
Token(int type, java.lang.String text, int startLine, int startColumn)
|
Method Summary | |
---|---|
Reduction
|
asReduction()
Creates a |
Reduction
|
asReduction(CSTNode second)
Creates a |
Reduction
|
asReduction(CSTNode second, CSTNode third)
Creates a |
Reduction
|
asReduction(CSTNode second, CSTNode third, CSTNode fourth)
|
Token
|
dup()
|
CSTNode
|
get(int index)
|
int
|
getMeaning()
Returns the meaning of this node. |
Token
|
getRoot()
Returns the root of the node. |
java.lang.String
|
getRootText()
Returns the text of the token. |
int
|
getStartColumn()
|
int
|
getStartLine()
Returns the starting column of the node. |
java.lang.String
|
getText()
Not advisable, but if you need to adjust the token's text, this will do it. |
int
|
getType()
|
static Token
|
newDecimal(java.lang.String text, int startLine, int startColumn)
Creates a token that represents a symbol, using a library for the text. |
static Token
|
newIdentifier(java.lang.String text, int startLine, int startColumn)
Creates a token that represents an integer. |
static Token
|
newInteger(java.lang.String text, int startLine, int startColumn)
Creates a token that represents a decimal number. |
static Token
|
newKeyword(java.lang.String text, int startLine, int startColumn)
Creates a token that represents a keyword. |
static Token
|
newPlaceholder(int type)
|
static Token
|
newString(java.lang.String text, int startLine, int startColumn)
Creates a token that represents an identifier. |
static Token
|
newSymbol(int type, int startLine, int startColumn)
Creates a token that represents a symbol, using a library for the type. |
static Token
|
newSymbol(java.lang.String type, int startLine, int startColumn)
Creates a token with the specified meaning. |
CSTNode
|
setMeaning(int meaning)
|
void
|
setText(java.lang.String text)
Returns the starting line of the node. |
int
|
size()
Returns the number of elements in the node (including root). |
Methods inherited from class CSTNode | |
---|---|
add, addChildrenOf, asReduction, canMean, children, get, get, getDescription, getMeaning, getMeaningAs, getRoot, getRoot, getRootText, getStartColumn, getStartLine, getType, hasChildren, isA, isAllOf, isAnExpression, isEmpty, isOneOf, markAsExpression, set, setMeaning, size, toString, write, write |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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() |
Field Detail |
---|
public static final Token EOF
public static final Token NULL
Constructor Detail |
---|
public Token(int type, java.lang.String text, int startLine, int startColumn)
Method Detail |
---|
public Reduction asReduction()
Reduction
from this token. Returns self if the
node is already a Reduction
.
public Reduction asReduction(CSTNode second)
Reduction
from this token, adding the supplied
nodes as the second and third element, respectively.
public Reduction asReduction(CSTNode second, CSTNode third)
Reduction
from this token, adding the supplied
nodes as the second, third, and fourth element, respectively.
public Reduction asReduction(CSTNode second, CSTNode third, CSTNode fourth)
public Token dup()
public CSTNode get(int index)
public int getMeaning()
public Token getRoot()
isEmpty()
.
public java.lang.String getRootText()
getRootText()
when called directly.
public int getStartColumn()
public int getStartLine()
public java.lang.String getText()
public int getType()
public static Token newDecimal(java.lang.String text, int startLine, int startColumn)
public static Token newIdentifier(java.lang.String text, int startLine, int startColumn)
public static Token newInteger(java.lang.String text, int startLine, int startColumn)
public static Token newKeyword(java.lang.String text, int startLine, int startColumn)
public static Token newPlaceholder(int type)
public static Token newString(java.lang.String text, int startLine, int startColumn)
public static Token newSymbol(int type, int startLine, int startColumn)
public static Token newSymbol(java.lang.String type, int startLine, int startColumn)
public CSTNode setMeaning(int meaning)
public void setText(java.lang.String text)
public int size()
Groovy Documentation