-
Notifications
You must be signed in to change notification settings - Fork 0
/
TokenizerTest.cpp
44 lines (37 loc) · 1.04 KB
/
TokenizerTest.cpp
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
#define TokenizerTest
#ifdef TokenizerTest
#include <cstdio>
#include "Tokenizer.h"
int main() {
Tokenizer tokenizer;
FILE* InputStr;
FILE* InputKey;
freopen_s(&InputKey, "Tokenizer_test_InputKey.txt", "r", stdin);
//freopen_s(&InputStr, "Tokenizer_test_InputStr.txt", "r", stdin);
std::vector<KeyWordPack> keyWordList;
std::string tmpValue;
std::string tmpType;
int tmpInt;
while (std::cin >> tmpValue) {
std::cin >> tmpType;
std::cin >> tmpInt;
keyWordList.push_back(KeyWordPack(tmpType, tmpValue, tmpInt));
//std::cout << "[ " << tmpValue << "| " << tmpType << "| " << tmpInt << "]" << std::endl;
}
std::cin.clear();
freopen_s(&InputStr, "Tokenizer_test_InputStr.txt", "r", stdin);
std::string str;
getline(std::cin, str);
TokenizerRet unit;
tokenizer.load_map_data(keyWordList);
tokenizer.printAllInfo();
std::cout << std::endl;
std::cout << "Input: " << str << '\n';
while (unit.type() != "#OVER#" && unit.type() != "#ERROR#") {
unit = tokenizer.run(str);
unit.printAllInfo();
std::cout << '\n';
}
return 0;
}
#endif