blob: 91e40679182961e9b58fa94dd2318edab2b1a985 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include "parser.h"
#include <string>
#include <vector>
Parser::Parser(std::string& input) {
std::vector<std::string> result;
bool isString = false;
std::string tmp;
for (auto& c : input) {
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;
}
}
}
|