Initial Parser commit.
This commit is contained in:
parent
103268e959
commit
5adf3531ca
2 changed files with 74 additions and 0 deletions
63
Parser.cpp
Executable file
63
Parser.cpp
Executable file
|
@ -0,0 +1,63 @@
|
|||
//#include "main.cpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
bool password = true; // temp for a password needed function needed later.
|
||||
string pass = "admin";
|
||||
|
||||
void setPassword()
|
||||
{
|
||||
password = !password;
|
||||
}
|
||||
|
||||
vector<string> tokenize(string ss){
|
||||
string tempString;
|
||||
stringstream lineStream(ss);
|
||||
vector<string> output;
|
||||
|
||||
while (lineStream >> tempString){
|
||||
output.push_back(tempString);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
void parseCmd(vector<string> input){
|
||||
if(password){
|
||||
if(pass == input[0]){
|
||||
setPassword();
|
||||
cout << "Success." << endl;
|
||||
}
|
||||
else{
|
||||
cout << "Incorrect Password." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
string cmd = toupper(input[0]);
|
||||
|
||||
else if(cmd == ""){
|
||||
|
||||
}
|
||||
|
||||
else if(cmd == ""){
|
||||
|
||||
}
|
||||
|
||||
else if(cmd == ""){
|
||||
|
||||
}
|
||||
|
||||
else if(cmd == ""){
|
||||
|
||||
}
|
||||
|
||||
else if(cmd == ""){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void parse(string input){
|
||||
vector<string> listOfTokens = tokenize(input);
|
||||
parseCmd(listOfTokens);
|
||||
}
|
11
Parser.h
Normal file
11
Parser.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
//#include "main.cpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
void setPassword();
|
||||
vector<string> tokenize(string ss);
|
||||
void parseCmd();
|
||||
void parse(string input, DBEngine &engine)
|
||||
|
Reference in a new issue