-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
35 lines (30 loc) · 1.07 KB
/
main.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
#include <iostream>
#include "headerFiles/lexer.h"
#include "headerFiles/commandMap.h"
#include <stdint.h>
#include <bits/stdc++.h>
using namespace std;
int main()
{
// get the text from the lexer
pair<vector<vector<string>>, vector<vector<string>>> myPair = Lexer::getinstance().lexingMethod("my_file.txt");
vector<vector<string>> mainVec = myPair.first;
// loop over each vector (AKA line)
for (int i = 0; i < mainVec.size(); i++)
{
vector<string> line = mainVec[i];
// sending the command word to activate its command class via the command map,
// and fedding the polimorphic "do command" whith the entire line of text
// checking if the command is not in the command map (that means it is a set type)
CommandMap commandMapInstance;
if (commandMapInstance.umap.find(line[0]) == commandMapInstance.umap.end())
{
commandMapInstance.umap["set"]->doCommand({line});
}
else
{
commandMapInstance.umap[line[0]]->doCommand({line});
}
}
return 0;
}