|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmars.assembler.Token
public class Token
Represents one token in the input MIPS program. Each Token carries, along with its type and value, the position (line, column) in which its source appears in the MIPS program.
Constructor Summary | |
---|---|
Token(TokenTypes type,
String value,
MIPSprogram sourceMIPSprogram,
int line,
int start)
Constructor for Token class. |
Method Summary | |
---|---|
MIPSprogram |
getOriginalProgram()
Produces original program containing this token. |
int |
getOriginalSourceLine()
Produces original line number of this token. |
int |
getSourceLine()
Produces line number of MIPS program of this token. |
MIPSprogram |
getSourceMIPSprogram()
Produces MIPSprogram object associated with this token. |
int |
getStartPos()
Produces position within source line of this token. |
TokenTypes |
getType()
Produces token type of this token. |
String |
getValue()
Produces source code of this token. |
void |
setOriginal(MIPSprogram origProgram,
int origSourceLine)
Set original program and line number for this token. |
void |
setType(TokenTypes type)
Set or modify token type. |
String |
toString()
Get a String representing the token. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Token(TokenTypes type, String value, MIPSprogram sourceMIPSprogram, int line, int start)
type
- The token type that this token has. (e.g. REGISTER_NAME)value
- The source value for this token (e.g. $t3)sourceMIPSprogram
- The MIPSprogram object containing this tokenline
- The line number in source program in which this token appears.start
- The starting position in that line number of this token's source value.TokenTypes
Method Detail |
---|
public void setOriginal(MIPSprogram origProgram, int origSourceLine)
origProgram
- MIPS program containing this token.origSourceLine
- Line within that program of this token.public MIPSprogram getOriginalProgram()
public int getOriginalSourceLine()
public TokenTypes getType()
public void setType(TokenTypes type)
type
- new TokenTypes for this token.public String getValue()
public String toString()
toString
in class Object
public MIPSprogram getSourceMIPSprogram()
public int getSourceLine()
public int getStartPos()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |