mirror of https://github.com/djcb/mu.git
sexp: use fmt for parsing_error
Should help with Apple clang build too.
This commit is contained in:
parent
161f7df7b9
commit
e48485cb58
|
@ -27,19 +27,16 @@
|
||||||
|
|
||||||
using namespace Mu;
|
using namespace Mu;
|
||||||
|
|
||||||
__attribute__((format(printf, 2, 0))) static Mu::Error
|
template<typename...T> static Mu::Error
|
||||||
parsing_error(size_t pos, const char* frm, ...)
|
parsing_error(size_t pos, fmt::format_string<T...> frm, T&&... args)
|
||||||
{
|
{
|
||||||
va_list args;
|
const auto&& msg{fmt::format(frm, std::forward<T>(args)...)};
|
||||||
va_start(args, frm);
|
|
||||||
auto msg = vformat(frm, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
if (pos == 0)
|
if (pos == 0)
|
||||||
return Mu::Error(Error::Code::Parsing, "{}", msg);
|
return Mu::Error(Error::Code::Parsing, "{}", msg);
|
||||||
else
|
else
|
||||||
return Mu::Error(Error::Code::Parsing, "{}: {}", pos, msg);
|
return Mu::Error(Error::Code::Parsing, "{}: {}", pos, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
skip_whitespace(const std::string& s, size_t pos)
|
skip_whitespace(const std::string& s, size_t pos)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue