| 2177 | |
| 2178 | template <class KeyEndFinder, class KeyPartHandler> |
| 2179 | std::string |
| 2180 | parse_key(std::string::iterator& it, const std::string::iterator& end, |
| 2181 | KeyEndFinder&& key_end, KeyPartHandler&& key_part_handler) |
| 2182 | { |
| 2183 | // parse the key as a series of one or more simple-keys joined with '.' |
| 2184 | while (it != end && !key_end(*it)) |
| 2185 | { |
| 2186 | auto part = parse_simple_key(it, end); |
| 2187 | consume_whitespace(it, end); |
| 2188 | |
| 2189 | if (it == end || key_end(*it)) |
| 2190 | { |
| 2191 | return part; |
| 2192 | } |
| 2193 | |
| 2194 | if (*it != '.') |
| 2195 | { |
| 2196 | std::string errmsg{"Unexpected character in key: "}; |
| 2197 | errmsg += '"'; |
| 2198 | errmsg += *it; |
| 2199 | errmsg += '"'; |
| 2200 | throw_parse_exception(errmsg); |
| 2201 | } |
| 2202 | |
| 2203 | key_part_handler(part); |
| 2204 | |
| 2205 | // consume the dot |
| 2206 | ++it; |
| 2207 | } |
| 2208 | |
| 2209 | throw_parse_exception("Unexpected end of key"); |
| 2210 | } |
| 2211 | |
| 2212 | std::string parse_simple_key(std::string::iterator& it, |
| 2213 | const std::string::iterator& end) |
no test coverage detected