-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplateAutomaton.cpp
More file actions
33 lines (30 loc) · 1.06 KB
/
TemplateAutomaton.cpp
File metadata and controls
33 lines (30 loc) · 1.06 KB
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
#include "TemplateAutomaton.h"
// Returns the desired string to look for in the input which corresponds to the type of the automaton
std::string TemplateAutomaton::StrToFind() {
switch (type) {
case TokenType::COMMA: return ",";
case TokenType::PERIOD: return ".";
case TokenType::Q_MARK: return "?";
case TokenType::LEFT_PAREN: return "(";
case TokenType::RIGHT_PAREN: return ")";
case TokenType::MULTIPLY: return "*";
case TokenType::ADD: return "+";
case TokenType::SCHEMES: return "Schemes";
case TokenType::FACTS: return "Facts";
case TokenType::RULES: return "Rules";
case TokenType::QUERIES: return "Queries";
default: return "Error";
}
}
void TemplateAutomaton::S0(const std::string& input) {
for (char c : StrToFind()) {
if (input[index] == c) {
inputRead++;
index++;
}
else {
Serr();
break;
}
}
}