mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-07-29 01:52:51 +00:00
fix langth for json in shuntingyard, do not remove emty strings
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user