mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 02:08:09 +08:00
feat: allow heterogenous array
if TOML11_USE_UNRELEASED_TOML_FEATURES is activated. In TOML v0.5.0, heterogenous arrays are not allowed. But after some discussions in toml-lang/toml, it is decided to allow it in the next release (toml-lang/toml/pull/676). To support it, disable type check in parse_array function.
This commit is contained in:
@@ -938,6 +938,7 @@ parse_array(location<Container>& loc)
|
|||||||
|
|
||||||
if(auto val = parse_value<value_type>(loc))
|
if(auto val = parse_value<value_type>(loc))
|
||||||
{
|
{
|
||||||
|
#ifndef TOML11_USE_UNRELEASED_TOML_FEATURES
|
||||||
if(!retval.empty() && retval.front().type() != val.as_ok().type())
|
if(!retval.empty() && retval.front().type() != val.as_ok().type())
|
||||||
{
|
{
|
||||||
auto array_start_loc = loc;
|
auto array_start_loc = loc;
|
||||||
@@ -956,6 +957,7 @@ parse_array(location<Container>& loc)
|
|||||||
}
|
}
|
||||||
}), source_location(std::addressof(loc)));
|
}), source_location(std::addressof(loc)));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
retval.push_back(std::move(val.unwrap()));
|
retval.push_back(std::move(val.unwrap()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user