Skip to content

Commit bd1bae2

Browse files
committed
feat: change some unreleased features as ext
some features introduced in toml-lang v1.1.0 have been postponed. so those features are renamed as library extensions (`v_1_1_0` -> `ext_`). those will not be removed because they may be introduced in the future release of toml-lang.
1 parent 2a18a89 commit bd1bae2

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

include/toml11/impl/syntax_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ TOML11_INLINE either const& newline(const spec&)
121121
TOML11_INLINE either const& allowed_comment_char(const spec& sp)
122122
{
123123
static thread_local auto cache = make_cache([](const spec& s){
124-
if(s.v1_1_0_allow_control_characters_in_comments)
124+
if(s.ext_allow_control_characters_in_comments)
125125
{
126126
return either(
127127
character_in_range(0x01, 0x09),
@@ -688,7 +688,7 @@ TOML11_INLINE either const& string(const spec& sp)
688688
// to keep `expected_chars` simple
689689
TOML11_INLINE non_ascii_key_char::non_ascii_key_char(const spec& s) noexcept
690690
{
691-
assert(s.v1_1_0_allow_non_english_in_bare_keys);
691+
assert(s.ext_allow_non_english_in_bare_keys);
692692
(void)s; // for NDEBUG
693693
}
694694

@@ -800,7 +800,7 @@ TOML11_INLINE repeat_at_least const& unquoted_key(const spec& sp)
800800
{
801801
static thread_local auto cache = make_cache([](const spec& s) {
802802
const auto keychar = [&s] {
803-
if(s.v1_1_0_allow_non_english_in_bare_keys)
803+
if(s.ext_allow_non_english_in_bare_keys)
804804
{
805805
return either(alpha(s), digit(s), character{0x2D}, character{0x5F},
806806
non_ascii_key_char(s));

include/toml11/parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ parse_simple_key(location& loc, const context<TC>& ctx)
17061706
else
17071707
{
17081708
std::string postfix;
1709-
if(spec.v1_1_0_allow_non_english_in_bare_keys)
1709+
if(spec.ext_allow_non_english_in_bare_keys)
17101710
{
17111711
postfix = "Hint: Not all Unicode characters are allowed as bare key.\n";
17121712
}

include/toml11/spec.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ struct spec
9595

9696
constexpr explicit spec(const semantic_version& semver) noexcept
9797
: version{semver},
98-
v1_1_0_allow_control_characters_in_comments {semantic_version{1, 1, 0} <= semver},
9998
v1_1_0_allow_newlines_in_inline_tables {semantic_version{1, 1, 0} <= semver},
10099
v1_1_0_allow_trailing_comma_in_inline_tables{semantic_version{1, 1, 0} <= semver},
101-
v1_1_0_allow_non_english_in_bare_keys {semantic_version{1, 1, 0} <= semver},
102100
v1_1_0_add_escape_sequence_e {semantic_version{1, 1, 0} <= semver},
103101
v1_1_0_add_escape_sequence_x {semantic_version{1, 1, 0} <= semver},
104102
v1_1_0_make_seconds_optional {semantic_version{1, 1, 0} <= semver},
103+
ext_allow_control_characters_in_comments{false},
104+
ext_allow_non_english_in_bare_keys{false},
105105
ext_hex_float {false},
106106
ext_num_suffix{false},
107107
ext_null_value{false}
@@ -110,14 +110,16 @@ struct spec
110110
semantic_version version; // toml version
111111

112112
// diff from v1.0.0 -> v1.1.0
113-
bool v1_1_0_allow_control_characters_in_comments;
114113
bool v1_1_0_allow_newlines_in_inline_tables;
115114
bool v1_1_0_allow_trailing_comma_in_inline_tables;
116-
bool v1_1_0_allow_non_english_in_bare_keys;
117115
bool v1_1_0_add_escape_sequence_e;
118116
bool v1_1_0_add_escape_sequence_x;
119117
bool v1_1_0_make_seconds_optional;
120118

119+
// discussed in toml-lang, but currently not in it
120+
bool ext_allow_control_characters_in_comments;
121+
bool ext_allow_non_english_in_bare_keys;
122+
121123
// library extensions
122124
bool ext_hex_float; // allow hex float (in C++ style)
123125
bool ext_num_suffix; // allow number suffix (in C++ style)
@@ -130,13 +132,13 @@ inline std::pair<const semantic_version&, std::array<bool, 10>>
130132
to_tuple(const spec& s) noexcept
131133
{
132134
return std::make_pair(std::cref(s.version), std::array<bool, 10>{{
133-
s.v1_1_0_allow_control_characters_in_comments,
134135
s.v1_1_0_allow_newlines_in_inline_tables,
135136
s.v1_1_0_allow_trailing_comma_in_inline_tables,
136-
s.v1_1_0_allow_non_english_in_bare_keys,
137137
s.v1_1_0_add_escape_sequence_e,
138138
s.v1_1_0_add_escape_sequence_x,
139139
s.v1_1_0_make_seconds_optional,
140+
s.ext_allow_control_characters_in_comments,
141+
s.ext_allow_non_english_in_bare_keys,
140142
s.ext_hex_float,
141143
s.ext_num_suffix,
142144
s.ext_null_value

0 commit comments

Comments
 (0)