diff --git a/Parserv2.cpp b/Parserv2.cpp deleted file mode 100755 index cb848f3..0000000 --- a/Parserv2.cpp +++ /dev/null @@ -1,196 +0,0 @@ -#include -#include -#include -#include -#include - -using namespace std; - - -vector tokenize(string ss) -{ - string tempString; - stringstream lineStream(ss); - vector output; - - while (lineStream >> tempString) - { - output.push_back(tempString); - } - - //testing--------------- - cout<<"TokenList: "; - - for (int i = 0; i input) -{ - cout<<"TokenList: "< insertCMD(vector input) -{ - //relation name will be the first element of the vector of data returned by this function - vector output; - - if (input[0] == "INTO") - { - input.erase(input.begin()); - - output.push_back(input[0]); //pushing relation name - - input.erase(input.begin()); - - if (input[0] == "VALUES" && input[1] == "FROM") - { - input.erase(input.begin()); - input.erase(input.begin()); - - - if(input[0] == "(") - { - input.erase(input.begin()); - - while(input[0] != ")") //inserting all values to relation - //for (int i = 0; i < 2; ++i) - { - if (input[0] == ",") input.erase(input.begin()); - - output.push_back(input[0]); - - input.erase(input.begin()); - } - - return output; - - } - - else cout<<"Syntax error!"< showCMD(vector input) -{ - if (input.size() > 3) - { - cout<<"Syntax error!"< exitCMD(vector input) -{ - if (input[1] != ";") - { - cout<<"ERROR: missing semicolon!"< createCMD(vector input) -{ - if (input[0] != "CREATE") { - cout << "Error: create keyword is missing." < openCMD(vector input){ - if (input[0] != "OPEN") { - cout << "Error: open keyword is missing." < closeCMD(vector input){ - if (input[0] != "CLOSE") { - cout << "Error: close keyword is missing." < saveCMD(vector input){ - if (input[0] != "SAVE") { - cout << "Error: save keyword is missing." < updateCMD(vector input){ - //UPDATE relation-name SET attribute-name = literal { , attribute-name = literal } WHERE condition -} - -vector deleteCMD(vector input){ - //DELETE FROM relation-name WHERE condition - if (input[0] != "DELETE") { - cout << "Error: save keyword is missing." < listOfTokens = tokenize(s); - deleteCMD(listOfTokens); -} \ No newline at end of file