| 166 | pos += 5; |
| 167 | return; |
| 168 | } |
| 169 | if (text.compare(pos, 4, "null") == 0) { |
| 170 | pos += 4; |
| 171 | return; |
| 172 | } |
| 173 | throw std::runtime_error("unsupported json value while skipping"); |
| 174 | } |
| 175 | |
| 176 | std::unordered_map<std::string, std::string> parse_string_map(const std::string & text, size_t & pos) { |
| 177 | std::unordered_map<std::string, std::string> values; |
| 178 | expect_char(text, pos, '{'); |
| 179 | while (true) { |
| 180 | skip_ws(text, pos); |
| 181 | if (pos < text.size() && text[pos] == '}') { |
| 182 | ++pos; |
| 183 | return values; |
| 184 | } |
| 185 | const auto key = parse_string(text, pos); |
| 186 | expect_char(text, pos, ':'); |
| 187 | const auto value = parse_string(text, pos); |
| 188 | values.emplace(key, value); |
| 189 | skip_ws(text, pos); |
| 190 | if (pos < text.size() && text[pos] == ',') { |
| 191 | ++pos; |
| 192 | continue; |
| 193 | } |
| 194 | if (pos < text.size() && text[pos] == '}') { |
| 195 | ++pos; |
no test coverage detected