Handle nested braces in join (#638)
This commit is contained in:
1 parent
c719d94473
commit
6822466aa3
2 files changed
+15
-9
No files matched your search
+7
-3
@@ -4111,10 +4111,14 @@ template <typename ArgFormatter, typename Char, typename It>
|
||||
void format_arg(fmt::BasicFormatter<Char, ArgFormatter> &f,
|
||||
const Char *&format_str, const ArgJoin<Char, It>& e) {
|
||||
const Char* end = format_str;
|
||||
if (*end == ':')
|
||||
++end;
|
||||
while (*end && *end != '}')
|
||||
int brace_level = 1;
|
||||
while (*end) {
|
||||
if (*end == '}' && --brace_level == 0)
|
||||
break;
|
||||
if (*end == '{')
|
||||
++brace_level;
|
||||
++end;
|
||||
}
|
||||
if (*end != '}')
|
||||
FMT_THROW(FormatError("missing '}' in format string"));
|
||||
|
||||
|
||||
Reference in new issue
Block a user