mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 09:08:08 +08:00
change temporaly loc from token to copy of loc
location constructed from token string does not has correct line number information. to show an informative error message about UTF-8 and escape sequences, parse_(ml_)basic_string requires those information that can only be given from root location<Container>.
This commit is contained in:
@@ -341,9 +341,11 @@ parse_ml_basic_string(location<Container>& loc)
|
|||||||
const auto first = loc.iter();
|
const auto first = loc.iter();
|
||||||
if(const auto token = lex_ml_basic_string::invoke(loc))
|
if(const auto token = lex_ml_basic_string::invoke(loc))
|
||||||
{
|
{
|
||||||
location<std::string> inner_loc(loc.name(), token.unwrap().str());
|
auto inner_loc = loc;
|
||||||
|
inner_loc.iter() = first;
|
||||||
|
|
||||||
std::string retval;
|
std::string retval;
|
||||||
retval.reserve(inner_loc.source()->size());
|
retval.reserve(token.unwrap().size());
|
||||||
|
|
||||||
auto delim = lex_ml_basic_string_delim::invoke(inner_loc);
|
auto delim = lex_ml_basic_string_delim::invoke(inner_loc);
|
||||||
if(!delim)
|
if(!delim)
|
||||||
@@ -396,7 +398,8 @@ parse_basic_string(location<Container>& loc)
|
|||||||
const auto first = loc.iter();
|
const auto first = loc.iter();
|
||||||
if(const auto token = lex_basic_string::invoke(loc))
|
if(const auto token = lex_basic_string::invoke(loc))
|
||||||
{
|
{
|
||||||
location<std::string> inner_loc(loc.name(), token.unwrap().str());
|
auto inner_loc = loc;
|
||||||
|
inner_loc.iter() = first;
|
||||||
|
|
||||||
auto quot = lex_quotation_mark::invoke(inner_loc);
|
auto quot = lex_quotation_mark::invoke(inner_loc);
|
||||||
if(!quot)
|
if(!quot)
|
||||||
@@ -406,7 +409,7 @@ parse_basic_string(location<Container>& loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string retval;
|
std::string retval;
|
||||||
retval.reserve(inner_loc.source()->size());
|
retval.reserve(token.unwrap().size());
|
||||||
|
|
||||||
quot = err("tmp");
|
quot = err("tmp");
|
||||||
while(!quot)
|
while(!quot)
|
||||||
|
Reference in New Issue
Block a user