-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.hpp
More file actions
38 lines (30 loc) · 834 Bytes
/
token.hpp
File metadata and controls
38 lines (30 loc) · 834 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
#ifndef _TOKEN_HPP_
#define _TOKEN_HPP_
using namespace std;
//Token kind
typedef enum {
T_NUM, //int value
T_RESERVED, //symbols
T_IDENT, //identifier
T_EOF, //end token
}TokenKind;
//Operation list
static const char* symbols[] ={
"=",
"&&","||",
"!=","==",
"<","<=",">",">=",
"<<",">>",
"+","-",
"*","/","%",
"!",
"(",")","[","]","{","}",};
//Token class
class Token{
public:
TokenKind token;
string str;
Token(TokenKind token,const char* p,int len);
void print(void);
};
#endif