| 58 | } |
| 59 | |
| 60 | std::vector<int64_t> parse_int_array(const std::string & text, size_t & pos) { |
| 61 | skip_ws(text, pos); |
| 62 | if (pos >= text.size() || text[pos] != '[') { |
| 63 | throw std::runtime_error("expected '['"); |
| 64 | } |
| 65 | ++pos; |
| 66 | std::vector<int64_t> values; |
| 67 | while (true) { |
| 68 | skip_ws(text, pos); |
| 69 | if (pos < text.size() && text[pos] == ']') { |
| 70 | ++pos; |
| 71 | return values; |
| 72 | } |
| 73 | values.push_back(parse_int64(text, pos)); |
| 74 | skip_ws(text, pos); |
| 75 | if (pos < text.size() && text[pos] == ',') { |
| 76 | ++pos; |
| 77 | continue; |
| 78 | } |
| 79 | if (pos < text.size() && text[pos] == ']') { |
| 80 | ++pos; |
| 81 | return values; |
| 82 | } |
| 83 | throw std::runtime_error("invalid integer array"); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void expect_char(const std::string & text, size_t & pos, char expected) { |
| 88 | skip_ws(text, pos); |
no test coverage detected