PorygonLang/src/Parser/Token.hpp

67 lines
1.1 KiB
C++
Raw Normal View History

2019-05-18 18:35:51 +00:00
#ifndef PORYGONLANG_TOKEN_HPP
#define PORYGONLANG_TOKEN_HPP
#include <utility>
#include <string>
2019-05-18 18:35:51 +00:00
#include "TokenKind.hpp"
using namespace std;
2019-05-18 18:35:51 +00:00
class IToken{
public:
virtual TokenKind GetKind() = 0;
};
class SimpleToken : public IToken{
public:
TokenKind Kind;
explicit SimpleToken(TokenKind type){
Kind = type;
}
TokenKind GetKind() override{
return Kind;
}
};
class IntegerToken : public IToken{
public:
long Value;
explicit IntegerToken(long value){
Value = value;
}
TokenKind GetKind() override{
return TokenKind::Integer;
}
};
2019-05-19 10:49:26 +00:00
class FloatToken : public IToken{
public:
double Value;
explicit FloatToken(double value){
Value = value;
}
TokenKind GetKind() override{
return TokenKind::Float;
}
};
class IdentifierToken : public IToken{
public:
string Value;
explicit IdentifierToken(string value){
Value = std::move(value);
}
TokenKind GetKind() override{
return TokenKind::Identifier;
}
};
2019-05-18 18:35:51 +00:00
#endif //PORYGONLANG_TOKEN_HPP