diff options
Diffstat (limited to 'parser.cpp')
| -rw-r--r-- | parser.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -5,8 +5,27 @@ Parser::Parser(std::string& input) { std::vector<std::string> result; + bool isString = false; + std::string tmp; for (auto& c : input) { - std::string parsed(1, c); - result.push_back(parsed); + if (c == '"' && !isString) { + isString = true; + continue; + } + + if (c == '"' && isString) { + result.push_back(tmp); + tmp = ""; + isString = false; + continue; + } + + if (!isString) { + std::string parsed(1, c); + result.push_back(parsed); + } + else { + tmp += c; + } } } |
