MCPcopy Create free account
hub / github.com/dhbloo/rapfi / parse_key

Function parse_key

Rapfi/external/cpptoml/include/cpptoml.h:2179–2210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)

Callers 3

parse_single_tableFunction · 0.85
parse_table_arrayFunction · 0.85
parse_key_valueFunction · 0.85

Calls 3

parse_simple_keyFunction · 0.85
consume_whitespaceFunction · 0.85
throw_parse_exceptionFunction · 0.85

Tested by

no test coverage detected