Handle nested braces in join (#638)

This commit is contained in:
Victor Zverovich committed 2018-01-20 06:26:22 -08:00
1 parent c719d94473
commit 6822466aa3
2 files changed
+15 -9

No files matched your search

+7 -3
View File
@@ -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"));