43 lines
810 B
Java
43 lines
810 B
Java
package be.jeffcheasey88.peeratcode.parser;
|
|
|
|
public class Token{
|
|
|
|
private int line;
|
|
private int character;
|
|
private TokenType type;
|
|
|
|
private String value;
|
|
|
|
public Token(int line, int character, String value, TokenType type){
|
|
this.line = line;
|
|
this.character = character;
|
|
this.value = value;
|
|
this.type = type;
|
|
}
|
|
|
|
public int getLineNumber(){
|
|
return this.line;
|
|
}
|
|
|
|
public int getCharacterNumber(){
|
|
return this.character;
|
|
}
|
|
|
|
public TokenType getType(){
|
|
return this.type;
|
|
}
|
|
|
|
public String getValue(){
|
|
return this.value;
|
|
}
|
|
|
|
//line & character start & end ?
|
|
public Token concat(Token token){
|
|
return new Token(line, character, value+token.getValue(), TokenType.GROUP);
|
|
}
|
|
|
|
@Override
|
|
public String toString(){
|
|
return "Token["+line+";"+character+";"+type+";"+value+"]";
|
|
}
|
|
}
|