Token.h 606 B

1234567891011121314151617181920212223242526272829303132333435
  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. void setType(TokenType type);
  19. TokenType getType() const;
  20. private:
  21. const TokenTypeClass* type;
  22. float f;
  23. string s;
  24. int line;
  25. };
  26. std::ostream& operator<< (std::ostream& stream, const Token& t);
  27. #endif