Token.h 560 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef TOKEN_H
  2. #define TOKEN_H
  3. #include "TokenType.h"
  4. #include <string>
  5. using namespace std;
  6. class Token
  7. {
  8. public:
  9. Token(TokenType type, int line);
  10. virtual ~Token();
  11. void setFloat(float f);
  12. void setBool(bool b);
  13. void setString(string s);
  14. float getFloat() const;
  15. bool getBool() const;
  16. string getString() const;
  17. int getLine() const;
  18. TokenType getType() const;
  19. private:
  20. TokenType type;
  21. float f;
  22. string s;
  23. int line;
  24. };
  25. std::ostream& operator<< (std::ostream& stream, const Token& t);
  26. #endif