More work on better parser logging.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-01-06 13:32:06 +01:00
parent 034dcb118b
commit da82819fff
4 changed files with 217 additions and 180 deletions

20
extern/format.hpp vendored
View File

@@ -41,9 +41,12 @@ namespace util {
char* endptr = nullptr;
index = strtol(&item[0], &endptr, 10);
if (index < 0 || index >= (int)args.size()) {
if (index >= (int)args.size()) {
return;
}
if (index < 0) {
index = args.size() + index;
}
if (*endptr == ',') {
alignment = strtol(endptr + 1, &endptr, 10);
@@ -57,8 +60,21 @@ namespace util {
if (*endptr == ':') {
fmt = endptr + 1;
}
if (*endptr == '.' && *(endptr + 1) == '.') {
auto endIndex = strtol(endptr + 2, &endptr, 10);
if (endIndex < 0) {
endIndex = args.size() + endIndex + 1;
}
args[index]->Format(ss, fmt);
for (; index < endIndex; index++) {
args[index]->Format(ss, fmt);
if (index != endIndex - 1) {
ss << ", ";
}
}
} else {
args[index]->Format(ss, fmt);
}
return;
}