|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Token
Each Token object represents one token from the compiler input stream.
Field Summary | |
static int |
COMMA
|
static int |
EOF
|
static int |
ID
|
static int |
INT
|
static int |
KW_ELSE
|
static int |
KW_IF
|
static int |
KW_INT
|
static int |
KW_RETURN
|
static int |
KW_WHILE
|
static int |
LCURLY
|
static int |
LPAREN
|
static int |
OP_ADD
|
static int |
OP_ASSIGN
|
static int |
OP_EQ
|
static int |
OP_GT
|
static int |
OP_MUL
|
static int |
OP_NOT
|
static int |
OP_SUB
|
static int |
RCURLY
|
static int |
RPAREN
|
static int |
SEMICOLON
|
Constructor Summary | |
Token(int t)
Construct a new Token with no attributes except its type. |
|
Token(int t,
int v)
Construct a new Token with an associated integer value attribute. |
|
Token(int t,
String s)
Construct a new Token with an associated String attribute. |
Method Summary | |
String |
getLabel()
Get the String attribute of this object. |
int |
getType()
Get the type of this Token. |
int |
getValue()
Get the integer attribute of this object. |
String |
toString()
Provide the String that describes this Token. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int EOF
public static final int ID
public static final int INT
public static final int KW_INT
public static final int KW_RETURN
public static final int KW_IF
public static final int KW_ELSE
public static final int KW_WHILE
public static final int OP_NOT
public static final int OP_EQ
public static final int OP_GT
public static final int OP_ADD
public static final int OP_SUB
public static final int OP_MUL
public static final int OP_ASSIGN
public static final int LPAREN
public static final int RPAREN
public static final int LCURLY
public static final int RCURLY
public static final int COMMA
public static final int SEMICOLON
Constructor Detail |
public Token(int t)
t
- the token type, one of the types defined by the Token class.public Token(int t, String s)
t
- the token type (probably Token.ID).s
- the actual String name of the idpublic Token(int t, int v)
t
- the token type (probably Token.INT).v
- the value of the integer that this token representsMethod Detail |
public int getType()
public String getLabel()
public int getValue()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |