mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 17:58:09 +08:00
Merge branch 'master' into string-view
This commit is contained in:
@@ -73,6 +73,9 @@ inline ::toml::value operator""_toml(const char* str, std::size_t len)
|
||||
if(auto data = ::toml::detail::parse_toml_file(loc))
|
||||
{
|
||||
loc.reset(loc.begin()); // rollback to the top of the literal
|
||||
// skip needless characters for error message
|
||||
skip_line::invoke(loc); // skip the first several needless lines
|
||||
skip_ws::invoke(loc); // skip the first several needless whitespaces
|
||||
return ::toml::value(std::move(data.unwrap()),
|
||||
::toml::detail::region<std::vector<char>>(std::move(loc)));
|
||||
}
|
||||
|
@@ -1406,10 +1406,16 @@ parse_inline_table(location<Container>& loc)
|
||||
return ok(std::make_pair(
|
||||
retval, region<Container>(loc, first, loc.iter())));
|
||||
}
|
||||
else if(*loc.iter() == '#' || *loc.iter() == '\r' || *loc.iter() == '\n')
|
||||
{
|
||||
throw syntax_error(format_underline("[error] "
|
||||
"toml::parse_inline_table: missing curly brace `}`",
|
||||
{{std::addressof(loc), "should be `}`"}}));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw syntax_error(format_underline("[error] "
|
||||
"toml:::parse_inline_table: missing table separator `,` ",
|
||||
"toml::parse_inline_table: missing table separator `,` ",
|
||||
{{std::addressof(loc), "should be `,`"}}));
|
||||
}
|
||||
}
|
||||
|
@@ -343,7 +343,8 @@ inline std::string format_underline(const std::string& message,
|
||||
{
|
||||
// invalid
|
||||
// ~~~~~~~
|
||||
retval << make_string(reg->size(), '~');
|
||||
const auto underline_len = std::min(reg->size(), reg->line().size());
|
||||
retval << make_string(underline_len, '~');
|
||||
}
|
||||
|
||||
retval << ' ';
|
||||
|
Reference in New Issue
Block a user