|
|
@@ -48,11 +48,14 @@ std::vector<std::string> tokenizer::operator()(std::string const &input) const {
|
|
|
std::size_t from = 0;
|
|
|
bool in_quote{false};
|
|
|
for (std::size_t pos = 0; pos < input.size() && rval.size() < max; ++pos) {
|
|
|
- if (input.find(divider_.c_str(), pos, divider_.size()) != pos || in_quote) {
|
|
|
+ if (input[pos] == quote_.on) {
|
|
|
+ in_quote = !in_quote;
|
|
|
+ } else if (input.find(divider_.c_str(), pos, divider_.size()) != pos ||
|
|
|
+ in_quote) {
|
|
|
buffer.append(1, input[pos]);
|
|
|
} else if (escapable_ && countback(input, pos, '\\') % 2) {
|
|
|
buffer.back() = input[pos];
|
|
|
- } else {
|
|
|
+ } else if (!in_quote) {
|
|
|
if (!ignore_empty_tokens_ || buffer.size()) {
|
|
|
rval.emplace_back(buffer);
|
|
|
}
|