diff --git a/include/toml11/impl/syntax_impl.hpp b/include/toml11/impl/syntax_impl.hpp index 4502308..2cc9d52 100644 --- a/include/toml11/impl/syntax_impl.hpp +++ b/include/toml11/impl/syntax_impl.hpp @@ -121,7 +121,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), @@ -688,7 +688,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 } @@ -800,7 +800,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)); diff --git a/include/toml11/parser.hpp b/include/toml11/parser.hpp index 8aeaa93..6c1c45e 100644 --- a/include/toml11/parser.hpp +++ b/include/toml11/parser.hpp @@ -1706,7 +1706,7 @@ parse_simple_key(location& loc, const context& 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"; } diff --git a/include/toml11/spec.hpp b/include/toml11/spec.hpp index 15f5e46..eb11863 100644 --- a/include/toml11/spec.hpp +++ b/include/toml11/spec.hpp @@ -95,13 +95,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} @@ -110,14 +110,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) @@ -130,13 +132,13 @@ inline std::pair> to_tuple(const spec& s) noexcept { return std::make_pair(std::cref(s.version), std::array{{ - 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