Compare commits

...

1 Commits

Author SHA1 Message Date
ToruNiina
504692db77 feat [skip ci]: update single_include 2025-12-02 14:39:12 +00:00

View File

@@ -237,13 +237,13 @@ struct spec
constexpr explicit spec(const semantic_version& semver) noexcept
: version{semver},
v1_1_0_allow_control_characters_in_comments {semantic_version{1, 1, 0} <= semver},
v1_1_0_allow_newlines_in_inline_tables {semantic_version{1, 1, 0} <= semver},
v1_1_0_allow_trailing_comma_in_inline_tables{semantic_version{1, 1, 0} <= semver},
v1_1_0_allow_non_english_in_bare_keys {semantic_version{1, 1, 0} <= semver},
v1_1_0_add_escape_sequence_e {semantic_version{1, 1, 0} <= semver},
v1_1_0_add_escape_sequence_x {semantic_version{1, 1, 0} <= semver},
v1_1_0_make_seconds_optional {semantic_version{1, 1, 0} <= semver},
ext_allow_control_characters_in_comments{false},
ext_allow_non_english_in_bare_keys{false},
ext_hex_float {false},
ext_num_suffix{false},
ext_null_value{false}
@@ -252,14 +252,16 @@ struct spec
semantic_version version; // toml version
// diff from v1.0.0 -> v1.1.0
bool v1_1_0_allow_control_characters_in_comments;
bool v1_1_0_allow_newlines_in_inline_tables;
bool v1_1_0_allow_trailing_comma_in_inline_tables;
bool v1_1_0_allow_non_english_in_bare_keys;
bool v1_1_0_add_escape_sequence_e;
bool v1_1_0_add_escape_sequence_x;
bool v1_1_0_make_seconds_optional;
// discussed in toml-lang, but currently not in it
bool ext_allow_control_characters_in_comments;
bool ext_allow_non_english_in_bare_keys;
// library extensions
bool ext_hex_float; // allow hex float (in C++ style)
bool ext_num_suffix; // allow number suffix (in C++ style)
@@ -272,13 +274,13 @@ inline std::pair<const semantic_version&, std::array<bool, 10>>
to_tuple(const spec& s) noexcept
{
return std::make_pair(std::cref(s.version), std::array<bool, 10>{{
s.v1_1_0_allow_control_characters_in_comments,
s.v1_1_0_allow_newlines_in_inline_tables,
s.v1_1_0_allow_trailing_comma_in_inline_tables,
s.v1_1_0_allow_non_english_in_bare_keys,
s.v1_1_0_add_escape_sequence_e,
s.v1_1_0_add_escape_sequence_x,
s.v1_1_0_make_seconds_optional,
s.ext_allow_control_characters_in_comments,
s.ext_allow_non_english_in_bare_keys,
s.ext_hex_float,
s.ext_num_suffix,
s.ext_null_value
@@ -6146,7 +6148,7 @@ TOML11_INLINE either const& newline(const spec&)
TOML11_INLINE either const& allowed_comment_char(const spec& sp)
{
static thread_local auto cache = make_cache([](const spec& s){
if(s.v1_1_0_allow_control_characters_in_comments)
if(s.ext_allow_control_characters_in_comments)
{
return either(
character_in_range(0x01, 0x09),
@@ -6713,7 +6715,7 @@ TOML11_INLINE either const& string(const spec& sp)
// to keep `expected_chars` simple
TOML11_INLINE non_ascii_key_char::non_ascii_key_char(const spec& s) noexcept
{
assert(s.v1_1_0_allow_non_english_in_bare_keys);
assert(s.ext_allow_non_english_in_bare_keys);
(void)s; // for NDEBUG
}
@@ -6825,7 +6827,7 @@ TOML11_INLINE repeat_at_least const& unquoted_key(const spec& sp)
{
static thread_local auto cache = make_cache([](const spec& s) {
const auto keychar = [&s] {
if(s.v1_1_0_allow_non_english_in_bare_keys)
if(s.ext_allow_non_english_in_bare_keys)
{
return either(alpha(s), digit(s), character{0x2D}, character{0x5F},
non_ascii_key_char(s));
@@ -16051,7 +16053,7 @@ parse_simple_key(location& loc, const context<TC>& ctx)
else
{
std::string postfix;
if(spec.v1_1_0_allow_non_english_in_bare_keys)
if(spec.ext_allow_non_english_in_bare_keys)
{
postfix = "Hint: Not all Unicode characters are allowed as bare key.\n";
}