-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrexparser.h
More file actions
34 lines (26 loc) · 801 Bytes
/
Copy pathrexparser.h
File metadata and controls
34 lines (26 loc) · 801 Bytes
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
//
// Created by hesham on 3/21/18.
//
#ifndef KOMPILER_REXPARSER_H
#define KOMPILER_REXPARSER_H
#include <string>
#include <stack>
#include "machine.h"
struct machine_stacks {
std::string identifier;
bool is_operator;
};
class rexparser {
private:
std::map<std::string, machine> machines;
std::vector<machine> regex;
void process_line (const std::string line);
machine handler_regular (const std::string line);
void handler_reserved (const std::string line);
bool isseparator (char c);
machine get_hashed_machine (std::string, std::map<std::string, machine> &machines);
void push_to_stack (std::string s, std::stack<machine_stacks> &stk, std::map<std::string, machine> &_machines);
public:
machine rules2nfa (const std::string rules);
};
#endif //KOMPILER_REXPARSER_H