diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2016-08-31 18:59:42 +0000 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2016-08-31 18:59:42 +0000 |
| commit | 251a9af5e8c4976373b71935457d1ce17c6888a1 (patch) | |
| tree | 33313df7f059bbf3a825d83d7ef0273b2ec012c2 /parser.cpp | |
| parent | c59f10a0b0f58840c02327fc602a681c5410b212 (diff) | |
Add token class
Diffstat (limited to 'parser.cpp')
| -rw-r--r-- | parser.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1,9 +1,10 @@ #include "parser.h" #include <string> #include <vector> +#include "token.h" Parser::Parser(std::string& input) { - std::vector<std::string> result; + std::vector<Token> result; bool isString = false; std::string tmp; @@ -14,7 +15,8 @@ Parser::Parser(std::string& input) { } if (c == '"' && isString) { - result.push_back(tmp); + Token token(tmp, true); + result.push_back(token); tmp = ""; isString = false; continue; @@ -22,7 +24,8 @@ Parser::Parser(std::string& input) { if (!isString) { std::string parsed(1, c); - result.push_back(parsed); + Token token(parsed, false); + result.push_back(token); } else { tmp += c; |
