-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscan.hpp
51 lines (45 loc) · 1006 Bytes
/
scan.hpp
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
50
51
/* Definitions the scanner shares with the parser.
Michael L. Scott, 2008-2022.
*/
#include <tuple>
#include <string>
using std::string;
using std::tuple;
enum token { t_read,
t_write,
t_id,
t_gets,
t_add,
t_sub,
t_mul,
t_div,
t_lparen,
t_rparen,
t_eof,
t_semicolon,
t_int,
t_assign,
t_real,
t_if,
t_then,
t_end,
t_while,
t_do,
t_inum,
t_rnum,
t_trunc,
t_float,
t_equal,
t_notEqual,
t_larger,
t_smaller,
t_largerEqual,
t_smallerEqual };
const int MAX_TOKEN_LEN = 256;
extern char token_image[MAX_TOKEN_LEN];
class scanner {
int c = ' ';
public:
tuple<token, string> scan();
};
extern bool CalculatorErrorDetect;