mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 10:28:09 +08:00
refactor: return region info from parse_kvpair
This commit is contained in:
@@ -905,7 +905,7 @@ parse_array(location<Container>& loc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Container>
|
template<typename Container>
|
||||||
result<std::pair<std::vector<key>, value>, std::string>
|
result<std::pair<std::pair<std::vector<key>, region<Container>>, value>, std::string>
|
||||||
parse_key_value_pair(location<Container>& loc)
|
parse_key_value_pair(location<Container>& loc)
|
||||||
{
|
{
|
||||||
const auto first = loc.iter();
|
const auto first = loc.iter();
|
||||||
@@ -968,7 +968,7 @@ parse_key_value_pair(location<Container>& loc)
|
|||||||
loc.iter() = first;
|
loc.iter() = first;
|
||||||
return err(msg);
|
return err(msg);
|
||||||
}
|
}
|
||||||
return ok(std::make_pair(std::move(key_reg.unwrap().first),
|
return ok(std::make_pair(std::move(key_reg.unwrap()),
|
||||||
std::move(val.unwrap())));
|
std::move(val.unwrap())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1193,7 +1193,8 @@ parse_inline_table(location<Container>& loc)
|
|||||||
{
|
{
|
||||||
return err(kv_r.unwrap_err());
|
return err(kv_r.unwrap_err());
|
||||||
}
|
}
|
||||||
const std::vector<key>& keys = kv_r.unwrap().first;
|
const std::vector<key>& keys = kv_r.unwrap().first.first;
|
||||||
|
// const region<Container>& key_reg = kv_r.unwrap().first.second;
|
||||||
const value& val = kv_r.unwrap().second;
|
const value& val = kv_r.unwrap().second;
|
||||||
|
|
||||||
const auto inserted =
|
const auto inserted =
|
||||||
@@ -1374,7 +1375,8 @@ result<table, std::string> parse_ml_table(location<Container>& loc)
|
|||||||
|
|
||||||
if(const auto kv = parse_key_value_pair(loc))
|
if(const auto kv = parse_key_value_pair(loc))
|
||||||
{
|
{
|
||||||
const std::vector<key>& keys = kv.unwrap().first;
|
const std::vector<key>& keys = kv.unwrap().first.first;
|
||||||
|
// const region<Container>& key_reg = kv_r.unwrap().first.second;
|
||||||
const value& val = kv.unwrap().second;
|
const value& val = kv.unwrap().second;
|
||||||
const auto inserted =
|
const auto inserted =
|
||||||
insert_nested_key(tab, val, keys.begin(), keys.end());
|
insert_nested_key(tab, val, keys.begin(), keys.end());
|
||||||
|
Reference in New Issue
Block a user