| 2334 | |
| 2335 | template <typename Char, typename IDHandler> |
| 2336 | FMT_CONSTEXPR const Char* parse_arg_id(const Char* begin, const Char* end, |
| 2337 | IDHandler&& handler) { |
| 2338 | FMT_ASSERT(begin != end, ""); |
| 2339 | Char c = *begin; |
| 2340 | if (c == '}' || c == ':') { |
| 2341 | handler(); |
| 2342 | return begin; |
| 2343 | } |
| 2344 | if (c >= '0' && c <= '9') { |
| 2345 | int index = 0; |
| 2346 | if (c != '0') |
| 2347 | index = parse_nonnegative_int(begin, end, handler); |
| 2348 | else |
| 2349 | ++begin; |
| 2350 | if (begin == end || (*begin != '}' && *begin != ':')) |
| 2351 | handler.on_error("invalid format string"); |
| 2352 | else |
| 2353 | handler(index); |
| 2354 | return begin; |
| 2355 | } |
| 2356 | if (!is_name_start(c)) { |
| 2357 | handler.on_error("invalid format string"); |
| 2358 | return begin; |
| 2359 | } |
| 2360 | auto it = begin; |
| 2361 | do { |
| 2362 | ++it; |
| 2363 | } while (it != end && (is_name_start(c = *it) || ('0' <= c && c <= '9'))); |
| 2364 | handler(basic_string_view<Char>(begin, to_unsigned(it - begin))); |
| 2365 | return it; |
| 2366 | } |
| 2367 | |
| 2368 | // Adapts SpecHandler to IDHandler API for dynamic width. |
| 2369 | template <typename SpecHandler, typename Char> struct width_adapter { |
no test coverage detected