www.pudn.com > ParseAna.rar > Token.java
/**
* this class is used for storage a token information form lex analysis a token
* include three aspects information
*
* @author:ºØ¾²
* @version:1.2
*/
public class Token {
// the line number of current token
private int lineNum;
// the type of current token
private int type;
// the name of current token
private String name;
public Token() {
this.name = "";
}
public Token(String name, int type, int lineNum) {
this.name = name;
this.type = type;
this.lineNum = lineNum;
}
/**
* @return an int as the type of the token
*/
public int getType() {
return type;
}
/**
* @param lex
* for change current token's type
*/
public void setType(int lex) {
this.type = lex;
}
/**
* get then line number of the token
*/
public int getLineNum() {
return lineNum;
}
/*
* set the line number of the token
*/
public void setLineNum(int lineNum) {
this.lineNum = lineNum;
}
/*
* get the name of the token
*/
public String getName() {
return name;
}
/*
* set the name of the token
*/
public void setName(String name) {
this.name = name;
}
}