mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-08 02:28:15 +00:00
Make parse_arg_id more readable
This commit is contained in:
parent
092d2dc7b2
commit
404a880bd4
@ -2328,16 +2328,22 @@ FMT_CONSTEXPR const Char* parse_arg_id(const Char* begin, const Char* end,
|
||||
IDHandler&& handler) {
|
||||
FMT_ASSERT(begin != end, "");
|
||||
Char c = *begin;
|
||||
if (c == '}' || c == ':') return handler(), begin;
|
||||
if (c == '}' || c == ':') {
|
||||
handler();
|
||||
return begin;
|
||||
}
|
||||
if (c >= '0' && c <= '9') {
|
||||
int index = parse_nonnegative_int(begin, end, handler);
|
||||
if (begin == end || (*begin != '}' && *begin != ':'))
|
||||
return handler.on_error("invalid format string"), begin;
|
||||
handler.on_error("invalid format string");
|
||||
else
|
||||
handler(index);
|
||||
return begin;
|
||||
}
|
||||
if (!is_name_start(c))
|
||||
return handler.on_error("invalid format string"), begin;
|
||||
if (!is_name_start(c)) {
|
||||
handler.on_error("invalid format string");
|
||||
return begin;
|
||||
}
|
||||
auto it = begin;
|
||||
do {
|
||||
++it;
|
||||
|
Loading…
Reference in New Issue
Block a user