feat(WIP): add workaround to make literal compiles

This commit is contained in:
ToruNiina
2019-06-06 22:32:51 +09:00
parent 7258c52334
commit a8b5fef827

View File

@@ -53,7 +53,7 @@ inline ::toml::value operator""_toml(const char* str, std::size_t len)
// If it is neither a table-key or a array-of-table-key, it may be a value. // If it is neither a table-key or a array-of-table-key, it may be a value.
if(!is_table_key && !is_aots_key) if(!is_table_key && !is_aots_key)
{ {
if(auto data = ::toml::detail::parse_value(loc)) if(auto data = ::toml::detail::parse_value<::toml::value>(loc))
{ {
return data.unwrap(); return data.unwrap();
} }
@@ -70,14 +70,14 @@ inline ::toml::value operator""_toml(const char* str, std::size_t len)
// It is a valid toml file. // It is a valid toml file.
// It should be parsed as if we parse a file with this content. // It should be parsed as if we parse a file with this content.
if(auto data = ::toml::detail::parse_toml_file(loc)) if(auto data = ::toml::detail::parse_toml_file<::toml::value>(loc))
{ {
loc.reset(loc.begin()); // rollback to the top of the literal // TODO later I need to move this logic to parse_toml_file
// skip needless characters for error message // loc.reset(loc.begin()); // rollback to the top of the literal
skip_line::invoke(loc); // skip the first several needless lines // // skip needless characters for error message
skip_ws::invoke(loc); // skip the first several needless whitespaces // skip_line::invoke(loc); // skip the first several needless lines
return ::toml::value(std::move(data.unwrap()), // skip_ws::invoke(loc); // skip the first several needless whitespaces
::toml::detail::region<std::vector<char>>(std::move(loc))); return data.unwrap();
} }
else // none of them. else // none of them.
{ {