/*
 * Token.java
 *
 * Created on October 29, 2005, 8:10 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package cz.pcland.functions.lexan;

/**
 *
 * @author petr
 */
import java.util.*;


public class Token {
    int type;
    
    /** Creates a new instance of Token */
    public Token(int _type) {
        type=_type;
    }
    public int getType() {return type;}
    
    public String print() {
        String ret = "";
        if(type == TokenType.TOKEN_NUMBER) ret = "TOKEN_NUMBER" + " <" +((NumberToken)this).getValue() + ">";
        if(type == TokenType.TOKEN_VARIABLE) ret = "TOKEN_VARIABLE " + " <" +((VariableToken)this).getValue() + ">";
        if(type == TokenType.TOKEN_PLUS) ret ="TOKEN_PLUS" ;
        if(type == TokenType.TOKEN_MINUS) ret = "TOKEN_MINUS ";
        if(type == TokenType.TOKEN_ASTERISK) ret = "TOKEN_ASTERISK";
        if(type == TokenType.TOKEN_CLOSE_PARENTHESIS) ret = "TOKEN_LEFT_PARENTHESIS";
        if(type == TokenType.TOKEN_OPEN_PARENTHESIS) ret = "TOKEN_RIGHT_PARENTHESIS";
        if(type == TokenType.TOKEN_END) ret = "TOKEN_END";
        if(type == TokenType.TOKEN_SLASH) ret = "TOKEN_SLASH";
     
        if(type == TokenType.TOKEN_STRING) ret = "TOKEN_STRING" + " <" + ((StringToken)this).getValue() + ">";
        if(type == TokenType.TOKEN_POWER) ret = "TOKEN_POWER";
        if(type == TokenType.TOKEN_COMMA) ret = "TOKEN_COMMA";
        if(type == TokenType.TOKEN_EQUAL) ret = "TOKEN_EQUAL";
        if(type == TokenType.TOKEN_UNKNOWN) ret = "TOKEN_UNKNOWN";
        if(type == TokenType.TOKEN_SCREAMER) ret = "TOKEN_SCREAMER";
        if(type == TokenType.TOKEN_POINT) ret = "TOKEN_POINT";
        if(type == TokenType.TOKEN_FUNCTION) ret = "TOKEN_FUNCTION" + " <" +((FunctionToken)this).getValue() + ">";
        
        return ret;
    }
}


