fix langth for json in shuntingyard, do not remove emty strings

This commit is contained in:
MichaelDvP
2026-07-13 15:04:57 +02:00
parent bc960980eb
commit a80ec9cf7e

View File

@@ -42,17 +42,8 @@ std::deque<Token> exprToTokens(const std::string & expr) {
i += (*p == '{') ? 1 : (*p == '}') ? -1 : 0; i += (*p == '{') ? 1 : (*p == '}') ? -1 : 0;
++p; ++p;
} }
if (*p) { const auto s = std::string(b, p);
++p; tokens.emplace_back(Token::Type::String, s, -3);
}
// Use string_view to avoid unnecessary string copies
std::string_view s(b, p - b);
auto n = s.find("\"\"");
while (n != std::string_view::npos) {
s.remove_prefix(n + 2);
n = s.find("\"\"");
}
tokens.emplace_back(Token::Type::String, std::string(s), -3);
if (*p == '\0') { if (*p == '\0') {
--p; --p;
} }