From 4afb4310440451d37ee5e1679e4d8e1b1e84da91 Mon Sep 17 00:00:00 2001 From: William Bracho Blok Date: Tue, 22 Sep 2015 16:18:52 -0500 Subject: [PATCH] Create Parserv2 --- Parserv2 | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 Parserv2 diff --git a/Parserv2 b/Parserv2 new file mode 100644 index 0000000..af89934 --- /dev/null +++ b/Parserv2 @@ -0,0 +1,175 @@ + +#include // std::string +#include // std::cout +#include // std::stringstream +#include +#include + +using namespace std; + +/* + as of now, this parser can take a string and break it into tokens +*/ + + +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) +{ + // if (input[0] != "(") + // { + // cout<<"ERROR! missing parenthesis"< input) +{ + cout<<"TokenList: "< input) +{ + string relationName; + + cout<<"insert-cmd function was called"< input) //calls par_command() or par_query() depending on first item from token list +{ +/* +• Match the first item in the token list and determine weather this is a command or a query. +• Call functions par_command() or par_query(); +• After either par_command() or par_query() returns, make sure the line ends properly with “;” token +*/ + string tempChar = input.back(); + if (tempChar != ";") + { + cout<<"ERROR! missing semicolon "< listOfTokens = tokenize(ss); + par_line(listOfTokens); + + +}