-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParcer.h
37 lines (30 loc) · 963 Bytes
/
Parcer.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
#pragma once
#include <iostream>
#include <string.h>
#include <cstring>
#include <string>
#include <algorithm>
#include "../BPlus Tree Based Maps/Map.h"
#include "../BPlus Tree Based Maps/MMap.h"
#include "STokenizer/STokenizer.h"
#include "STokenizer/StateMachine.h"
using namespace std;
enum KEYWORDS : int { SYMBOL = 1, SEARCH = 2, STAR = 3, FROM = 4, COMMA = 5, AND = 15, SELECT = 11, TABLE = 20, FIELDS = 21
, WHERE = 6, INSERT = 7, INTO = 8, DELETE = 9, CREATE = 10, MAKE = 10, OR = 14, VALUES = 21, BATCH = 30, DROP = 19
};
class Parcer
{
public:
Parcer();
Parcer(const string& command);
void set_command(const string& command);
bool ptree(MMap<string, string>& map);
private:
string _command;
STokenizer _tokenizer;
Map<string, int> _keyword_table;
static int _states[MAXROW][MAXCOL];
void _initialize_machine(int _state[][MAXCOL]);
void _fill_keyword_table();
void Uppercased(string& str);
};