26 lines
635 B
C
26 lines
635 B
C
|
#ifndef TOKEN_H
|
||
|
#define TOKEN_H
|
||
|
#include <string>
|
||
|
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
typedef enum { t_invalid_token=0, t_symbol, t_integer, t_literal,
|
||
|
t_punctuation, t_keyword, t_operator, t_float } type_of_token; //t_float not implemented
|
||
|
//TODO implement t_float in lexer
|
||
|
|
||
|
|
||
|
class Token
|
||
|
{
|
||
|
public:
|
||
|
type_of_token type;
|
||
|
string value;
|
||
|
Token() : type(t_invalid_token), value("") {};
|
||
|
Token(type_of_token type, string value) : type(type), value(value) { };
|
||
|
type_of_token get_type() { return type; };
|
||
|
string get_value() { return value; };
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // TOKEN_H
|