-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtoken.h
49 lines (43 loc) · 879 Bytes
/
token.h
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
44
45
46
47
48
49
#ifndef TOKEN_H
#define TOKEN_H
#include <string>
#include "mytype.h"
class Token
{
public:
Token(const std::string str, ASTType ast_type=INVALID);
Token(){ast_type_ = INVALID;}
bool valid() const
{
if (ast_type_ == INVALID)
return false;
else
return true;
}
const std::string& str() const
{
return str_;
}
ASTType ast_type() const
{
return ast_type_;
}
std::string str_;
ASTType ast_type_;
private:
};
extern Token invalid_token;
extern Token then_block;
extern Token else_block;
extern Token g_var_token;
extern Token var_token;
extern Token para_token;
extern Token func_token;
extern Token func_call_token;
extern Token func_body_token;
extern Token prog_token;
extern Token true_token;
extern Token false_token;
extern Token while_token;
extern Token return_token;
#endif