import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public class Token {
    static enum Type { NAME, KEYWORD, NUMBER, SYMBOL, EOL, EOF };

    private static final String[] KEYWORD_LIST = new String[] {
        "move", "turn", "take", "drop", "zap",
        "repeat", "while", "if", "else", "return", 
        "north", "east", "south", "west", "left", "right", "around",
        "WALL", "ENEMY", "FUEL", "ARMOR", "ZAP_GUN",
        "seeing", "smelling", "facing", "distance", "and", "or", "not",
        "define", "end" };
    
    public static final Set KEYWORDS = new HashSet(Arrays.asList(KEYWORD_LIST));

    Type type;
    String value;

    Token(Type type, String value) {
        this.type = type;
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (o instanceof Token) {
            Token that = (Token) o;
            return this.type == that.type && this.value.equals(that.value);
        }
        else return false;
    }

    @Override
    public String toString() {
        return value;
    }
}

