2019-05-18 18:35:51 +00:00
|
|
|
#ifndef PORYGONLANG_TOKEN_HPP
|
|
|
|
#define PORYGONLANG_TOKEN_HPP
|
|
|
|
|
|
|
|
#include "TokenKind.hpp"
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-05-18 18:35:51 +00:00
|
|
|
#endif //PORYGONLANG_TOKEN_HPP
|