-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathToken.hpp
More file actions
43 lines (33 loc) · 750 Bytes
/
Copy pathToken.hpp
File metadata and controls
43 lines (33 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef TOKEN_H
#define TOKEN_H
#include <string>
#include "FilePosition.hpp"
#define STRINGIFY(x) #x
enum TokenType {
INTEGER_TOK,
FLOAT_TOK,
STRING_TOK,
CHAR_TOK,
OPERATOR_TOK,
DOUBLE_OPERATOR_TOK,
KEYWORD_TOK,
IDENTIFIER_TOK,
SEPARATOR_TOK,
SEMICOLON_TOK,
INVALID_TOK
};
class Token {
private:
TokenType type;
std::string tok;
FilePosition pos;
public:
Token(TokenType t, std::string s, FilePosition position);
std::string getType();
std::string getToken() {return tok;}
FilePosition getPos() {return pos;}
std::string toString();
bool operator==(Token rhs);
bool operator!=(Token rhs);
};
#endif