Skip to content

Commit

Permalink
feat: allow heterogenous array
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ToruNiina committed Nov 8, 2019
1 parent 4297633 commit 9af2d65
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions toml/parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ parse_array(location<Container>& 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())
{
auto array_start_loc = loc;
Expand All @@ -956,6 +957,7 @@ parse_array(location<Container>& loc)
}
}), source_location(std::addressof(loc)));
}
#endif
retval.push_back(std::move(val.unwrap()));
}
else
Expand Down

0 comments on commit 9af2d65

Please sign in to comment.