|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sc3d.apt.sss.v3.Token
public class Token
Represents a part of a Sentence that has some sort of syntactic significance. For example, Tokens are used to represent keywords, comments and numbers. Every Token has a 'type' field whose value indicates what kind of Token it is.
Field Summary | |
---|---|
int |
length
The length of this Token in characters. |
Sentence |
sentence
The Sentence of which this Token is part. |
int |
start
The index into 'sentence' of the character at which this Token starts. |
int |
type
The type of this Token (one of the 'TYPE_XXX' values). |
static int |
TYPE_BRACE
The value of the 'type' field for a Token that represents a string of Tokens inside braces (curly brackets). |
static int |
TYPE_CHAR
The value of the 'type' field for a Token that represents an SSS literal character. |
static int |
TYPE_COMMENT
The value of the 'type' field for a Token that represents an SSS comment. |
static int |
TYPE_CONSTANT
The value of the 'type' field for a Token that represents an SSS constant. |
static int |
TYPE_IDENTIFIER
The value of the 'type' field for a Token that represents an SSS identifier. |
static int |
TYPE_NUMBER
The value of the 'type' field for a Token that represents an SSS literal number. |
static int |
TYPE_ROUND
The value of the 'type' field for a Token that represents a string of Tokens inside round brackets. |
static int |
TYPE_SQUARE
The value of the 'type' field for a Token that represents a string of Tokens inside square brackets. |
static int |
TYPE_STRING
The value of the 'type' field for a Token that represents an SSS literal string. |
static int |
TYPE_WORD
The value of the 'type' field for a Token that represents an SSS keyword, separator character, or punctuation string. |
Constructor Summary | |
---|---|
Token(int type,
Sentence sentence,
int start,
int length)
Constructs a Token. |
Method Summary | |
---|---|
void |
addError(java.lang.String message)
Attaches an error message to this Token. |
boolean |
equals(java.lang.Object that)
Returns 'true' only if 'that' is a non-null Token whose 'toString()' method returns a String equal to 'this.toString()'. |
int |
hashCode()
Returns 'this.toString().hashCode()'. |
java.lang.String |
toString()
Returns the characters that make up this Token. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int type
public final Sentence sentence
public final int start
public final int length
public static final int TYPE_COMMENT
public static final int TYPE_WORD
public static final int TYPE_CONSTANT
public static final int TYPE_IDENTIFIER
public static final int TYPE_STRING
public static final int TYPE_NUMBER
public static final int TYPE_CHAR
public static final int TYPE_ROUND
public static final int TYPE_SQUARE
public static final int TYPE_BRACE
Constructor Detail |
---|
public Token(int type, Sentence sentence, int start, int length)
type
- one of the 'TYPE_XXX' values, indicating what kind of Token this is.Method Detail |
---|
public void addError(java.lang.String message)
public final java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object that)
equals
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |