Initial Parser commit.

This commit is contained in:
Alexander Huddleston 2015-10-12 17:19:07 -05:00
parent 103268e959
commit 5adf3531ca
2 changed files with 74 additions and 0 deletions

63
Parser.cpp Executable file
View 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
View 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)