#include <sstream>
#include "Token.h"


std::string Token::toString() const {
  std::stringstream strm;
  static char symbol[] = {'(', ')', '+', '-', '*', '/'};
  if (type == NUMERIC)
    strm << value;
  else if (type < NUMERIC) 
    strm << symbol[type];

  return strm.str();
}

/*
 * print token
 */
std::ostream& operator<<(std::ostream& out, const Token& t) {
  out << t.toString();
  return out;
}

