sexp: use fmt for parsing_error

Should help with Apple clang build too.
This commit is contained in:
Dirk-Jan C. Binnema 2023-07-05 23:40:36 +03:00
parent 161f7df7b9
commit e48485cb58
1 changed files with 4 additions and 7 deletions

View File

@ -27,19 +27,16 @@
using namespace Mu;
__attribute__((format(printf, 2, 0))) static Mu::Error
parsing_error(size_t pos, const char* frm, ...)
template<typename...T> static Mu::Error
parsing_error(size_t pos, fmt::format_string<T...> frm, T&&... args)
{
va_list args;
va_start(args, frm);
auto msg = vformat(frm, args);
va_end(args);
const auto&& msg{fmt::format(frm, std::forward<T>(args)...)};
if (pos == 0)
return Mu::Error(Error::Code::Parsing, "{}", msg);
else
return Mu::Error(Error::Code::Parsing, "{}: {}", pos, msg);
}
static size_t
skip_whitespace(const std::string& s, size_t pos)
{