-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScanner.h
47 lines (32 loc) · 843 Bytes
/
Scanner.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
//
// Created by Taemin Park on 1/11/16.
//
#ifndef ADV_COMPILER_SCANNER_H
#define ADV_COMPILER_SCANNER_H
#include "FileReader.h"
using namespace std;
typedef enum {
STAT_START, STAT_NUM, STAT_ID, STAT_EQ, STAT_NE, STAT_L, STAT_R, STAT_DONE, STAT_COMMENT, STAT_SLASH
}StateType;
class Scanner {
public:
Scanner(){number = 0; id = errToken;};
~Scanner(){
FileReader *fileReader = FileReader::instance();
delete fileReader;
_scanner = 0;
};
static Scanner* instance();
TokenType GetSym();
int number;
std::string id;
void Error(std::string state, std::string missingChar);
RC openFile(const std::string &fileName);
RC closeFile();
private:
char inputSym;
void Next();
void Previous();
static Scanner *_scanner;
};
#endif //ADV_COMPILER_SCANNER_H