From 1bb21a6fa1c463bb768bfc20ef0eebd812b3e505 Mon Sep 17 00:00:00 2001 From: fktn Date: Sun, 28 Apr 2024 05:01:37 +0900 Subject: [PATCH 1/8] Fixed parser crashes on a sequence right after the directives end marker (#327) * Fix parse error on a sequence after a directives end marker * fix for uncovered lines in the deserializer --- include/fkYAML/detail/input/deserializer.hpp | 5 ++--- single_include/fkYAML/node.hpp | 5 ++--- test/unit_test/test_deserializer_class.cpp | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index 63d9f246..f6d1b25d 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -187,8 +187,8 @@ class basic_deserializer { // TODO: should output a warning log. Currently just ignore this case. break; case lexical_token_t::END_OF_DIRECTIVES: - last_type = type; - return; + // Ignore this directives end marker so the caller will get the beginning token of the contents. + break; default: // end the parsing of directives if the other tokens are found. last_type = type; @@ -462,7 +462,6 @@ class basic_deserializer { break; } case lexical_token_t::END_OF_DIRECTIVES: - break; case lexical_token_t::END_OF_DOCUMENT: // TODO: This token should be handled to support multiple documents. break; diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 46e2f0aa..b851dc3d 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -4078,8 +4078,8 @@ class basic_deserializer { // TODO: should output a warning log. Currently just ignore this case. break; case lexical_token_t::END_OF_DIRECTIVES: - last_type = type; - return; + // Ignore this directives end marker so the caller will get the beginning token of the contents. + break; default: // end the parsing of directives if the other tokens are found. last_type = type; @@ -4353,7 +4353,6 @@ class basic_deserializer { break; } case lexical_token_t::END_OF_DIRECTIVES: - break; case lexical_token_t::END_OF_DOCUMENT: // TODO: This token should be handled to support multiple documents. break; diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 4c7f08f0..9f686cff 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -1449,6 +1449,21 @@ TEST_CASE("Deserializer_Tag") { REQUIRE(root["seq_flow"][1].get_value() == 3.14f); } + SECTION("specify tags using TAG directives") { + std::string input = "%TAG !e! tag:example.com,2000:app/\n" + "---\n" + "- !e!foo \"bar\""; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_sequence()); + REQUIRE(root.size() == 1); + + REQUIRE(root[0].has_tag_name()); + REQUIRE(root[0].get_tag_name() == "!e!foo"); + REQUIRE(root[0].is_string()); + REQUIRE(root[0].get_value_ref() == "bar"); + } + SECTION("multiple tags specified") { auto input = GENERATE(std::string("foo: !!map !!map\n bar: baz"), std::string("!!str !!bool true: 123")); REQUIRE_THROWS_AS(deserializer.deserialize(fkyaml::detail::input_adapter(input)), fkyaml::parse_error); From 6eeed6d27a457c95cb73bdce4a52f12a4a0bd978 Mon Sep 17 00:00:00 2001 From: fktn Date: Sun, 28 Apr 2024 14:22:00 +0900 Subject: [PATCH 2/8] Fixed no such file/directory error when running Bash scripts on Windows (#328) * Fixed no such file/directory error when running Bash scripts on Windows * fixed missing $ to get the value of a Bash variable --- scripts/run_amalgamation.sh | 15 ++++++++++++++- scripts/run_clang_format.sh | 22 ++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/scripts/run_amalgamation.sh b/scripts/run_amalgamation.sh index cf71f77d..1ca9be6c 100755 --- a/scripts/run_amalgamation.sh +++ b/scripts/run_amalgamation.sh @@ -1,4 +1,17 @@ #!/bin/bash +set -eu + +# Platform switches are taken from https://gist.github.com/prabirshrestha/3080525 +UNAME=$(uname) +if [ "$UNAME" = "Linux" ] || [ "$UNAME" = "Darwin" ]; then + PYTHON_EXE=python3 +else + # Use the Python launcher if the runtime environment is Windows. + # No version option (`-`) since running with the latest version should be enough. + PYTHON_EXE=py +fi + ROOT_DIR="$(dirname "$0")"/.. -python3 "$ROOT_DIR"/tool/amalgamation/amalgamate.py -c "$ROOT_DIR"/tool/amalgamation/fkYAML.json -s . --verbose=yes +AMALGAMATION_TOOL_DIR="$ROOT_DIR/tool/amalgamation" +"$PYTHON_EXE" "$AMALGAMATION_TOOL_DIR"/amalgamate.py -c "$AMALGAMATION_TOOL_DIR"/fkYAML.json -s . --verbose=yes diff --git a/scripts/run_clang_format.sh b/scripts/run_clang_format.sh index 8c738f8a..f41a8570 100755 --- a/scripts/run_clang_format.sh +++ b/scripts/run_clang_format.sh @@ -3,12 +3,26 @@ SCRIPT_DIR="$(dirname "$0")" ROOT_DIR="$SCRIPT_DIR/.." +# Platform switches are taken from https://gist.github.com/prabirshrestha/3080525 +UNAME=$(uname) +if [ "$UNAME" = "Linux" ] || [ "$UNAME" = "Darwin" ]; then + PYTHON_EXE=python3 + VENV_BINARY_DIR=bin +else + # Use the Python launcher if the runtime environment is Windows. + # No version option (`-`) since running with the latest version should be enough. + PYTHON_EXE=py + # Binaries are stored in the `venv\Scripts` directory using Python venv module for Windows. + VENV_BINARY_DIR=Scripts +fi + + # install the clang-format package if not installed yet. -if [ ! -e "$SCRIPT_DIR"/venv_clang_format/bin/clang-format ]; then - python3 -m venv "$SCRIPT_DIR/venv_clang_format" - "$SCRIPT_DIR"/venv_clang_format/bin/pip install clang-format==14.0.0 +if [ ! -e "$SCRIPT_DIR"/venv_clang_format/"$VENV_BINARY_DIR"/clang-format ]; then + "$PYTHON_EXE" -m venv "$SCRIPT_DIR/venv_clang_format" + "$SCRIPT_DIR"/venv_clang_format/"$VENV_BINARY_DIR"/pip install clang-format==14.0.0 fi for f in $(find "$ROOT_DIR/include" "$ROOT_DIR/test" "$ROOT_DIR/docs/examples" -type f -name "*.hpp" -o -name "*.cpp" | sort); do - "$SCRIPT_DIR"/venv_clang_format/bin/clang-format "$f" -i + "$SCRIPT_DIR"/venv_clang_format/"$VENV_BINARY_DIR"/clang-format "$f" -i done From 68c431465bef258f51f17fe43fff8cec8be1da24 Mon Sep 17 00:00:00 2001 From: fktn Date: Mon, 29 Apr 2024 15:10:52 +0900 Subject: [PATCH 3/8] Allow backslashes in plain/single-quoted scalars (#329) * allow backslashes(\) in plain/single-quoted scalars * run amalgamation --- include/fkYAML/detail/input/lexical_analyzer.hpp | 10 ++-------- single_include/fkYAML/node.hpp | 10 ++-------- test/unit_test/test_lexical_analyzer_class.cpp | 4 ++-- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 6348dc9b..cd28e255 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -738,9 +738,6 @@ class lexical_analyzer { m_token_begin_itr = m_cur_itr + 1; ret = true; break; - - case '\\': - emit_error("Escaped characters are only available in a double-quoted string token."); } return ret; @@ -940,9 +937,6 @@ class lexical_analyzer { m_value_buffer.append(m_token_begin_itr, m_cur_itr); break; - - case '\\': - emit_error("Escaped characters are only available in a double-quoted string token."); } return ret; @@ -956,7 +950,7 @@ class lexical_analyzer { // * double quoted // * plain - std::string check_filters {"\r\n\\"}; + std::string check_filters {"\r\n"}; bool (lexical_analyzer::*pfn_is_allowed)(char) = nullptr; if (needs_last_single_quote) { @@ -964,7 +958,7 @@ class lexical_analyzer { pfn_is_allowed = &lexical_analyzer::is_allowed_single; } else if (needs_last_double_quote) { - check_filters.append("\""); + check_filters.append("\"\\"); pfn_is_allowed = &lexical_analyzer::is_allowed_double; } else // plain scalars diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index b851dc3d..db29b612 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -2992,9 +2992,6 @@ class lexical_analyzer { m_token_begin_itr = m_cur_itr + 1; ret = true; break; - - case '\\': - emit_error("Escaped characters are only available in a double-quoted string token."); } return ret; @@ -3194,9 +3191,6 @@ class lexical_analyzer { m_value_buffer.append(m_token_begin_itr, m_cur_itr); break; - - case '\\': - emit_error("Escaped characters are only available in a double-quoted string token."); } return ret; @@ -3210,7 +3204,7 @@ class lexical_analyzer { // * double quoted // * plain - std::string check_filters {"\r\n\\"}; + std::string check_filters {"\r\n"}; bool (lexical_analyzer::*pfn_is_allowed)(char) = nullptr; if (needs_last_single_quote) { @@ -3218,7 +3212,7 @@ class lexical_analyzer { pfn_is_allowed = &lexical_analyzer::is_allowed_single; } else if (needs_last_double_quote) { - check_filters.append("\""); + check_filters.append("\"\\"); pfn_is_allowed = &lexical_analyzer::is_allowed_double; } else // plain scalars diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/test/unit_test/test_lexical_analyzer_class.cpp index 4b2454ec..c4225ad3 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/test/unit_test/test_lexical_analyzer_class.cpp @@ -515,6 +515,7 @@ TEST_CASE("LexicalAnalyzer_String") { value_pair_t(std::string("foo bar"), fkyaml::node::string_type("foo bar")), value_pair_t(std::string("foo\"bar"), fkyaml::node::string_type("foo\"bar")), value_pair_t(std::string("foo\'s bar"), fkyaml::node::string_type("foo\'s bar")), + value_pair_t(std::string("foo\\bar"), fkyaml::node::string_type("foo\\bar")), value_pair_t(std::string("nullValue"), fkyaml::node::string_type("nullValue")), value_pair_t(std::string("NullValue"), fkyaml::node::string_type("NullValue")), value_pair_t(std::string("NULL_VALUE"), fkyaml::node::string_type("NULL_VALUE")), @@ -543,6 +544,7 @@ TEST_CASE("LexicalAnalyzer_String") { value_pair_t(std::string("\'foo}bar\'"), fkyaml::node::string_type("foo}bar")), value_pair_t(std::string("\'foo\"bar\'"), fkyaml::node::string_type("foo\"bar")), value_pair_t(std::string("\'foo:bar\'"), fkyaml::node::string_type("foo:bar")), + value_pair_t(std::string("\'foo\\bar\'"), fkyaml::node::string_type("foo\\bar")), value_pair_t(std::string("\"foo bar\""), fkyaml::node::string_type("foo bar")), value_pair_t(std::string("\"foo's bar\""), fkyaml::node::string_type("foo's bar")), @@ -736,7 +738,6 @@ TEST_CASE("LexicalAnalyzer_EscapedUnicodeCharacter") { TEST_CASE("LexicalAnalyzer_InvalidString") { SECTION("parse error") { auto buffer = GENERATE( - std::string("foo\\tbar"), std::string("\"test"), std::string("\'test"), std::string("\'test\n\'"), @@ -746,7 +747,6 @@ TEST_CASE("LexicalAnalyzer_InvalidString") { std::string("\"\\x=\""), std::string("\"\\x^\""), std::string("\"\\x{\""), - std::string("\'\\t\'"), std::string("\"\\Q\"")); lexer_t lexer(fkyaml::detail::input_adapter(buffer)); From fd813754640d213606df4fe42caa79505612b4b9 Mon Sep 17 00:00:00 2001 From: fktn Date: Tue, 30 Apr 2024 01:34:04 +0900 Subject: [PATCH 4/8] Fixed parse error on root block sequence with child block sequences (#330) --- include/fkYAML/detail/input/deserializer.hpp | 27 +++++++++++++++----- single_include/fkYAML/node.hpp | 27 +++++++++++++++----- test/unit_test/test_deserializer_class.cpp | 22 +++++++++++++++- 3 files changed, 63 insertions(+), 13 deletions(-) diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index f6d1b25d..a2ebd407 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -90,6 +90,7 @@ class basic_deserializer { case lexical_token_t::SEQUENCE_FLOW_BEGIN: root = node_type::sequence(); apply_directive_set(root); + m_indent_stack.emplace_back(lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), false); break; default: break; @@ -250,9 +251,9 @@ class basic_deserializer { continue; } case lexical_token_t::KEY_SEPARATOR: { - bool is_stack_empty = m_node_stack.empty(); - if (is_stack_empty) { - throw parse_error("A key separator found without key.", line, indent); + bool is_empty_seq = mp_current_node->is_sequence() && mp_current_node->empty(); + if (is_empty_seq) { + throw parse_error("sequence key should not be empty.", line, indent); } // hold the line count of the key separator for later use. @@ -299,12 +300,15 @@ class basic_deserializer { } } + bool do_continue = true; switch (type) { case lexical_token_t::SEQUENCE_BLOCK_PREFIX: // a key separator preceeding block sequence entries *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_indent_stack.emplace_back(line, indent, false); + do_continue = false; break; case lexical_token_t::EXPLICIT_KEY_PREFIX: // a key separator for a explicit block mapping key. @@ -326,7 +330,10 @@ class basic_deserializer { break; // LCOV_EXCL_LINE } - continue; + if (do_continue) { + continue; + } + break; } // handle explicit mapping key separators. @@ -363,9 +370,10 @@ class basic_deserializer { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_indent_stack.emplace_back(line, indent, false); + break; } - indent = lexer.get_last_token_begin_pos(); - line = lexer.get_lines_processed(); + continue; } case lexical_token_t::VALUE_SEPARATOR: @@ -391,6 +399,13 @@ class basic_deserializer { if (mp_current_node->is_sequence()) { bool is_empty = mp_current_node->empty(); if (is_empty) { + bool is_further_nested = !m_indent_stack.empty() && m_indent_stack.back().indent < indent; + if (is_further_nested) { + mp_current_node->template get_value_ref().emplace_back( + node_type::sequence()); + m_node_stack.push_back(mp_current_node); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + } m_indent_stack.emplace_back(line, indent, false); break; } diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index db29b612..2de9d69f 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -3975,6 +3975,7 @@ class basic_deserializer { case lexical_token_t::SEQUENCE_FLOW_BEGIN: root = node_type::sequence(); apply_directive_set(root); + m_indent_stack.emplace_back(lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), false); break; default: break; @@ -4135,9 +4136,9 @@ class basic_deserializer { continue; } case lexical_token_t::KEY_SEPARATOR: { - bool is_stack_empty = m_node_stack.empty(); - if (is_stack_empty) { - throw parse_error("A key separator found without key.", line, indent); + bool is_empty_seq = mp_current_node->is_sequence() && mp_current_node->empty(); + if (is_empty_seq) { + throw parse_error("sequence key should not be empty.", line, indent); } // hold the line count of the key separator for later use. @@ -4184,12 +4185,15 @@ class basic_deserializer { } } + bool do_continue = true; switch (type) { case lexical_token_t::SEQUENCE_BLOCK_PREFIX: // a key separator preceeding block sequence entries *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_indent_stack.emplace_back(line, indent, false); + do_continue = false; break; case lexical_token_t::EXPLICIT_KEY_PREFIX: // a key separator for a explicit block mapping key. @@ -4211,7 +4215,10 @@ class basic_deserializer { break; // LCOV_EXCL_LINE } - continue; + if (do_continue) { + continue; + } + break; } // handle explicit mapping key separators. @@ -4248,9 +4255,10 @@ class basic_deserializer { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_indent_stack.emplace_back(line, indent, false); + break; } - indent = lexer.get_last_token_begin_pos(); - line = lexer.get_lines_processed(); + continue; } case lexical_token_t::VALUE_SEPARATOR: @@ -4276,6 +4284,13 @@ class basic_deserializer { if (mp_current_node->is_sequence()) { bool is_empty = mp_current_node->empty(); if (is_empty) { + bool is_further_nested = !m_indent_stack.empty() && m_indent_stack.back().indent < indent; + if (is_further_nested) { + mp_current_node->template get_value_ref().emplace_back( + node_type::sequence()); + m_node_stack.push_back(mp_current_node); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + } m_indent_stack.emplace_back(line, indent, false); break; } diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 9f686cff..a26f222d 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -32,7 +32,7 @@ TEST_CASE("Deserializer_KeySeparator") { } SECTION("error cases") { - auto input_str = GENERATE(std::string(": foo"), std::string("- : foo"), std::string("- - : foo")); + auto input_str = GENERATE(std::string("- : foo"), std::string("- - : foo")); REQUIRE_THROWS_AS( root = deserializer.deserialize(fkyaml::detail::input_adapter(input_str)), fkyaml::parse_error); } @@ -303,6 +303,26 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(root[2].is_float_number()); REQUIRE(root[2].get_value() == 3.14); } + + SECTION("root sequence with nested child block sequence") { + std::string input = "- - foo\n" + " - 123\n" + "- 3.14"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_sequence()); + REQUIRE(root.size() == 2); + + REQUIRE(root[0].is_sequence()); + REQUIRE(root[0].size() == 2); + REQUIRE(root[0][0].is_string()); + REQUIRE(root[0][0].get_value_ref() == "foo"); + REQUIRE(root[0][1].is_integer()); + REQUIRE(root[0][1].get_value() == 123); + + REQUIRE(root[1].is_float_number()); + REQUIRE(root[1].get_value() == 3.14); + } } TEST_CASE("Deserializer_BlockMapping") { From 705a9739a1a633f1e3dad0bb2d3558021df56cf0 Mon Sep 17 00:00:00 2001 From: fktn Date: Wed, 1 May 2024 03:05:31 +0900 Subject: [PATCH 5/8] Refactor deserialization process (#331) * handle indent/node stack info within the same variable * remove unnecessary branches in the deserialization process * introduced state types into context while avoiding unnecessary node instanciation * improved parsing of node properties & update Doxygen comments for the deserializer APIs * deleted unused members/usings * avoid using unnecessarily large integer types (mostly size_t -> uint32_t) * removed unnecessarily duplicated node object instanciations * modified traversal code to find matched indentation * workaround weired coverage result --- .../detail/encodings/encode_detector.hpp | 6 +- .../fkYAML/detail/encodings/utf_encodings.hpp | 5 +- include/fkYAML/detail/input/deserializer.hpp | 284 ++-- include/fkYAML/detail/input/input_adapter.hpp | 32 +- .../fkYAML/detail/input/lexical_analyzer.hpp | 98 +- .../fkYAML/detail/input/position_tracker.hpp | 22 +- include/fkYAML/exception.hpp | 6 +- single_include/fkYAML/node.hpp | 457 ++++--- test/unit_test/test_deserializer_class.cpp | 1156 +++++++++-------- test/unit_test/test_utf_encodings.cpp | 14 +- 10 files changed, 1092 insertions(+), 988 deletions(-) diff --git a/include/fkYAML/detail/encodings/encode_detector.hpp b/include/fkYAML/detail/encodings/encode_detector.hpp index 093c7069..bd936311 100644 --- a/include/fkYAML/detail/encodings/encode_detector.hpp +++ b/include/fkYAML/detail/encodings/encode_detector.hpp @@ -87,7 +87,7 @@ inline utf_encode_t detect_encoding_and_skip_bom(ItrType& begin, const ItrType& std::array bytes = {{0xFFu, 0xFFu, 0xFFu, 0xFFu}}; switch (ElemSize) { case sizeof(char): { // this case covers char8_t as well when compiled with C++20 or better. - for (std::size_t i = 0; i < 4 && begin + i != end; i++) { + for (int i = 0; i < 4 && begin + i != end; i++) { bytes[i] = uint8_t(begin[i]); } @@ -167,7 +167,7 @@ inline utf_encode_t detect_encoding_and_skip_bom(ItrType& begin, const ItrType& inline utf_encode_t detect_encoding_and_skip_bom(std::FILE* file) noexcept { std::array bytes = {{0xFFu, 0xFFu, 0xFFu, 0xFFu}}; - for (std::size_t i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { char byte = 0; std::size_t size = std::fread(&byte, sizeof(char), 1, file); if (size != sizeof(char)) { @@ -203,7 +203,7 @@ inline utf_encode_t detect_encoding_and_skip_bom(std::FILE* file) noexcept { inline utf_encode_t detect_encoding_and_skip_bom(std::istream& is) noexcept { std::array bytes = {{0xFFu, 0xFFu, 0xFFu, 0xFFu}}; - for (std::size_t i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { char ch = 0; is.read(&ch, 1); std::streamsize size = is.gcount(); diff --git a/include/fkYAML/detail/encodings/utf_encodings.hpp b/include/fkYAML/detail/encodings/utf_encodings.hpp index a374b9d8..922198af 100644 --- a/include/fkYAML/detail/encodings/utf_encodings.hpp +++ b/include/fkYAML/detail/encodings/utf_encodings.hpp @@ -193,8 +193,7 @@ inline bool validate(const std::initializer_list& byte_array) noexcept /// @param[out] consumed_size The number of UTF-16 encoded characters used for the conversion. /// @param[out] encoded_size The size of UTF-encoded bytes. inline void from_utf16( - std::array utf16, std::array& utf8, std::size_t& consumed_size, - std::size_t& encoded_size) { + std::array utf16, std::array& utf8, uint32_t& consumed_size, uint32_t& encoded_size) { if (utf16[0] < char16_t(0x80u)) { utf8[0] = static_cast(utf16[0] & 0x7Fu); consumed_size = 1; @@ -244,7 +243,7 @@ inline void from_utf16( /// @param[in] utf32 A UTF-32 encoded character. /// @param[out] utf8 UTF-8 encoded bytes. /// @param[in] encoded_size The size of UTF-encoded bytes. -inline void from_utf32(const char32_t utf32, std::array& utf8, std::size_t& encoded_size) { +inline void from_utf32(const char32_t utf32, std::array& utf8, uint32_t& encoded_size) { if (utf32 < char32_t(0x80u)) { utf8[0] = static_cast(utf32 & 0x007F); encoded_size = 1; diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index a2ebd407..d1aa66ec 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -43,27 +42,41 @@ class basic_deserializer { using sequence_type = typename node_type::sequence_type; /** A type for mapping node value containers. */ using mapping_type = typename node_type::mapping_type; - /** A type for boolean node values. */ - using boolean_type = typename node_type::boolean_type; - /** A type for integer node values. */ - using integer_type = typename node_type::integer_type; - /** A type for float number node values. */ - using float_number_type = typename node_type::float_number_type; /** A type for string node values. */ using string_type = typename node_type::string_type; - struct indentation { - indentation() = default; + /// @brief Definition of state types of parse contexts. + enum class context_state_t { + BLOCK_MAPPING_KEY_IMPLICIT, //!< The underlying node is an implicit block mapping key. + BLOCK_MAPPING_KEY_EXPLICIT, //!< The underlying node is an explicit block mapping key. + BLOCK_SEQUENCE_ENTRY, //!< The underlying node is a sequence. + }; - indentation(std::size_t _line, std::size_t _indent, bool _is_explicit_key) + /// @brief Context information set for parsing. + struct parse_context { + /// @brief Construct a new parse_context object. + parse_context() = default; + + /// @brief Construct a new parse_context object with non-default values for each parameter. + /// @param _line The current line. (count from zero) + /// @param _indent The indentation width in the current line. (count from zero) + /// @param _state The parse context type. + /// @param _p_node The underlying node associated to this context. + parse_context(uint32_t _line, uint32_t _indent, context_state_t _state, node_type* _p_node) : line(_line), indent(_indent), - is_explicit_key(_is_explicit_key) { + state(_state), + p_node(_p_node) { } - std::size_t line {0}; - std::size_t indent {0}; - bool is_explicit_key {false}; + /// The current line. (count from zero) + uint32_t line {0}; + /// The indentation width in the current line. (count from zero) + uint32_t indent {0}; + /// The parse context type. + context_state_t state {context_state_t::BLOCK_MAPPING_KEY_IMPLICIT}; + /// The underlying node associated to this context. + node_type* p_node {nullptr}; }; public: @@ -72,30 +85,39 @@ class basic_deserializer { public: /// @brief Deserialize a YAML-formatted source string into a YAML node. - /// @param source A YAML-formatted source string. - /// @return node_type A root YAML node deserialized from the source string. + /// @param input_adapter An adapter object for the input source buffer. + /// @return node_type A root YAML node object deserialized from the source string. template ::value, int> = 0> node_type deserialize(InputAdapterType&& input_adapter) { lexer_type lexer(std::forward(input_adapter)); lexical_token_t type {lexical_token_t::END_OF_BUFFER}; - node_type root = node_type::mapping(); - mp_current_node = &root; + node_type root; // parse directives first. - deserialize_directives(lexer, root, type); + deserialize_directives(lexer, type); switch (type) { case lexical_token_t::SEQUENCE_BLOCK_PREFIX: - case lexical_token_t::SEQUENCE_FLOW_BEGIN: + case lexical_token_t::SEQUENCE_FLOW_BEGIN: { root = node_type::sequence(); apply_directive_set(root); - m_indent_stack.emplace_back(lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), false); + parse_context context( + lexer.get_lines_processed(), + lexer.get_last_token_begin_pos(), + context_state_t::BLOCK_SEQUENCE_ENTRY, + &root); + m_context_stack.emplace_back(std::move(context)); break; + } default: + root = node_type::mapping(); + apply_directive_set(root); break; } + mp_current_node = &root; + // parse YAML nodes recursively deserialize_node(lexer, type); @@ -104,8 +126,7 @@ class basic_deserializer { mp_directive_set.reset(); m_needs_anchor_impl = false; m_anchor_table.clear(); - m_node_stack.clear(); - m_indent_stack.clear(); + m_context_stack.clear(); return root; } @@ -113,9 +134,8 @@ class basic_deserializer { private: /// @brief Deserializes the YAML directives if specified. /// @param lexer The lexical analyzer to be used. - /// @param root The root YAML node. - /// @param type The variable to store the last lexical token type. - void deserialize_directives(lexer_type& lexer, node_type& root, lexical_token_t& last_type) { + /// @param last_type The variable to store the last lexical token type. + void deserialize_directives(lexer_type& lexer, lexical_token_t& last_type) { for (;;) { lexical_token_t type = lexer.get_next_token(); @@ -124,9 +144,6 @@ class basic_deserializer { if (!mp_directive_set) { mp_directive_set = std::shared_ptr(new directive_set()); } - if (!root.mp_directive_set) { - root.mp_directive_set = mp_directive_set; - } if (mp_directive_set->is_version_specified) { throw parse_error( @@ -142,9 +159,6 @@ class basic_deserializer { if (!mp_directive_set) { mp_directive_set = std::shared_ptr(new directive_set()); } - if (!root.mp_directive_set) { - root.mp_directive_set = mp_directive_set; - } const std::string& tag_handle = lexer.get_tag_handle(); switch (tag_handle.size()) { @@ -203,8 +217,8 @@ class basic_deserializer { /// @param first_type The first lexical token type. void deserialize_node(lexer_type& lexer, lexical_token_t first_type) { lexical_token_t type = first_type; - std::size_t line = lexer.get_lines_processed(); - std::size_t indent = lexer.get_last_token_begin_pos(); + uint32_t line = lexer.get_lines_processed(); + uint32_t indent = lexer.get_last_token_begin_pos(); do { switch (type) { @@ -212,33 +226,45 @@ class basic_deserializer { // This handles an empty input. break; case lexical_token_t::EXPLICIT_KEY_PREFIX: { - bool needs_to_move_back = !m_indent_stack.empty() && indent < m_indent_stack.back().indent; + bool needs_to_move_back = !m_context_stack.empty() && indent < m_context_stack.back().indent; if (needs_to_move_back) { auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_indent_stack.rbegin(), - m_indent_stack.rend(), - [indent](const indentation& i) { return indent > i.indent; }); + m_context_stack.rbegin(), + m_context_stack.rend(), + [indent](const parse_context& c) { return indent > c.indent; }); - auto pop_num = std::distance(m_indent_stack.rbegin(), target_itr); + auto pop_num = std::distance(m_context_stack.rbegin(), target_itr); for (auto i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } } if (mp_current_node->is_null()) { + // This path is needed in case the input contains nested explicit keys like the following YAML + // snippet: + // ```yaml + // ? ? foo + // : bar + // : baz + // ``` *mp_current_node = node_type::mapping(); + apply_directive_set(*mp_current_node); } - m_node_stack.push_back(mp_current_node); - m_indent_stack.emplace_back(line, indent, true); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_KEY_EXPLICIT, mp_current_node); type = lexer.get_next_token(); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { - m_indent_stack.emplace_back(lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), false); mp_current_node = new node_type(node_t::SEQUENCE); + parse_context context( + lexer.get_lines_processed(), + lexer.get_last_token_begin_pos(), + context_state_t::BLOCK_SEQUENCE_ENTRY, + mp_current_node); + m_context_stack.emplace_back(std::move(context)); apply_directive_set(*mp_current_node); break; } @@ -257,8 +283,8 @@ class basic_deserializer { } // hold the line count of the key separator for later use. - std::size_t old_indent = indent; - std::size_t old_line = line; + uint32_t old_indent = indent; + uint32_t old_line = line; type = lexer.get_next_token(); line = lexer.get_lines_processed(); @@ -274,7 +300,7 @@ class basic_deserializer { indent = lexer.get_last_token_begin_pos(); bool is_implicit_same_line = - (line == old_line) && (m_indent_stack.empty() || old_indent > m_indent_stack.back().indent); + (line == old_line) && (m_context_stack.empty() || old_indent > m_context_stack.back().indent); if (is_implicit_same_line) { // a key separator for an implicit key with its value on the same line. continue; @@ -307,13 +333,13 @@ class basic_deserializer { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); do_continue = false; break; case lexical_token_t::EXPLICIT_KEY_PREFIX: // a key separator for a explicit block mapping key. - *mp_current_node = node_type::mapping(); - apply_directive_set(*mp_current_node); + // defer the handling of the explicit key prefix token until the next loop. break; // defer checking the existence of a key separator after the scalar until a deserialize_scalar() // call. @@ -338,39 +364,24 @@ class basic_deserializer { // handle explicit mapping key separators. - while (!m_indent_stack.back().is_explicit_key) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); - } - - if (m_node_stack.back()->is_sequence()) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - } - if (m_node_stack.back() == mp_current_node) { - // This path is for nested explicit mapping keys like: - // ```yaml - // ? ? foo - // : bar - // : baz - // ``` - m_node_stack.pop_back(); + while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } node_type* key_node = mp_current_node; - m_node_stack.back()->template get_value_ref().emplace(*key_node, node_type()); - mp_current_node = &(m_node_stack.back()->operator[](*key_node)); + m_context_stack.back().p_node->template get_value_ref().emplace(*key_node, node_type()); + mp_current_node = &(m_context_stack.back().p_node->operator[](*key_node)); delete key_node; key_node = nullptr; - m_node_stack.push_back(m_node_stack.back()); - m_indent_stack.back().is_explicit_key = false; + m_context_stack.back().state = context_state_t::BLOCK_MAPPING_KEY_IMPLICIT; + m_context_stack.emplace_back(m_context_stack.back()); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); break; } @@ -399,36 +410,37 @@ class basic_deserializer { if (mp_current_node->is_sequence()) { bool is_empty = mp_current_node->empty(); if (is_empty) { - bool is_further_nested = !m_indent_stack.empty() && m_indent_stack.back().indent < indent; + bool is_further_nested = !m_context_stack.empty() && m_context_stack.back().indent < indent; if (is_further_nested) { mp_current_node->template get_value_ref().emplace_back( node_type::sequence()); - m_node_stack.push_back(mp_current_node); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->template get_value_ref().back()); + break; } - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); break; } // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent != m_indent_stack.back().indent) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + while (!mp_current_node->is_sequence() || indent < m_context_stack.back().indent) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } break; } // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent != m_indent_stack.back().indent) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + while (!mp_current_node->is_sequence() || indent != m_context_stack.back().indent) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } // for mappings in a sequence. mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_node_stack.push_back(mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->template get_value_ref().back()); apply_directive_set(*mp_current_node); break; @@ -441,11 +453,8 @@ class basic_deserializer { case lexical_token_t::SEQUENCE_FLOW_END: { FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - bool is_stack_empty = m_node_stack.empty(); - if (!is_stack_empty) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - } + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); break; } case lexical_token_t::MAPPING_FLOW_BEGIN: @@ -457,10 +466,10 @@ class basic_deserializer { case lexical_token_t::MAPPING_FLOW_END: { FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - bool is_stack_empty = m_node_stack.empty(); + bool is_stack_empty = m_context_stack.empty(); if (!is_stack_empty) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } break; } @@ -494,9 +503,8 @@ class basic_deserializer { /// @param line The variable to store the line of either the first property or the last non-property token. /// @param indent The variable to store the indent of either the first property or the last non-property token. /// @return true if any property is found, false otherwise. - bool deserialize_node_properties( - lexer_type& lexer, lexical_token_t& last_type, std::size_t& line, std::size_t& indent) { - std::set prop_types {lexical_token_t::ANCHOR_PREFIX, lexical_token_t::TAG_PREFIX}; + bool deserialize_node_properties(lexer_type& lexer, lexical_token_t& last_type, uint32_t& line, uint32_t& indent) { + m_needs_anchor_impl = m_needs_tag_impl = false; lexical_token_t type = last_type; bool ends_loop {false}; @@ -506,90 +514,85 @@ class basic_deserializer { } switch (type) { - case lexical_token_t::ANCHOR_PREFIX: { - bool already_specified = prop_types.find(type) == prop_types.end(); - if (already_specified) { + case lexical_token_t::ANCHOR_PREFIX: + if (m_needs_anchor_impl) { throw parse_error( "anchor name cannot be specified more than once to the same node.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - prop_types.erase(type); m_anchor_name = lexer.get_string(); m_needs_anchor_impl = true; - if (prop_types.size() == 1) { + if (!m_needs_tag_impl) { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); } + type = lexer.get_next_token(); break; - } case lexical_token_t::TAG_PREFIX: { - bool already_specified = prop_types.find(type) == prop_types.end(); - if (already_specified) { + if (m_needs_tag_impl) { throw parse_error( "tag name cannot be specified more than once to the same node.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - prop_types.erase(type); m_tag_name = lexer.get_string(); m_needs_tag_impl = true; - if (prop_types.size() == 1) { + if (!m_needs_anchor_impl) { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); } + type = lexer.get_next_token(); break; } default: ends_loop = true; break; } - - if (!ends_loop) { - type = lexer.get_next_token(); - } } while (!ends_loop); last_type = type; - if (prop_types.size() == 2) { + bool prop_specified = m_needs_anchor_impl || m_needs_tag_impl; + if (!prop_specified) { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); } - return prop_types.size() < 2; + return prop_specified; } /// @brief Add new key string to the current YAML node. /// @param key a key string to be added to the current YAML node. - void add_new_key(node_type&& key, const std::size_t indent, const std::size_t line) { - if (!m_indent_stack.empty() && indent < m_indent_stack.back().indent) { + /// @param indent The indentation width in the current line where the key is found. + /// @param line The line where the key is found. + void add_new_key(node_type&& key, const uint32_t indent, const uint32_t line) { + if (!m_context_stack.empty() && indent < m_context_stack.back().indent) { auto target_itr = - std::find_if(m_indent_stack.rbegin(), m_indent_stack.rend(), [indent](const indentation& i) { - return indent == i.indent; + std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), [indent](const parse_context& c) { + return indent == c.indent; }); - bool is_indent_valid = (target_itr != m_indent_stack.rend()); + bool is_indent_valid = (target_itr != m_context_stack.rend()); if (!is_indent_valid) { throw parse_error("Detected invalid indentaion.", line, indent); } - auto pop_num = std::distance(m_indent_stack.rbegin(), target_itr); + auto pop_num = std::distance(m_context_stack.rbegin(), target_itr) + 1; for (auto i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } } if (mp_current_node->is_sequence()) { mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_node_stack.push_back(mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); } @@ -597,7 +600,8 @@ class basic_deserializer { bool is_empty = map.empty(); if (is_empty) { if (m_flow_context_depth == 0) { - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); } } else { @@ -609,8 +613,8 @@ class basic_deserializer { } map.emplace(key, node_type()); - m_node_stack.push_back(mp_current_node); - mp_current_node = &(mp_current_node->operator[](key)); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); + mp_current_node = &(mp_current_node->operator[](std::move(key))); } /// @brief Assign node value to the current node. @@ -623,9 +627,9 @@ class basic_deserializer { // a scalar node *mp_current_node = std::move(node_value); - if (m_flow_context_depth > 0 || !m_indent_stack.back().is_explicit_key) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); + if (m_flow_context_depth > 0 || m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } } @@ -635,7 +639,7 @@ class basic_deserializer { /// @param indent The last indent size. /// @param line The last line. /// @return The created YAML scalar node. - node_type create_scalar_node(lexer_type& lexer, lexical_token_t type, std::size_t indent, std::size_t line) { + node_type create_scalar_node(lexer_type& lexer, lexical_token_t type, uint32_t indent, uint32_t line) { FK_YAML_ASSERT( type == lexical_token_t::NULL_VALUE || type == lexical_token_t::BOOLEAN_VALUE || type == lexical_token_t::INTEGER_VALUE || type == lexical_token_t::FLOAT_NUMBER_VALUE || @@ -714,11 +718,12 @@ class basic_deserializer { } /// @brief Deserialize a detected scalar node. + /// @param lexer The lexical analyzer to be used. /// @param node A detected scalar node by a lexer. /// @param indent The current indentation width. Can be updated in this function. /// @param line The number of processed lines. Can be updated in this function. /// @return true if next token has already been got, false otherwise. - bool deserialize_scalar(lexer_type& lexer, std::size_t& indent, std::size_t& line, lexical_token_t& type) { + bool deserialize_scalar(lexer_type& lexer, uint32_t& indent, uint32_t& line, lexical_token_t& type) { node_type node = create_scalar_node(lexer, type, indent, line); if (mp_current_node->is_mapping()) { @@ -732,16 +737,17 @@ class basic_deserializer { if (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator(:) assign_node_value(std::move(node)); - if (!m_indent_stack.back().is_explicit_key) { - m_indent_stack.pop_back(); + if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); return true; } - indentation& last_indent = m_indent_stack.back(); - if (last_indent.line == line && !last_indent.is_explicit_key) { + parse_context& last_context = m_context_stack.back(); + if (last_context.line == line && last_context.state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { throw parse_error("multiple mapping keys are specified on the same line.", line, indent); } @@ -792,12 +798,10 @@ class basic_deserializer { private: /// The currently focused YAML node. node_type* mp_current_node {nullptr}; - /// The stack of YAML nodes. - std::deque m_node_stack {}; - /// The stack of indentation widths. - std::deque m_indent_stack {}; + /// The stack of parse contexts. + std::deque m_context_stack {}; /// The current depth of flow contexts. - std::size_t m_flow_context_depth {0}; + uint32_t m_flow_context_depth {0}; /// The set of YAML directives. std::shared_ptr mp_directive_set {}; /// A flag to determine the need for YAML anchor node implementation. diff --git a/include/fkYAML/detail/input/input_adapter.hpp b/include/fkYAML/detail/input/input_adapter.hpp index 843ff1e3..9cf380ca 100644 --- a/include/fkYAML/detail/input/input_adapter.hpp +++ b/include/fkYAML/detail/input/input_adapter.hpp @@ -143,9 +143,9 @@ class iterator_input_adapter< } std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end || encoded_buf_size != 0) { while (m_current != m_end && encoded_buf_size < 2) { @@ -153,7 +153,7 @@ class iterator_input_adapter< encoded_buffer[encoded_buf_size++] |= static_cast(uint8_t(*m_current++) << shift_bits[1]); } - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -185,7 +185,7 @@ class iterator_input_adapter< } std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end) { char32_t utf32 = static_cast(*m_current++ << shift_bits[0]); @@ -330,9 +330,9 @@ class iterator_input_adapter< int shift_bits = (m_encode_type == utf_encode_t::UTF_16BE) ? 0 : 8; std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end || encoded_buf_size != 0) { while (m_current != m_end && encoded_buf_size < 2) { @@ -342,7 +342,7 @@ class iterator_input_adapter< static_cast((tmp & 0xFF00u) >> shift_bits)); } - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -404,7 +404,7 @@ class iterator_input_adapter< } std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end) { char32_t tmp = *m_current++; @@ -538,9 +538,9 @@ class file_input_adapter { char chars[2] = {0, 0}; std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (std::feof(m_file) == 0) { while (encoded_buf_size < 2 && std::fread(&chars[0], sizeof(char), 2, m_file) == 2) { @@ -549,7 +549,7 @@ class file_input_adapter { static_cast(uint8_t(chars[1]) << shift_bits[1])); } - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -582,7 +582,7 @@ class file_input_adapter { char chars[4] = {0, 0, 0, 0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (std::feof(m_file) == 0) { std::size_t size = std::fread(&chars[0], sizeof(char), 4, m_file); @@ -715,9 +715,9 @@ class stream_input_adapter { char chars[2] = {0, 0}; std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; do { while (encoded_buf_size < 2) { @@ -732,7 +732,7 @@ class stream_input_adapter { static_cast(uint8_t(chars[1]) << shift_bits[1])); }; - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -765,7 +765,7 @@ class stream_input_adapter { char chars[4] = {0, 0, 0, 0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; do { m_istream->read(&chars[0], 4); diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index cd28e255..6398804f 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -80,25 +80,25 @@ class lexical_analyzer { m_last_token_begin_line = m_pos_tracker.get_lines_read(); if (m_cur_itr == m_end_itr) { - return m_last_token_type = lexical_token_t::END_OF_BUFFER; + return lexical_token_t::END_OF_BUFFER; } switch (char current = *m_cur_itr) { case '?': if (++m_cur_itr == m_end_itr) { m_value_buffer = "?"; - return m_last_token_type = lexical_token_t::STRING_VALUE; + return lexical_token_t::STRING_VALUE; } switch (*m_cur_itr) { case ' ': - return m_last_token_type = lexical_token_t::EXPLICIT_KEY_PREFIX; + return lexical_token_t::EXPLICIT_KEY_PREFIX; default: - return m_last_token_type = scan_scalar(); + return scan_scalar(); } case ':': { // key separater if (++m_cur_itr == m_end_itr) { - return m_last_token_type = lexical_token_t::KEY_SEPARATOR; + return lexical_token_t::KEY_SEPARATOR; } switch (*m_cur_itr) { @@ -122,18 +122,18 @@ class lexical_analyzer { return scan_scalar(); } - return m_last_token_type = lexical_token_t::KEY_SEPARATOR; + return lexical_token_t::KEY_SEPARATOR; } case ',': // value separater ++m_cur_itr; - return m_last_token_type = lexical_token_t::VALUE_SEPARATOR; + return lexical_token_t::VALUE_SEPARATOR; case '&': { // anchor prefix extract_anchor_name(); bool is_empty = m_value_buffer.empty(); if (is_empty) { emit_error("anchor name must not be empty."); } - return m_last_token_type = lexical_token_t::ANCHOR_PREFIX; + return lexical_token_t::ANCHOR_PREFIX; } case '*': { // alias prefix extract_anchor_name(); @@ -142,104 +142,102 @@ class lexical_analyzer { emit_error("anchor name must not be empty."); } - return m_last_token_type = lexical_token_t::ALIAS_PREFIX; + return lexical_token_t::ALIAS_PREFIX; } case '!': extract_tag_name(); - return m_last_token_type = lexical_token_t::TAG_PREFIX; + return lexical_token_t::TAG_PREFIX; case '#': // comment prefix scan_comment(); return get_next_token(); case '%': // directive prefix - return m_last_token_type = scan_directive(); + return scan_directive(); case '-': { char next = *(m_cur_itr + 1); if (next == ' ') { // Move a cursor to the beginning of the next token. m_cur_itr += 2; - return m_last_token_type = lexical_token_t::SEQUENCE_BLOCK_PREFIX; + return lexical_token_t::SEQUENCE_BLOCK_PREFIX; } bool is_available = (std::distance(m_cur_itr, m_end_itr) > 2); if (is_available) { m_cur_itr += 3; if (std::equal(m_token_begin_itr, m_cur_itr, "---")) { - return m_last_token_type = lexical_token_t::END_OF_DIRECTIVES; + return lexical_token_t::END_OF_DIRECTIVES; } } - return m_last_token_type = scan_scalar(); + return scan_scalar(); } case '[': // sequence flow begin m_flow_context_depth++; ++m_cur_itr; - return m_last_token_type = lexical_token_t::SEQUENCE_FLOW_BEGIN; + return lexical_token_t::SEQUENCE_FLOW_BEGIN; case ']': // sequence flow end if (m_flow_context_depth == 0) { emit_error("An invalid flow sequence ending."); } m_flow_context_depth--; ++m_cur_itr; - return m_last_token_type = lexical_token_t::SEQUENCE_FLOW_END; + return lexical_token_t::SEQUENCE_FLOW_END; case '{': // mapping flow begin m_flow_context_depth++; ++m_cur_itr; - return m_last_token_type = lexical_token_t::MAPPING_FLOW_BEGIN; + return lexical_token_t::MAPPING_FLOW_BEGIN; case '}': // mapping flow end if (m_flow_context_depth == 0) { emit_error("An invalid flow mapping ending."); } m_flow_context_depth--; ++m_cur_itr; - return m_last_token_type = lexical_token_t::MAPPING_FLOW_END; + return lexical_token_t::MAPPING_FLOW_END; case '@': emit_error("Any token cannot start with at(@). It is a reserved indicator for YAML."); case '`': emit_error("Any token cannot start with grave accent(`). It is a reserved indicator for YAML."); case '\"': case '\'': - return m_last_token_type = scan_scalar(); + return scan_scalar(); case '+': - return m_last_token_type = scan_scalar(); + return scan_scalar(); case '.': { bool is_available = (std::distance(m_cur_itr, m_end_itr) > 2); if (is_available) { if (std::equal(m_cur_itr, m_cur_itr + 3, "...")) { m_cur_itr += 3; - return m_last_token_type = lexical_token_t::END_OF_DOCUMENT; + return lexical_token_t::END_OF_DOCUMENT; } } - return m_last_token_type = scan_scalar(); + return scan_scalar(); } case '|': { chomping_indicator_t chomp_type = chomping_indicator_t::KEEP; - std::size_t indent = 0; + uint32_t indent = 0; get_block_style_metadata(chomp_type, indent); - return m_last_token_type = - scan_block_style_string_token(block_style_indicator_t::LITERAL, chomp_type, indent); + return scan_block_style_string_token(block_style_indicator_t::LITERAL, chomp_type, indent); } case '>': { chomping_indicator_t chomp_type = chomping_indicator_t::KEEP; - std::size_t indent = 0; + uint32_t indent = 0; get_block_style_metadata(chomp_type, indent); - return m_last_token_type = - scan_block_style_string_token(block_style_indicator_t::FOLDED, chomp_type, indent); + return scan_block_style_string_token(block_style_indicator_t::FOLDED, chomp_type, indent); } default: - return m_last_token_type = scan_scalar(); + return scan_scalar(); } } /// @brief Get the beginning position of a last token. - /// @return std::size_t The beginning position of a last token. - std::size_t get_last_token_begin_pos() const noexcept { + /// @return uint32_t The beginning position of a last token. + uint32_t get_last_token_begin_pos() const noexcept { return m_last_token_begin_pos; } /// @brief Get the number of lines already processed. - /// @return std::size_t The number of lines already processed. - std::size_t get_lines_processed() const noexcept { + /// @return uint32_t The number of lines already processed. + uint32_t get_lines_processed() const noexcept { return m_last_token_begin_line; } @@ -250,8 +248,8 @@ class lexical_analyzer { } /// @brief Convert from string to boolean and get the converted value. - /// @return true A string token is one of the followings: "true", "True", "TRUE". - /// @return false A string token is one of the followings: "false", "False", "FALSE". + /// @retval true A string token is one of the followings: "true", "True", "TRUE". + /// @retval false A string token is one of the followings: "false", "False", "FALSE". boolean_type get_boolean() const { return from_string(m_value_buffer, type_tag {}); } @@ -674,6 +672,8 @@ class lexical_analyzer { } std::size_t last_tag_prefix_pos = m_value_buffer.find_last_of('!'); + FK_YAML_ASSERT(last_tag_prefix_pos != std::string::npos); + bool is_valid_uri = uri_encoding::validate(m_value_buffer.begin() + last_tag_prefix_pos + 1, m_value_buffer.end()); if (!is_valid_uri) { @@ -1021,7 +1021,7 @@ class lexical_analyzer { /// @param indent The indent size specified for the given token. /// @return The lexical token type for strings. lexical_token_t scan_block_style_string_token( - block_style_indicator_t style, chomping_indicator_t chomp, std::size_t indent) { + block_style_indicator_t style, chomping_indicator_t chomp, uint32_t indent) { m_value_buffer.clear(); // Handle leading all-space lines. @@ -1051,7 +1051,7 @@ class lexical_analyzer { } m_pos_tracker.update_position(m_cur_itr); - std::size_t cur_indent = m_pos_tracker.get_cur_pos_in_line(); + uint32_t cur_indent = m_pos_tracker.get_cur_pos_in_line(); // TODO: preserve and compare the last indentation with `cur_indent` if (indent == 0) { @@ -1061,16 +1061,16 @@ class lexical_analyzer { emit_error("A block style scalar is less indented than the indicated level."); } - int chars_in_line = 0; + uint32_t chars_in_line = 0; bool is_extra_indented = false; if (cur_indent > indent) { - std::size_t diff = cur_indent - indent; + uint32_t diff = cur_indent - indent; if (style == block_style_indicator_t::FOLDED) { m_value_buffer.push_back('\n'); is_extra_indented = true; } m_value_buffer.append(diff, ' '); - chars_in_line += static_cast(diff); + chars_in_line += diff; } for (char current = 0; m_cur_itr != m_end_itr; ++m_cur_itr) { @@ -1105,7 +1105,7 @@ class lexical_analyzer { // Append a newline if the next line is empty. bool is_end_of_token = false; bool is_next_empty = false; - for (std::size_t i = 0; i < indent; i++) { + for (uint32_t i = 0; i < indent; i++) { if (++m_cur_itr == m_end_itr) { is_end_of_token = true; break; @@ -1312,7 +1312,7 @@ class lexical_analyzer { /// @brief Gets the metadata of a following block style string scalar. /// @param chomp_type A variable to store the retrieved chomping style type. /// @param indent A variable to store the retrieved indent size. - void get_block_style_metadata(chomping_indicator_t& chomp_type, std::size_t& indent) { + void get_block_style_metadata(chomping_indicator_t& chomp_type, uint32_t& indent) { chomp_type = chomping_indicator_t::CLIP; switch (*++m_cur_itr) { case '-': @@ -1411,21 +1411,13 @@ class lexical_analyzer { /// A temporal buffer to store a UTF-8 encoded char sequence. std::array m_encode_buffer {}; /// The actual size of a UTF-8 encoded char sequence. - std::size_t m_encoded_size {0}; + uint32_t m_encoded_size {0}; /// The beginning position of the last lexical token. (zero origin) - std::size_t m_last_token_begin_pos {0}; + uint32_t m_last_token_begin_pos {0}; /// The beginning line of the last lexical token. (zero origin) - std::size_t m_last_token_begin_line {0}; + uint32_t m_last_token_begin_line {0}; /// The current depth of flow context. uint32_t m_flow_context_depth {0}; - /// The last found token type. - lexical_token_t m_last_token_type {lexical_token_t::END_OF_BUFFER}; - /// A temporal bool holder. - boolean_type m_boolean_val {false}; - /// A temporal integer holder. - integer_type m_integer_val {0}; - /// A temporal floating point number holder. - float_number_type m_float_val {0.0}; }; FK_YAML_DETAIL_NAMESPACE_END diff --git a/include/fkYAML/detail/input/position_tracker.hpp b/include/fkYAML/detail/input/position_tracker.hpp index 2a3c642a..a5b69454 100644 --- a/include/fkYAML/detail/input/position_tracker.hpp +++ b/include/fkYAML/detail/input/position_tracker.hpp @@ -28,11 +28,11 @@ class position_tracker { /// @brief A set of information on the current position in an input buffer. struct position { /// The current position from the beginning of an input buffer. - std::size_t cur_pos {0}; + uint32_t cur_pos {0}; /// The current position in the current line. - std::size_t cur_pos_in_line {0}; + uint32_t cur_pos_in_line {0}; /// The number of lines which have already been read. - std::size_t lines_read {0}; + uint32_t lines_read {0}; }; public: @@ -46,8 +46,8 @@ class position_tracker { /// @note This function doesn't support cases where cur_pos has moved backward from the last call. /// @param cur_pos The iterator to the current element of the buffer. void update_position(std::string::const_iterator cur_pos) { - m_position.cur_pos = static_cast(std::distance(m_begin, cur_pos)); - m_position.lines_read += std::count(m_last, cur_pos, '\n'); + m_position.cur_pos = static_cast(std::distance(m_begin, cur_pos)); + m_position.lines_read += static_cast(std::count(m_last, cur_pos, '\n')); m_last = cur_pos; if (m_position.lines_read == 0) { @@ -55,7 +55,7 @@ class position_tracker { return; } - std::size_t count = 0; + uint32_t count = 0; while (--cur_pos != m_begin) { if (*cur_pos == '\n') { break; @@ -65,19 +65,19 @@ class position_tracker { m_position.cur_pos_in_line = count; } - std::size_t get_cur_pos() const noexcept { + uint32_t get_cur_pos() const noexcept { return m_position.cur_pos; } /// @brief Get the current position in the current line. - /// @return std::size_t The current position in the current line. - std::size_t get_cur_pos_in_line() const noexcept { + /// @return uint32_t The current position in the current line. + uint32_t get_cur_pos_in_line() const noexcept { return m_position.cur_pos_in_line; } /// @brief Get the number of lines which have already been read. - /// @return std::size_t The number of lines which have already been read. - std::size_t get_lines_read() const noexcept { + /// @return uint32_t The number of lines which have already been read. + uint32_t get_lines_read() const noexcept { return m_position.lines_read; } diff --git a/include/fkYAML/exception.hpp b/include/fkYAML/exception.hpp index f6cfe689..1b9bb0de 100644 --- a/include/fkYAML/exception.hpp +++ b/include/fkYAML/exception.hpp @@ -113,13 +113,13 @@ class invalid_encoding : public exception { /// @brief An exception class indicating an error in parsing. class parse_error : public exception { public: - explicit parse_error(const char* msg, std::size_t lines, std::size_t cols_in_line) noexcept + explicit parse_error(const char* msg, uint32_t lines, uint32_t cols_in_line) noexcept : exception(generate_error_message(msg, lines, cols_in_line).c_str()) { } private: - std::string generate_error_message(const char* msg, std::size_t lines, std::size_t cols_in_line) const noexcept { - return detail::format("parse_error: %s (at line %zu, column %zu)", msg, lines, cols_in_line); + std::string generate_error_message(const char* msg, uint32_t lines, uint32_t cols_in_line) const noexcept { + return detail::format("parse_error: %s (at line %u, column %u)", msg, lines, cols_in_line); } }; diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 2de9d69f..80440877 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -249,7 +249,6 @@ FK_YAML_DETAIL_NAMESPACE_END #include #include #include -#include #include // #include @@ -955,13 +954,13 @@ class invalid_encoding : public exception { /// @brief An exception class indicating an error in parsing. class parse_error : public exception { public: - explicit parse_error(const char* msg, std::size_t lines, std::size_t cols_in_line) noexcept + explicit parse_error(const char* msg, uint32_t lines, uint32_t cols_in_line) noexcept : exception(generate_error_message(msg, lines, cols_in_line).c_str()) { } private: - std::string generate_error_message(const char* msg, std::size_t lines, std::size_t cols_in_line) const noexcept { - return detail::format("parse_error: %s (at line %zu, column %zu)", msg, lines, cols_in_line); + std::string generate_error_message(const char* msg, uint32_t lines, uint32_t cols_in_line) const noexcept { + return detail::format("parse_error: %s (at line %u, column %u)", msg, lines, cols_in_line); } }; @@ -1569,8 +1568,7 @@ inline bool validate(const std::initializer_list& byte_array) noexcept /// @param[out] consumed_size The number of UTF-16 encoded characters used for the conversion. /// @param[out] encoded_size The size of UTF-encoded bytes. inline void from_utf16( - std::array utf16, std::array& utf8, std::size_t& consumed_size, - std::size_t& encoded_size) { + std::array utf16, std::array& utf8, uint32_t& consumed_size, uint32_t& encoded_size) { if (utf16[0] < char16_t(0x80u)) { utf8[0] = static_cast(utf16[0] & 0x7Fu); consumed_size = 1; @@ -1620,7 +1618,7 @@ inline void from_utf16( /// @param[in] utf32 A UTF-32 encoded character. /// @param[out] utf8 UTF-8 encoded bytes. /// @param[in] encoded_size The size of UTF-encoded bytes. -inline void from_utf32(const char32_t utf32, std::array& utf8, std::size_t& encoded_size) { +inline void from_utf32(const char32_t utf32, std::array& utf8, uint32_t& encoded_size) { if (utf32 < char32_t(0x80u)) { utf8[0] = static_cast(utf32 & 0x007F); encoded_size = 1; @@ -2040,11 +2038,11 @@ class position_tracker { /// @brief A set of information on the current position in an input buffer. struct position { /// The current position from the beginning of an input buffer. - std::size_t cur_pos {0}; + uint32_t cur_pos {0}; /// The current position in the current line. - std::size_t cur_pos_in_line {0}; + uint32_t cur_pos_in_line {0}; /// The number of lines which have already been read. - std::size_t lines_read {0}; + uint32_t lines_read {0}; }; public: @@ -2058,8 +2056,8 @@ class position_tracker { /// @note This function doesn't support cases where cur_pos has moved backward from the last call. /// @param cur_pos The iterator to the current element of the buffer. void update_position(std::string::const_iterator cur_pos) { - m_position.cur_pos = static_cast(std::distance(m_begin, cur_pos)); - m_position.lines_read += std::count(m_last, cur_pos, '\n'); + m_position.cur_pos = static_cast(std::distance(m_begin, cur_pos)); + m_position.lines_read += static_cast(std::count(m_last, cur_pos, '\n')); m_last = cur_pos; if (m_position.lines_read == 0) { @@ -2067,7 +2065,7 @@ class position_tracker { return; } - std::size_t count = 0; + uint32_t count = 0; while (--cur_pos != m_begin) { if (*cur_pos == '\n') { break; @@ -2077,19 +2075,19 @@ class position_tracker { m_position.cur_pos_in_line = count; } - std::size_t get_cur_pos() const noexcept { + uint32_t get_cur_pos() const noexcept { return m_position.cur_pos; } /// @brief Get the current position in the current line. - /// @return std::size_t The current position in the current line. - std::size_t get_cur_pos_in_line() const noexcept { + /// @return uint32_t The current position in the current line. + uint32_t get_cur_pos_in_line() const noexcept { return m_position.cur_pos_in_line; } /// @brief Get the number of lines which have already been read. - /// @return std::size_t The number of lines which have already been read. - std::size_t get_lines_read() const noexcept { + /// @return uint32_t The number of lines which have already been read. + uint32_t get_lines_read() const noexcept { return m_position.lines_read; } @@ -2334,25 +2332,25 @@ class lexical_analyzer { m_last_token_begin_line = m_pos_tracker.get_lines_read(); if (m_cur_itr == m_end_itr) { - return m_last_token_type = lexical_token_t::END_OF_BUFFER; + return lexical_token_t::END_OF_BUFFER; } switch (char current = *m_cur_itr) { case '?': if (++m_cur_itr == m_end_itr) { m_value_buffer = "?"; - return m_last_token_type = lexical_token_t::STRING_VALUE; + return lexical_token_t::STRING_VALUE; } switch (*m_cur_itr) { case ' ': - return m_last_token_type = lexical_token_t::EXPLICIT_KEY_PREFIX; + return lexical_token_t::EXPLICIT_KEY_PREFIX; default: - return m_last_token_type = scan_scalar(); + return scan_scalar(); } case ':': { // key separater if (++m_cur_itr == m_end_itr) { - return m_last_token_type = lexical_token_t::KEY_SEPARATOR; + return lexical_token_t::KEY_SEPARATOR; } switch (*m_cur_itr) { @@ -2376,18 +2374,18 @@ class lexical_analyzer { return scan_scalar(); } - return m_last_token_type = lexical_token_t::KEY_SEPARATOR; + return lexical_token_t::KEY_SEPARATOR; } case ',': // value separater ++m_cur_itr; - return m_last_token_type = lexical_token_t::VALUE_SEPARATOR; + return lexical_token_t::VALUE_SEPARATOR; case '&': { // anchor prefix extract_anchor_name(); bool is_empty = m_value_buffer.empty(); if (is_empty) { emit_error("anchor name must not be empty."); } - return m_last_token_type = lexical_token_t::ANCHOR_PREFIX; + return lexical_token_t::ANCHOR_PREFIX; } case '*': { // alias prefix extract_anchor_name(); @@ -2396,104 +2394,102 @@ class lexical_analyzer { emit_error("anchor name must not be empty."); } - return m_last_token_type = lexical_token_t::ALIAS_PREFIX; + return lexical_token_t::ALIAS_PREFIX; } case '!': extract_tag_name(); - return m_last_token_type = lexical_token_t::TAG_PREFIX; + return lexical_token_t::TAG_PREFIX; case '#': // comment prefix scan_comment(); return get_next_token(); case '%': // directive prefix - return m_last_token_type = scan_directive(); + return scan_directive(); case '-': { char next = *(m_cur_itr + 1); if (next == ' ') { // Move a cursor to the beginning of the next token. m_cur_itr += 2; - return m_last_token_type = lexical_token_t::SEQUENCE_BLOCK_PREFIX; + return lexical_token_t::SEQUENCE_BLOCK_PREFIX; } bool is_available = (std::distance(m_cur_itr, m_end_itr) > 2); if (is_available) { m_cur_itr += 3; if (std::equal(m_token_begin_itr, m_cur_itr, "---")) { - return m_last_token_type = lexical_token_t::END_OF_DIRECTIVES; + return lexical_token_t::END_OF_DIRECTIVES; } } - return m_last_token_type = scan_scalar(); + return scan_scalar(); } case '[': // sequence flow begin m_flow_context_depth++; ++m_cur_itr; - return m_last_token_type = lexical_token_t::SEQUENCE_FLOW_BEGIN; + return lexical_token_t::SEQUENCE_FLOW_BEGIN; case ']': // sequence flow end if (m_flow_context_depth == 0) { emit_error("An invalid flow sequence ending."); } m_flow_context_depth--; ++m_cur_itr; - return m_last_token_type = lexical_token_t::SEQUENCE_FLOW_END; + return lexical_token_t::SEQUENCE_FLOW_END; case '{': // mapping flow begin m_flow_context_depth++; ++m_cur_itr; - return m_last_token_type = lexical_token_t::MAPPING_FLOW_BEGIN; + return lexical_token_t::MAPPING_FLOW_BEGIN; case '}': // mapping flow end if (m_flow_context_depth == 0) { emit_error("An invalid flow mapping ending."); } m_flow_context_depth--; ++m_cur_itr; - return m_last_token_type = lexical_token_t::MAPPING_FLOW_END; + return lexical_token_t::MAPPING_FLOW_END; case '@': emit_error("Any token cannot start with at(@). It is a reserved indicator for YAML."); case '`': emit_error("Any token cannot start with grave accent(`). It is a reserved indicator for YAML."); case '\"': case '\'': - return m_last_token_type = scan_scalar(); + return scan_scalar(); case '+': - return m_last_token_type = scan_scalar(); + return scan_scalar(); case '.': { bool is_available = (std::distance(m_cur_itr, m_end_itr) > 2); if (is_available) { if (std::equal(m_cur_itr, m_cur_itr + 3, "...")) { m_cur_itr += 3; - return m_last_token_type = lexical_token_t::END_OF_DOCUMENT; + return lexical_token_t::END_OF_DOCUMENT; } } - return m_last_token_type = scan_scalar(); + return scan_scalar(); } case '|': { chomping_indicator_t chomp_type = chomping_indicator_t::KEEP; - std::size_t indent = 0; + uint32_t indent = 0; get_block_style_metadata(chomp_type, indent); - return m_last_token_type = - scan_block_style_string_token(block_style_indicator_t::LITERAL, chomp_type, indent); + return scan_block_style_string_token(block_style_indicator_t::LITERAL, chomp_type, indent); } case '>': { chomping_indicator_t chomp_type = chomping_indicator_t::KEEP; - std::size_t indent = 0; + uint32_t indent = 0; get_block_style_metadata(chomp_type, indent); - return m_last_token_type = - scan_block_style_string_token(block_style_indicator_t::FOLDED, chomp_type, indent); + return scan_block_style_string_token(block_style_indicator_t::FOLDED, chomp_type, indent); } default: - return m_last_token_type = scan_scalar(); + return scan_scalar(); } } /// @brief Get the beginning position of a last token. - /// @return std::size_t The beginning position of a last token. - std::size_t get_last_token_begin_pos() const noexcept { + /// @return uint32_t The beginning position of a last token. + uint32_t get_last_token_begin_pos() const noexcept { return m_last_token_begin_pos; } /// @brief Get the number of lines already processed. - /// @return std::size_t The number of lines already processed. - std::size_t get_lines_processed() const noexcept { + /// @return uint32_t The number of lines already processed. + uint32_t get_lines_processed() const noexcept { return m_last_token_begin_line; } @@ -2504,8 +2500,8 @@ class lexical_analyzer { } /// @brief Convert from string to boolean and get the converted value. - /// @return true A string token is one of the followings: "true", "True", "TRUE". - /// @return false A string token is one of the followings: "false", "False", "FALSE". + /// @retval true A string token is one of the followings: "true", "True", "TRUE". + /// @retval false A string token is one of the followings: "false", "False", "FALSE". boolean_type get_boolean() const { return from_string(m_value_buffer, type_tag {}); } @@ -2928,6 +2924,8 @@ class lexical_analyzer { } std::size_t last_tag_prefix_pos = m_value_buffer.find_last_of('!'); + FK_YAML_ASSERT(last_tag_prefix_pos != std::string::npos); + bool is_valid_uri = uri_encoding::validate(m_value_buffer.begin() + last_tag_prefix_pos + 1, m_value_buffer.end()); if (!is_valid_uri) { @@ -3275,7 +3273,7 @@ class lexical_analyzer { /// @param indent The indent size specified for the given token. /// @return The lexical token type for strings. lexical_token_t scan_block_style_string_token( - block_style_indicator_t style, chomping_indicator_t chomp, std::size_t indent) { + block_style_indicator_t style, chomping_indicator_t chomp, uint32_t indent) { m_value_buffer.clear(); // Handle leading all-space lines. @@ -3305,7 +3303,7 @@ class lexical_analyzer { } m_pos_tracker.update_position(m_cur_itr); - std::size_t cur_indent = m_pos_tracker.get_cur_pos_in_line(); + uint32_t cur_indent = m_pos_tracker.get_cur_pos_in_line(); // TODO: preserve and compare the last indentation with `cur_indent` if (indent == 0) { @@ -3315,16 +3313,16 @@ class lexical_analyzer { emit_error("A block style scalar is less indented than the indicated level."); } - int chars_in_line = 0; + uint32_t chars_in_line = 0; bool is_extra_indented = false; if (cur_indent > indent) { - std::size_t diff = cur_indent - indent; + uint32_t diff = cur_indent - indent; if (style == block_style_indicator_t::FOLDED) { m_value_buffer.push_back('\n'); is_extra_indented = true; } m_value_buffer.append(diff, ' '); - chars_in_line += static_cast(diff); + chars_in_line += diff; } for (char current = 0; m_cur_itr != m_end_itr; ++m_cur_itr) { @@ -3359,7 +3357,7 @@ class lexical_analyzer { // Append a newline if the next line is empty. bool is_end_of_token = false; bool is_next_empty = false; - for (std::size_t i = 0; i < indent; i++) { + for (uint32_t i = 0; i < indent; i++) { if (++m_cur_itr == m_end_itr) { is_end_of_token = true; break; @@ -3566,7 +3564,7 @@ class lexical_analyzer { /// @brief Gets the metadata of a following block style string scalar. /// @param chomp_type A variable to store the retrieved chomping style type. /// @param indent A variable to store the retrieved indent size. - void get_block_style_metadata(chomping_indicator_t& chomp_type, std::size_t& indent) { + void get_block_style_metadata(chomping_indicator_t& chomp_type, uint32_t& indent) { chomp_type = chomping_indicator_t::CLIP; switch (*++m_cur_itr) { case '-': @@ -3665,21 +3663,13 @@ class lexical_analyzer { /// A temporal buffer to store a UTF-8 encoded char sequence. std::array m_encode_buffer {}; /// The actual size of a UTF-8 encoded char sequence. - std::size_t m_encoded_size {0}; + uint32_t m_encoded_size {0}; /// The beginning position of the last lexical token. (zero origin) - std::size_t m_last_token_begin_pos {0}; + uint32_t m_last_token_begin_pos {0}; /// The beginning line of the last lexical token. (zero origin) - std::size_t m_last_token_begin_line {0}; + uint32_t m_last_token_begin_line {0}; /// The current depth of flow context. uint32_t m_flow_context_depth {0}; - /// The last found token type. - lexical_token_t m_last_token_type {lexical_token_t::END_OF_BUFFER}; - /// A temporal bool holder. - boolean_type m_boolean_val {false}; - /// A temporal integer holder. - integer_type m_integer_val {0}; - /// A temporal floating point number holder. - float_number_type m_float_val {0.0}; }; FK_YAML_DETAIL_NAMESPACE_END @@ -3928,27 +3918,41 @@ class basic_deserializer { using sequence_type = typename node_type::sequence_type; /** A type for mapping node value containers. */ using mapping_type = typename node_type::mapping_type; - /** A type for boolean node values. */ - using boolean_type = typename node_type::boolean_type; - /** A type for integer node values. */ - using integer_type = typename node_type::integer_type; - /** A type for float number node values. */ - using float_number_type = typename node_type::float_number_type; /** A type for string node values. */ using string_type = typename node_type::string_type; - struct indentation { - indentation() = default; + /// @brief Definition of state types of parse contexts. + enum class context_state_t { + BLOCK_MAPPING_KEY_IMPLICIT, //!< The underlying node is an implicit block mapping key. + BLOCK_MAPPING_KEY_EXPLICIT, //!< The underlying node is an explicit block mapping key. + BLOCK_SEQUENCE_ENTRY, //!< The underlying node is a sequence. + }; - indentation(std::size_t _line, std::size_t _indent, bool _is_explicit_key) + /// @brief Context information set for parsing. + struct parse_context { + /// @brief Construct a new parse_context object. + parse_context() = default; + + /// @brief Construct a new parse_context object with non-default values for each parameter. + /// @param _line The current line. (count from zero) + /// @param _indent The indentation width in the current line. (count from zero) + /// @param _state The parse context type. + /// @param _p_node The underlying node associated to this context. + parse_context(uint32_t _line, uint32_t _indent, context_state_t _state, node_type* _p_node) : line(_line), indent(_indent), - is_explicit_key(_is_explicit_key) { - } - - std::size_t line {0}; - std::size_t indent {0}; - bool is_explicit_key {false}; + state(_state), + p_node(_p_node) { + } + + /// The current line. (count from zero) + uint32_t line {0}; + /// The indentation width in the current line. (count from zero) + uint32_t indent {0}; + /// The parse context type. + context_state_t state {context_state_t::BLOCK_MAPPING_KEY_IMPLICIT}; + /// The underlying node associated to this context. + node_type* p_node {nullptr}; }; public: @@ -3957,30 +3961,39 @@ class basic_deserializer { public: /// @brief Deserialize a YAML-formatted source string into a YAML node. - /// @param source A YAML-formatted source string. - /// @return node_type A root YAML node deserialized from the source string. + /// @param input_adapter An adapter object for the input source buffer. + /// @return node_type A root YAML node object deserialized from the source string. template ::value, int> = 0> node_type deserialize(InputAdapterType&& input_adapter) { lexer_type lexer(std::forward(input_adapter)); lexical_token_t type {lexical_token_t::END_OF_BUFFER}; - node_type root = node_type::mapping(); - mp_current_node = &root; + node_type root; // parse directives first. - deserialize_directives(lexer, root, type); + deserialize_directives(lexer, type); switch (type) { case lexical_token_t::SEQUENCE_BLOCK_PREFIX: - case lexical_token_t::SEQUENCE_FLOW_BEGIN: + case lexical_token_t::SEQUENCE_FLOW_BEGIN: { root = node_type::sequence(); apply_directive_set(root); - m_indent_stack.emplace_back(lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), false); + parse_context context( + lexer.get_lines_processed(), + lexer.get_last_token_begin_pos(), + context_state_t::BLOCK_SEQUENCE_ENTRY, + &root); + m_context_stack.emplace_back(std::move(context)); break; + } default: + root = node_type::mapping(); + apply_directive_set(root); break; } + mp_current_node = &root; + // parse YAML nodes recursively deserialize_node(lexer, type); @@ -3989,8 +4002,7 @@ class basic_deserializer { mp_directive_set.reset(); m_needs_anchor_impl = false; m_anchor_table.clear(); - m_node_stack.clear(); - m_indent_stack.clear(); + m_context_stack.clear(); return root; } @@ -3998,9 +4010,8 @@ class basic_deserializer { private: /// @brief Deserializes the YAML directives if specified. /// @param lexer The lexical analyzer to be used. - /// @param root The root YAML node. - /// @param type The variable to store the last lexical token type. - void deserialize_directives(lexer_type& lexer, node_type& root, lexical_token_t& last_type) { + /// @param last_type The variable to store the last lexical token type. + void deserialize_directives(lexer_type& lexer, lexical_token_t& last_type) { for (;;) { lexical_token_t type = lexer.get_next_token(); @@ -4009,9 +4020,6 @@ class basic_deserializer { if (!mp_directive_set) { mp_directive_set = std::shared_ptr(new directive_set()); } - if (!root.mp_directive_set) { - root.mp_directive_set = mp_directive_set; - } if (mp_directive_set->is_version_specified) { throw parse_error( @@ -4027,9 +4035,6 @@ class basic_deserializer { if (!mp_directive_set) { mp_directive_set = std::shared_ptr(new directive_set()); } - if (!root.mp_directive_set) { - root.mp_directive_set = mp_directive_set; - } const std::string& tag_handle = lexer.get_tag_handle(); switch (tag_handle.size()) { @@ -4088,8 +4093,8 @@ class basic_deserializer { /// @param first_type The first lexical token type. void deserialize_node(lexer_type& lexer, lexical_token_t first_type) { lexical_token_t type = first_type; - std::size_t line = lexer.get_lines_processed(); - std::size_t indent = lexer.get_last_token_begin_pos(); + uint32_t line = lexer.get_lines_processed(); + uint32_t indent = lexer.get_last_token_begin_pos(); do { switch (type) { @@ -4097,33 +4102,45 @@ class basic_deserializer { // This handles an empty input. break; case lexical_token_t::EXPLICIT_KEY_PREFIX: { - bool needs_to_move_back = !m_indent_stack.empty() && indent < m_indent_stack.back().indent; + bool needs_to_move_back = !m_context_stack.empty() && indent < m_context_stack.back().indent; if (needs_to_move_back) { auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_indent_stack.rbegin(), - m_indent_stack.rend(), - [indent](const indentation& i) { return indent > i.indent; }); + m_context_stack.rbegin(), + m_context_stack.rend(), + [indent](const parse_context& c) { return indent > c.indent; }); - auto pop_num = std::distance(m_indent_stack.rbegin(), target_itr); + auto pop_num = std::distance(m_context_stack.rbegin(), target_itr); for (auto i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } } if (mp_current_node->is_null()) { + // This path is needed in case the input contains nested explicit keys like the following YAML + // snippet: + // ```yaml + // ? ? foo + // : bar + // : baz + // ``` *mp_current_node = node_type::mapping(); + apply_directive_set(*mp_current_node); } - m_node_stack.push_back(mp_current_node); - m_indent_stack.emplace_back(line, indent, true); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_KEY_EXPLICIT, mp_current_node); type = lexer.get_next_token(); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { - m_indent_stack.emplace_back(lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), false); mp_current_node = new node_type(node_t::SEQUENCE); + parse_context context( + lexer.get_lines_processed(), + lexer.get_last_token_begin_pos(), + context_state_t::BLOCK_SEQUENCE_ENTRY, + mp_current_node); + m_context_stack.emplace_back(std::move(context)); apply_directive_set(*mp_current_node); break; } @@ -4142,8 +4159,8 @@ class basic_deserializer { } // hold the line count of the key separator for later use. - std::size_t old_indent = indent; - std::size_t old_line = line; + uint32_t old_indent = indent; + uint32_t old_line = line; type = lexer.get_next_token(); line = lexer.get_lines_processed(); @@ -4159,7 +4176,7 @@ class basic_deserializer { indent = lexer.get_last_token_begin_pos(); bool is_implicit_same_line = - (line == old_line) && (m_indent_stack.empty() || old_indent > m_indent_stack.back().indent); + (line == old_line) && (m_context_stack.empty() || old_indent > m_context_stack.back().indent); if (is_implicit_same_line) { // a key separator for an implicit key with its value on the same line. continue; @@ -4192,13 +4209,13 @@ class basic_deserializer { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); do_continue = false; break; case lexical_token_t::EXPLICIT_KEY_PREFIX: // a key separator for a explicit block mapping key. - *mp_current_node = node_type::mapping(); - apply_directive_set(*mp_current_node); + // defer the handling of the explicit key prefix token until the next loop. break; // defer checking the existence of a key separator after the scalar until a deserialize_scalar() // call. @@ -4223,39 +4240,24 @@ class basic_deserializer { // handle explicit mapping key separators. - while (!m_indent_stack.back().is_explicit_key) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); - } - - if (m_node_stack.back()->is_sequence()) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - } - if (m_node_stack.back() == mp_current_node) { - // This path is for nested explicit mapping keys like: - // ```yaml - // ? ? foo - // : bar - // : baz - // ``` - m_node_stack.pop_back(); + while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } node_type* key_node = mp_current_node; - m_node_stack.back()->template get_value_ref().emplace(*key_node, node_type()); - mp_current_node = &(m_node_stack.back()->operator[](*key_node)); + m_context_stack.back().p_node->template get_value_ref().emplace(*key_node, node_type()); + mp_current_node = &(m_context_stack.back().p_node->operator[](*key_node)); delete key_node; key_node = nullptr; - m_node_stack.push_back(m_node_stack.back()); - m_indent_stack.back().is_explicit_key = false; + m_context_stack.back().state = context_state_t::BLOCK_MAPPING_KEY_IMPLICIT; + m_context_stack.emplace_back(m_context_stack.back()); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); break; } @@ -4284,36 +4286,37 @@ class basic_deserializer { if (mp_current_node->is_sequence()) { bool is_empty = mp_current_node->empty(); if (is_empty) { - bool is_further_nested = !m_indent_stack.empty() && m_indent_stack.back().indent < indent; + bool is_further_nested = !m_context_stack.empty() && m_context_stack.back().indent < indent; if (is_further_nested) { mp_current_node->template get_value_ref().emplace_back( node_type::sequence()); - m_node_stack.push_back(mp_current_node); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->template get_value_ref().back()); + break; } - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); break; } // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent != m_indent_stack.back().indent) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + while (!mp_current_node->is_sequence() || indent < m_context_stack.back().indent) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } break; } // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent != m_indent_stack.back().indent) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + while (!mp_current_node->is_sequence() || indent != m_context_stack.back().indent) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } // for mappings in a sequence. mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_node_stack.push_back(mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->template get_value_ref().back()); apply_directive_set(*mp_current_node); break; @@ -4326,11 +4329,8 @@ class basic_deserializer { case lexical_token_t::SEQUENCE_FLOW_END: { FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - bool is_stack_empty = m_node_stack.empty(); - if (!is_stack_empty) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - } + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); break; } case lexical_token_t::MAPPING_FLOW_BEGIN: @@ -4342,10 +4342,10 @@ class basic_deserializer { case lexical_token_t::MAPPING_FLOW_END: { FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - bool is_stack_empty = m_node_stack.empty(); + bool is_stack_empty = m_context_stack.empty(); if (!is_stack_empty) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } break; } @@ -4379,9 +4379,8 @@ class basic_deserializer { /// @param line The variable to store the line of either the first property or the last non-property token. /// @param indent The variable to store the indent of either the first property or the last non-property token. /// @return true if any property is found, false otherwise. - bool deserialize_node_properties( - lexer_type& lexer, lexical_token_t& last_type, std::size_t& line, std::size_t& indent) { - std::set prop_types {lexical_token_t::ANCHOR_PREFIX, lexical_token_t::TAG_PREFIX}; + bool deserialize_node_properties(lexer_type& lexer, lexical_token_t& last_type, uint32_t& line, uint32_t& indent) { + m_needs_anchor_impl = m_needs_tag_impl = false; lexical_token_t type = last_type; bool ends_loop {false}; @@ -4391,90 +4390,85 @@ class basic_deserializer { } switch (type) { - case lexical_token_t::ANCHOR_PREFIX: { - bool already_specified = prop_types.find(type) == prop_types.end(); - if (already_specified) { + case lexical_token_t::ANCHOR_PREFIX: + if (m_needs_anchor_impl) { throw parse_error( "anchor name cannot be specified more than once to the same node.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - prop_types.erase(type); m_anchor_name = lexer.get_string(); m_needs_anchor_impl = true; - if (prop_types.size() == 1) { + if (!m_needs_tag_impl) { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); } + type = lexer.get_next_token(); break; - } case lexical_token_t::TAG_PREFIX: { - bool already_specified = prop_types.find(type) == prop_types.end(); - if (already_specified) { + if (m_needs_tag_impl) { throw parse_error( "tag name cannot be specified more than once to the same node.", lexer.get_lines_processed(), lexer.get_last_token_begin_pos()); } - prop_types.erase(type); m_tag_name = lexer.get_string(); m_needs_tag_impl = true; - if (prop_types.size() == 1) { + if (!m_needs_anchor_impl) { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); } + type = lexer.get_next_token(); break; } default: ends_loop = true; break; } - - if (!ends_loop) { - type = lexer.get_next_token(); - } } while (!ends_loop); last_type = type; - if (prop_types.size() == 2) { + bool prop_specified = m_needs_anchor_impl || m_needs_tag_impl; + if (!prop_specified) { line = lexer.get_lines_processed(); indent = lexer.get_last_token_begin_pos(); } - return prop_types.size() < 2; + return prop_specified; } /// @brief Add new key string to the current YAML node. /// @param key a key string to be added to the current YAML node. - void add_new_key(node_type&& key, const std::size_t indent, const std::size_t line) { - if (!m_indent_stack.empty() && indent < m_indent_stack.back().indent) { + /// @param indent The indentation width in the current line where the key is found. + /// @param line The line where the key is found. + void add_new_key(node_type&& key, const uint32_t indent, const uint32_t line) { + if (!m_context_stack.empty() && indent < m_context_stack.back().indent) { auto target_itr = - std::find_if(m_indent_stack.rbegin(), m_indent_stack.rend(), [indent](const indentation& i) { - return indent == i.indent; + std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), [indent](const parse_context& c) { + return indent == c.indent; }); - bool is_indent_valid = (target_itr != m_indent_stack.rend()); + bool is_indent_valid = (target_itr != m_context_stack.rend()); if (!is_indent_valid) { throw parse_error("Detected invalid indentaion.", line, indent); } - auto pop_num = std::distance(m_indent_stack.rbegin(), target_itr); + auto pop_num = std::distance(m_context_stack.rbegin(), target_itr) + 1; for (auto i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); - m_indent_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } } if (mp_current_node->is_sequence()) { mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_node_stack.push_back(mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); } @@ -4482,7 +4476,8 @@ class basic_deserializer { bool is_empty = map.empty(); if (is_empty) { if (m_flow_context_depth == 0) { - m_indent_stack.emplace_back(line, indent, false); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); } } else { @@ -4494,8 +4489,8 @@ class basic_deserializer { } map.emplace(key, node_type()); - m_node_stack.push_back(mp_current_node); - mp_current_node = &(mp_current_node->operator[](key)); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); + mp_current_node = &(mp_current_node->operator[](std::move(key))); } /// @brief Assign node value to the current node. @@ -4508,9 +4503,9 @@ class basic_deserializer { // a scalar node *mp_current_node = std::move(node_value); - if (m_flow_context_depth > 0 || !m_indent_stack.back().is_explicit_key) { - mp_current_node = m_node_stack.back(); - m_node_stack.pop_back(); + if (m_flow_context_depth > 0 || m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } } @@ -4520,7 +4515,7 @@ class basic_deserializer { /// @param indent The last indent size. /// @param line The last line. /// @return The created YAML scalar node. - node_type create_scalar_node(lexer_type& lexer, lexical_token_t type, std::size_t indent, std::size_t line) { + node_type create_scalar_node(lexer_type& lexer, lexical_token_t type, uint32_t indent, uint32_t line) { FK_YAML_ASSERT( type == lexical_token_t::NULL_VALUE || type == lexical_token_t::BOOLEAN_VALUE || type == lexical_token_t::INTEGER_VALUE || type == lexical_token_t::FLOAT_NUMBER_VALUE || @@ -4599,11 +4594,12 @@ class basic_deserializer { } /// @brief Deserialize a detected scalar node. + /// @param lexer The lexical analyzer to be used. /// @param node A detected scalar node by a lexer. /// @param indent The current indentation width. Can be updated in this function. /// @param line The number of processed lines. Can be updated in this function. /// @return true if next token has already been got, false otherwise. - bool deserialize_scalar(lexer_type& lexer, std::size_t& indent, std::size_t& line, lexical_token_t& type) { + bool deserialize_scalar(lexer_type& lexer, uint32_t& indent, uint32_t& line, lexical_token_t& type) { node_type node = create_scalar_node(lexer, type, indent, line); if (mp_current_node->is_mapping()) { @@ -4617,16 +4613,17 @@ class basic_deserializer { if (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator(:) assign_node_value(std::move(node)); - if (!m_indent_stack.back().is_explicit_key) { - m_indent_stack.pop_back(); + if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); } indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); return true; } - indentation& last_indent = m_indent_stack.back(); - if (last_indent.line == line && !last_indent.is_explicit_key) { + parse_context& last_context = m_context_stack.back(); + if (last_context.line == line && last_context.state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { throw parse_error("multiple mapping keys are specified on the same line.", line, indent); } @@ -4677,12 +4674,10 @@ class basic_deserializer { private: /// The currently focused YAML node. node_type* mp_current_node {nullptr}; - /// The stack of YAML nodes. - std::deque m_node_stack {}; - /// The stack of indentation widths. - std::deque m_indent_stack {}; + /// The stack of parse contexts. + std::deque m_context_stack {}; /// The current depth of flow contexts. - std::size_t m_flow_context_depth {0}; + uint32_t m_flow_context_depth {0}; /// The set of YAML directives. std::shared_ptr mp_directive_set {}; /// A flag to determine the need for YAML anchor node implementation. @@ -4850,7 +4845,7 @@ inline utf_encode_t detect_encoding_and_skip_bom(ItrType& begin, const ItrType& std::array bytes = {{0xFFu, 0xFFu, 0xFFu, 0xFFu}}; switch (ElemSize) { case sizeof(char): { // this case covers char8_t as well when compiled with C++20 or better. - for (std::size_t i = 0; i < 4 && begin + i != end; i++) { + for (int i = 0; i < 4 && begin + i != end; i++) { bytes[i] = uint8_t(begin[i]); } @@ -4930,7 +4925,7 @@ inline utf_encode_t detect_encoding_and_skip_bom(ItrType& begin, const ItrType& inline utf_encode_t detect_encoding_and_skip_bom(std::FILE* file) noexcept { std::array bytes = {{0xFFu, 0xFFu, 0xFFu, 0xFFu}}; - for (std::size_t i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { char byte = 0; std::size_t size = std::fread(&byte, sizeof(char), 1, file); if (size != sizeof(char)) { @@ -4966,7 +4961,7 @@ inline utf_encode_t detect_encoding_and_skip_bom(std::FILE* file) noexcept { inline utf_encode_t detect_encoding_and_skip_bom(std::istream& is) noexcept { std::array bytes = {{0xFFu, 0xFFu, 0xFFu, 0xFFu}}; - for (std::size_t i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { char ch = 0; is.read(&ch, 1); std::streamsize size = is.gcount(); @@ -5133,9 +5128,9 @@ class iterator_input_adapter< } std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end || encoded_buf_size != 0) { while (m_current != m_end && encoded_buf_size < 2) { @@ -5143,7 +5138,7 @@ class iterator_input_adapter< encoded_buffer[encoded_buf_size++] |= static_cast(uint8_t(*m_current++) << shift_bits[1]); } - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -5175,7 +5170,7 @@ class iterator_input_adapter< } std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end) { char32_t utf32 = static_cast(*m_current++ << shift_bits[0]); @@ -5320,9 +5315,9 @@ class iterator_input_adapter< int shift_bits = (m_encode_type == utf_encode_t::UTF_16BE) ? 0 : 8; std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end || encoded_buf_size != 0) { while (m_current != m_end && encoded_buf_size < 2) { @@ -5332,7 +5327,7 @@ class iterator_input_adapter< static_cast((tmp & 0xFF00u) >> shift_bits)); } - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -5394,7 +5389,7 @@ class iterator_input_adapter< } std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (m_current != m_end) { char32_t tmp = *m_current++; @@ -5528,9 +5523,9 @@ class file_input_adapter { char chars[2] = {0, 0}; std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (std::feof(m_file) == 0) { while (encoded_buf_size < 2 && std::fread(&chars[0], sizeof(char), 2, m_file) == 2) { @@ -5539,7 +5534,7 @@ class file_input_adapter { static_cast(uint8_t(chars[1]) << shift_bits[1])); } - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -5572,7 +5567,7 @@ class file_input_adapter { char chars[4] = {0, 0, 0, 0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; while (std::feof(m_file) == 0) { std::size_t size = std::fread(&chars[0], sizeof(char), 4, m_file); @@ -5705,9 +5700,9 @@ class stream_input_adapter { char chars[2] = {0, 0}; std::array encoded_buffer {{0, 0}}; - std::size_t encoded_buf_size {0}; + uint32_t encoded_buf_size {0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; do { while (encoded_buf_size < 2) { @@ -5722,7 +5717,7 @@ class stream_input_adapter { static_cast(uint8_t(chars[1]) << shift_bits[1])); }; - std::size_t consumed_size = 0; + uint32_t consumed_size = 0; utf8::from_utf16(encoded_buffer, utf8_buffer, consumed_size, utf8_buf_size); if (consumed_size == 1) { @@ -5755,7 +5750,7 @@ class stream_input_adapter { char chars[4] = {0, 0, 0, 0}; std::array utf8_buffer {{0, 0, 0, 0}}; - std::size_t utf8_buf_size {0}; + uint32_t utf8_buf_size {0}; do { m_istream->read(&chars[0], 4); diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index a26f222d..76c74804 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -179,28 +179,20 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(root.is_mapping()); REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_sequence()); REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 2); - REQUIRE_NOTHROW(test_node[0]); fkyaml::node& test_0_node = test_node[0]; REQUIRE(test_0_node.is_string()); - REQUIRE_NOTHROW(test_0_node.size()); - REQUIRE(test_0_node.size() == 3); - REQUIRE_NOTHROW(test_0_node.get_value_ref()); - REQUIRE(test_0_node.get_value_ref().compare("foo") == 0); + REQUIRE(test_0_node.get_value_ref() == "foo"); - REQUIRE_NOTHROW(test_node[1]); fkyaml::node& test_1_node = test_node[1]; REQUIRE(test_1_node.is_string()); - REQUIRE_NOTHROW(test_1_node.size()); - REQUIRE(test_1_node.size() == 3); - REQUIRE_NOTHROW(test_1_node.get_value_ref()); - REQUIRE(test_1_node.get_value_ref().compare("bar") == 0); + REQUIRE(test_1_node.get_value_ref() == "bar"); } SECTION("block sequence with nested mappings") { @@ -215,44 +207,36 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_sequence()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 2); - REQUIRE_NOTHROW(test_node[0]); fkyaml::node& test_0_node = test_node[0]; REQUIRE(test_0_node.is_mapping()); - REQUIRE_NOTHROW(test_0_node.size()); REQUIRE(test_0_node.size() == 2); + REQUIRE(test_0_node.contains("foo")); + REQUIRE(test_0_node.contains("bar")); - REQUIRE_NOTHROW(test_0_node["foo"]); fkyaml::node& test_0_foo_node = test_0_node["foo"]; REQUIRE(test_0_foo_node.is_boolean()); - REQUIRE_NOTHROW(test_0_foo_node.get_value()); - REQUIRE(test_0_foo_node.get_value() == true); + REQUIRE(test_0_foo_node.get_value() == true); - REQUIRE_NOTHROW(test_0_node["bar"]); fkyaml::node& test_0_bar_node = test_0_node["bar"]; REQUIRE(test_0_bar_node.is_string()); - REQUIRE_NOTHROW(test_0_bar_node.get_value_ref()); - REQUIRE(test_0_bar_node.get_value_ref().compare("one") == 0); + REQUIRE(test_0_bar_node.get_value_ref() == "one"); - REQUIRE_NOTHROW(test_node[1]); fkyaml::node& test_1_node = test_node[1]; REQUIRE(test_1_node.is_mapping()); REQUIRE_NOTHROW(test_1_node.size()); REQUIRE(test_1_node.size() == 2); + REQUIRE(test_1_node.contains("foo")); + REQUIRE(test_1_node.contains("bar")); - REQUIRE_NOTHROW(test_1_node["foo"]); fkyaml::node& test_1_foo_node = test_1_node["foo"]; REQUIRE(test_1_foo_node.is_boolean()); - REQUIRE_NOTHROW(test_1_foo_node.get_value()); - REQUIRE(test_1_foo_node.get_value() == false); + REQUIRE(test_1_foo_node.get_value() == false); - REQUIRE_NOTHROW(test_1_node["bar"]); fkyaml::node& test_1_bar_node = test_1_node["bar"]; REQUIRE(test_1_bar_node.is_string()); - REQUIRE_NOTHROW(test_1_bar_node.get_value_ref()); - REQUIRE(test_1_bar_node.get_value_ref().compare("two") == 0); + REQUIRE(test_1_bar_node.get_value_ref() == "two"); } SECTION("block mapping with a comment in between") { @@ -263,15 +247,18 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(root.size() == 1); REQUIRE(root.contains("test")); - REQUIRE(root["test"].is_sequence()); - REQUIRE(root["test"].size() == 1); + fkyaml::node& test_node = root["test"]; + REQUIRE(test_node.is_sequence()); + REQUIRE(test_node.size() == 1); - REQUIRE(root["test"][0].is_mapping()); - REQUIRE(root["test"][0].size() == 1); - REQUIRE(root["test"][0].contains("item")); + fkyaml::node& test_0_node = test_node[0]; + REQUIRE(test_0_node.is_mapping()); + REQUIRE(test_0_node.size() == 1); + REQUIRE(test_0_node.contains("item")); - REQUIRE(root["test"][0]["item"].is_integer()); - REQUIRE(root["test"][0]["item"].get_value() == 123); + fkyaml::node& test_0_item_node = test_0_node["item"]; + REQUIRE(test_0_item_node.is_integer()); + REQUIRE(test_0_item_node.get_value() == 123); } SECTION("block mapping with a comment next to the key") { @@ -281,11 +268,13 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(root.size() == 1); REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_sequence()); - REQUIRE(root["foo"].size() == 1); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_sequence()); + REQUIRE(foo_node.size() == 1); - REQUIRE(root["foo"][0].is_string()); - REQUIRE(root["foo"][0].get_value_ref() == "bar"); + fkyaml::node& foo_0_node = foo_node[0]; + REQUIRE(foo_0_node.is_string()); + REQUIRE(foo_0_node.get_value_ref() == "bar"); } SECTION("root sequence") { @@ -294,14 +283,17 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(root.is_sequence()); REQUIRE(root.size() == 3); - REQUIRE(root[0].is_string()); - REQUIRE(root[0].get_value_ref() == "foo"); + fkyaml::node& root_0_node = root[0]; + REQUIRE(root_0_node.is_string()); + REQUIRE(root_0_node.get_value_ref() == "foo"); - REQUIRE(root[1].is_integer()); - REQUIRE(root[1].get_value() == 123); + fkyaml::node& root_1_node = root[1]; + REQUIRE(root_1_node.is_integer()); + REQUIRE(root_1_node.get_value() == 123); - REQUIRE(root[2].is_float_number()); - REQUIRE(root[2].get_value() == 3.14); + fkyaml::node& root_2_node = root[2]; + REQUIRE(root_2_node.is_float_number()); + REQUIRE(root_2_node.get_value() == 3.14); } SECTION("root sequence with nested child block sequence") { @@ -313,15 +305,21 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(root.is_sequence()); REQUIRE(root.size() == 2); - REQUIRE(root[0].is_sequence()); - REQUIRE(root[0].size() == 2); - REQUIRE(root[0][0].is_string()); - REQUIRE(root[0][0].get_value_ref() == "foo"); - REQUIRE(root[0][1].is_integer()); - REQUIRE(root[0][1].get_value() == 123); + fkyaml::node& root_0_node = root[0]; + REQUIRE(root_0_node.is_sequence()); + REQUIRE(root_0_node.size() == 2); + + fkyaml::node& root_0_0_node = root_0_node[0]; + REQUIRE(root_0_0_node.is_string()); + REQUIRE(root_0_0_node.get_value_ref() == "foo"); - REQUIRE(root[1].is_float_number()); - REQUIRE(root[1].get_value() == 3.14); + fkyaml::node& root_0_1_node = root_0_node[1]; + REQUIRE(root_0_1_node.is_integer()); + REQUIRE(root_0_1_node.get_value() == 123); + + fkyaml::node& root_1_node = root[1]; + REQUIRE(root_1_node.is_float_number()); + REQUIRE(root_1_node.get_value() == 3.14); } } @@ -335,24 +333,21 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 3); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("bar")); + REQUIRE(root.contains("pi")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; REQUIRE(foo_node.is_string()); - REQUIRE_NOTHROW(foo_node.get_value_ref()); - REQUIRE(foo_node.get_value_ref().compare("one") == 0); + REQUIRE(foo_node.get_value_ref() == "one"); - REQUIRE_NOTHROW(root["bar"]); fkyaml::node& bar_node = root["bar"]; REQUIRE(bar_node.is_boolean()); - REQUIRE_NOTHROW(bar_node.get_value()); - REQUIRE(bar_node.get_value() == true); + REQUIRE(bar_node.get_value() == true); - REQUIRE_NOTHROW(root["pi"]); fkyaml::node& pi_node = root["pi"]; REQUIRE(pi_node.is_float_number()); - REQUIRE_NOTHROW(pi_node.get_value()); - REQUIRE(pi_node.get_value() == 3.14); + REQUIRE(pi_node.get_value() == 3.14); } SECTION("nested block mapping") { @@ -363,30 +358,27 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_mapping()); REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 3); + REQUIRE(test_node.contains("bool")); + REQUIRE(test_node.contains("foo")); + REQUIRE(test_node.contains("pi")); - REQUIRE_NOTHROW(test_node["bool"]); fkyaml::node& test_bool_node = test_node["bool"]; REQUIRE(test_bool_node.is_boolean()); - REQUIRE_NOTHROW(test_bool_node.get_value()); - REQUIRE(test_bool_node.get_value() == true); + REQUIRE(test_bool_node.get_value() == true); - REQUIRE_NOTHROW(test_node["foo"]); fkyaml::node& test_foo_node = test_node["foo"]; REQUIRE(test_foo_node.is_string()); - REQUIRE_NOTHROW(test_foo_node.get_value_ref()); - REQUIRE(test_foo_node.get_value_ref().compare("bar") == 0); + REQUIRE(test_foo_node.get_value_ref().compare("bar") == 0); - REQUIRE_NOTHROW(test_node["pi"]); fkyaml::node& test_pi_node = test_node["pi"]; REQUIRE(test_pi_node.is_float_number()); - REQUIRE_NOTHROW(test_pi_node.get_value()); - REQUIRE(test_pi_node.get_value() == 3.14); + REQUIRE(test_pi_node.get_value() == 3.14); } SECTION("block mapping with several nested children") { @@ -396,24 +388,31 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 3); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_mapping()); - REQUIRE(root["foo"].size() == 1); - REQUIRE(root["foo"].contains("bar")); - REQUIRE(root["foo"]["bar"].is_string()); - REQUIRE(root["foo"]["bar"].get_value_ref() == "baz"); - REQUIRE(root.contains("qux")); - REQUIRE(root["qux"].is_integer()); - REQUIRE(root["qux"].get_value() == 123); - REQUIRE(root.contains("quux")); - REQUIRE(root["quux"].is_mapping()); - REQUIRE(root["quux"].size() == 1); - REQUIRE(root["quux"].contains("corge")); - REQUIRE(root["quux"]["corge"].is_string()); - REQUIRE(root["quux"]["corge"].get_value_ref() == "grault"); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_mapping()); + REQUIRE(foo_node.size() == 1); + REQUIRE(foo_node.contains("bar")); + + fkyaml::node& foo_bar_node = foo_node["bar"]; + REQUIRE(foo_bar_node.is_string()); + REQUIRE(foo_bar_node.get_value_ref() == "baz"); + + fkyaml::node& qux_node = root["qux"]; + REQUIRE(qux_node.is_integer()); + REQUIRE(qux_node.get_value() == 123); + + fkyaml::node& quux_node = root["quux"]; + REQUIRE(quux_node.is_mapping()); + REQUIRE(quux_node.size() == 1); + REQUIRE(quux_node.contains("corge")); + + fkyaml::node& quux_corge_node = quux_node["corge"]; + REQUIRE(quux_corge_node.is_string()); + REQUIRE(quux_corge_node.get_value_ref() == "grault"); } SECTION("block mapping with a more nested child") { @@ -422,22 +421,26 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_mapping()); - REQUIRE(root["foo"].size() == 1); + REQUIRE(root.contains("qux")); - REQUIRE(root["foo"].contains("bar")); - REQUIRE(root["foo"]["bar"].is_mapping()); - REQUIRE(root["foo"]["bar"].size() == 1); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_mapping()); + REQUIRE(foo_node.size() == 1); + REQUIRE(foo_node.contains("bar")); - REQUIRE(root["foo"]["bar"].contains("baz")); - REQUIRE(root["foo"]["bar"]["baz"].is_integer()); - REQUIRE(root["foo"]["bar"]["baz"].get_value() == 123); + fkyaml::node& foo_bar_node = foo_node["bar"]; + REQUIRE(foo_bar_node.is_mapping()); + REQUIRE(foo_bar_node.size() == 1); + REQUIRE(foo_bar_node.contains("baz")); - REQUIRE(root.contains("qux")); - REQUIRE(root["qux"].is_boolean()); - REQUIRE(root["qux"].get_value() == true); + fkyaml::node& foo_bar_baz_node = foo_bar_node["baz"]; + REQUIRE(foo_bar_baz_node.is_integer()); + REQUIRE(foo_bar_baz_node.get_value() == 123); + + fkyaml::node& qux_node = root["qux"]; + REQUIRE(qux_node.is_boolean()); + REQUIRE(qux_node.get_value() == true); } SECTION("block mapping with a child block sequence") { @@ -446,20 +449,24 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_sequence()); - REQUIRE(root["foo"].size() == 2); + REQUIRE(root.contains("baz")); - REQUIRE(root["foo"][0].is_string()); - REQUIRE(root["foo"][0].get_value_ref() == "bar"); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_sequence()); + REQUIRE(foo_node.size() == 2); - REQUIRE(root["foo"][1].is_integer()); - REQUIRE(root["foo"][1].get_value() == 123); + fkyaml::node& foo_0_node = foo_node[0]; + REQUIRE(foo_0_node.is_string()); + REQUIRE(foo_0_node.get_value_ref() == "bar"); - REQUIRE(root.contains("baz")); - REQUIRE(root["baz"].is_string()); - REQUIRE(root["baz"].get_value_ref() == "qux"); + fkyaml::node& foo_1_node = foo_node[1]; + REQUIRE(foo_1_node.is_integer()); + REQUIRE(foo_1_node.get_value() == 123); + + fkyaml::node& baz_node = root["baz"]; + REQUIRE(baz_node.is_string()); + REQUIRE(baz_node.get_value_ref() == "qux"); } SECTION("block mapping with a block sequence of a single nested mapping") { @@ -468,21 +475,25 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_sequence()); - REQUIRE(root["foo"].size() == 1); + REQUIRE(root.contains("qux")); - REQUIRE(root["foo"][0].is_mapping()); - REQUIRE(root["foo"][0].size() == 1); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_sequence()); + REQUIRE(foo_node.size() == 1); - REQUIRE(root["foo"][0].contains("bar")); - REQUIRE(root["foo"][0]["bar"].is_string()); - REQUIRE(root["foo"][0]["bar"].get_value_ref() == "baz"); + fkyaml::node& foo_0_node = foo_node[0]; + REQUIRE(foo_0_node.is_mapping()); + REQUIRE(foo_0_node.size() == 1); + REQUIRE(foo_0_node.contains("bar")); - REQUIRE(root.contains("qux")); - REQUIRE(root["qux"].is_string()); - REQUIRE(root["qux"].get_value_ref() == "corge"); + fkyaml::node& foo_0_bar_node = foo_0_node["bar"]; + REQUIRE(foo_0_bar_node.is_string()); + REQUIRE(foo_0_bar_node.get_value_ref() == "baz"); + + fkyaml::node& qux_node = root["qux"]; + REQUIRE(qux_node.is_string()); + REQUIRE(qux_node.get_value_ref() == "corge"); } SECTION("block mapping with a block sequence of a block mapping with several key-value pairs") { @@ -492,25 +503,30 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_sequence()); - REQUIRE(root["foo"].size() == 1); + REQUIRE(root.contains("qux")); - REQUIRE(root["foo"][0].is_mapping()); - REQUIRE(root["foo"][0].size() == 2); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_sequence()); + REQUIRE(foo_node.size() == 1); - REQUIRE(root["foo"][0].contains("bar")); - REQUIRE(root["foo"][0]["bar"].is_boolean()); - REQUIRE(root["foo"][0]["bar"].get_value() == true); + fkyaml::node& foo_0_node = foo_node[0]; + REQUIRE(foo_0_node.is_mapping()); + REQUIRE(foo_0_node.size() == 2); + REQUIRE(foo_0_node.contains("bar")); + REQUIRE(foo_0_node.contains("baz")); - REQUIRE(root["foo"][0].contains("baz")); - REQUIRE(root["foo"][0]["baz"].is_integer()); - REQUIRE(root["foo"][0]["baz"].get_value() == 123); + fkyaml::node& foo_0_bar_node = foo_0_node["bar"]; + REQUIRE(foo_0_bar_node.is_boolean()); + REQUIRE(foo_0_bar_node.get_value() == true); - REQUIRE(root.contains("qux")); - REQUIRE(root["qux"].is_string()); - REQUIRE(root["qux"].get_value_ref() == "corge"); + fkyaml::node& foo_0_baz_node = foo_0_node["baz"]; + REQUIRE(foo_0_baz_node.is_integer()); + REQUIRE(foo_0_baz_node.get_value() == 123); + + fkyaml::node& qux_node = root["qux"]; + REQUIRE(qux_node.is_string()); + REQUIRE(qux_node.get_value_ref() == "corge"); } SECTION("block mapping with a block sequence of block mappings") { @@ -528,47 +544,58 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); - REQUIRE(root.contains("stuff")); - REQUIRE(root["stuff"].is_sequence()); - REQUIRE(root["stuff"].size() == 2); - REQUIRE(root["stuff"][0].is_mapping()); - REQUIRE(root["stuff"][0].size() == 4); + fkyaml::node& stuff_node = root["stuff"]; + REQUIRE(stuff_node.is_sequence()); + REQUIRE(stuff_node.size() == 2); + + fkyaml::node& stuff_0_node = stuff_node[0]; + REQUIRE(stuff_0_node.is_mapping()); + REQUIRE(stuff_0_node.size() == 4); + REQUIRE(stuff_0_node.contains("id")); + REQUIRE(stuff_0_node.contains("name")); + REQUIRE(stuff_0_node.contains("tags")); + REQUIRE(stuff_0_node.contains("params")); - REQUIRE(root["stuff"][0].contains("id")); - REQUIRE(root["stuff"][0]["id"].is_string()); - REQUIRE(root["stuff"][0]["id"].get_value_ref() == "foo"); + fkyaml::node& stuff_0_id_node = stuff_0_node["id"]; + REQUIRE(stuff_0_id_node.is_string()); + REQUIRE(stuff_0_id_node.get_value_ref() == "foo"); - REQUIRE(root["stuff"][0].contains("name")); - REQUIRE(root["stuff"][0]["name"].is_string()); - REQUIRE(root["stuff"][0]["name"].get_value_ref() == "Foo"); + fkyaml::node& stuff_0_name_node = stuff_0_node["name"]; + REQUIRE(stuff_0_name_node.is_string()); + REQUIRE(stuff_0_name_node.get_value_ref() == "Foo"); - REQUIRE(root["stuff"][0].contains("tags")); - REQUIRE(root["stuff"][0]["tags"].is_sequence()); - REQUIRE(root["stuff"][0]["tags"].size() == 1); + fkyaml::node& stuff_0_tags_node = stuff_0_node["tags"]; + REQUIRE(stuff_0_tags_node.is_sequence()); + REQUIRE(stuff_0_tags_node.size() == 1); - REQUIRE(root["stuff"][0]["tags"][0].is_string()); - REQUIRE(root["stuff"][0]["tags"][0].get_value_ref() == "baz"); + fkyaml::node& stuff_0_tags_0_node = stuff_0_tags_node[0]; + REQUIRE(stuff_0_tags_0_node.is_string()); + REQUIRE(stuff_0_tags_0_node.get_value_ref() == "baz"); - REQUIRE(root["stuff"][0].contains("params")); - REQUIRE(root["stuff"][0]["params"].is_mapping()); - REQUIRE(root["stuff"][0]["params"].size() == 1); + fkyaml::node& stuff_0_params_node = stuff_0_node["params"]; + REQUIRE(stuff_0_params_node.is_mapping()); + REQUIRE(stuff_0_params_node.size() == 1); + REQUIRE(stuff_0_params_node.contains("key")); - REQUIRE(root["stuff"][0]["params"].contains("key")); - REQUIRE(root["stuff"][0]["params"]["key"].is_integer()); - REQUIRE(root["stuff"][0]["params"]["key"].get_value() == 1); + fkyaml::node& stuff_0_params_key_node = stuff_0_params_node["key"]; + REQUIRE(stuff_0_params_key_node.is_integer()); + REQUIRE(stuff_0_params_key_node.get_value() == 1); - REQUIRE(root["stuff"][1].is_mapping()); - REQUIRE(root["stuff"][1].size() == 2); + fkyaml::node& stuff_1_node = stuff_node[1]; + REQUIRE(stuff_1_node.is_mapping()); + REQUIRE(stuff_1_node.size() == 2); + REQUIRE(stuff_1_node.contains("id")); + REQUIRE(stuff_1_node.contains("name")); - REQUIRE(root["stuff"][1].contains("id")); - REQUIRE(root["stuff"][1]["id"].is_string()); - REQUIRE(root["stuff"][1]["id"].get_value_ref() == "bar"); + fkyaml::node& stuff_1_id_node = stuff_1_node["id"]; + REQUIRE(stuff_1_id_node.is_string()); + REQUIRE(stuff_1_id_node.get_value_ref() == "bar"); - REQUIRE(root["stuff"][1].contains("name")); - REQUIRE(root["stuff"][1]["name"].is_string()); - REQUIRE(root["stuff"][1]["name"].get_value_ref() == "Bar"); + fkyaml::node& stuff_1_name_node = stuff_1_node["name"]; + REQUIRE(stuff_1_name_node.is_string()); + REQUIRE(stuff_1_name_node.get_value_ref() == "Bar"); } SECTION("block mapping with a block sequence of more nested block mappings") { @@ -586,47 +613,57 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); - REQUIRE(root.contains("stuff")); - REQUIRE(root["stuff"].is_sequence()); - REQUIRE(root["stuff"].size() == 2); - REQUIRE(root["stuff"][0].is_mapping()); - REQUIRE(root["stuff"][0].size() == 4); + fkyaml::node& stuff_node = root["stuff"]; + REQUIRE(stuff_node.is_sequence()); + REQUIRE(stuff_node.size() == 2); - REQUIRE(root["stuff"][0].contains("id")); - REQUIRE(root["stuff"][0]["id"].is_string()); - REQUIRE(root["stuff"][0]["id"].get_value_ref() == "foo"); + fkyaml::node& stuff_0_node = stuff_node[0]; + REQUIRE(stuff_0_node.is_mapping()); + REQUIRE(stuff_0_node.size() == 4); + REQUIRE(stuff_0_node.contains("id")); + REQUIRE(stuff_0_node.contains("name")); + REQUIRE(stuff_0_node.contains("tags")); + REQUIRE(stuff_0_node.contains("params")); - REQUIRE(root["stuff"][0].contains("name")); - REQUIRE(root["stuff"][0]["name"].is_string()); - REQUIRE(root["stuff"][0]["name"].get_value_ref() == "Foo"); + fkyaml::node& stuff_0_id_node = stuff_0_node["id"]; + REQUIRE(stuff_0_id_node.is_string()); + REQUIRE(stuff_0_id_node.get_value_ref() == "foo"); - REQUIRE(root["stuff"][0].contains("tags")); - REQUIRE(root["stuff"][0]["tags"].is_sequence()); - REQUIRE(root["stuff"][0]["tags"].size() == 1); + fkyaml::node& stuff_0_name_node = stuff_0_node["name"]; + REQUIRE(stuff_0_name_node.is_string()); + REQUIRE(stuff_0_name_node.get_value_ref() == "Foo"); - REQUIRE(root["stuff"][0]["tags"][0].is_string()); - REQUIRE(root["stuff"][0]["tags"][0].get_value_ref() == "baz"); + fkyaml::node& stuff_0_tags_node = stuff_0_node["tags"]; + REQUIRE(stuff_0_tags_node.is_sequence()); + REQUIRE(stuff_0_tags_node.size() == 1); - REQUIRE(root["stuff"][0].contains("params")); - REQUIRE(root["stuff"][0]["params"].is_mapping()); - REQUIRE(root["stuff"][0]["params"].size() == 1); + REQUIRE(stuff_0_tags_node[0].is_string()); + REQUIRE(stuff_0_tags_node[0].get_value_ref() == "baz"); - REQUIRE(root["stuff"][0]["params"].contains("key")); - REQUIRE(root["stuff"][0]["params"]["key"].is_integer()); - REQUIRE(root["stuff"][0]["params"]["key"].get_value() == 1); + fkyaml::node& stuff_0_params_node = stuff_0_node["params"]; + REQUIRE(stuff_0_params_node.is_mapping()); + REQUIRE(stuff_0_params_node.size() == 1); + REQUIRE(stuff_0_params_node.contains("key")); - REQUIRE(root["stuff"][1].is_mapping()); - REQUIRE(root["stuff"][1].size() == 2); + fkyaml::node& stuff_0_params_key_node = stuff_0_params_node["key"]; + REQUIRE(stuff_0_params_key_node.is_integer()); + REQUIRE(stuff_0_params_key_node.get_value() == 1); - REQUIRE(root["stuff"][1].contains("id")); - REQUIRE(root["stuff"][1]["id"].is_string()); - REQUIRE(root["stuff"][1]["id"].get_value_ref() == "bar"); + fkyaml::node& stuff_1_node = stuff_node[1]; + REQUIRE(stuff_1_node.is_mapping()); + REQUIRE(stuff_1_node.size() == 2); + REQUIRE(stuff_1_node.contains("id")); + REQUIRE(stuff_1_node.contains("name")); - REQUIRE(root["stuff"][1].contains("name")); - REQUIRE(root["stuff"][1]["name"].is_string()); - REQUIRE(root["stuff"][1]["name"].get_value_ref() == "Bar"); + fkyaml::node& stuff_1_id_node = stuff_1_node["id"]; + REQUIRE(stuff_1_id_node.is_string()); + REQUIRE(stuff_1_id_node.get_value_ref() == "bar"); + + fkyaml::node& stuff_1_name_node = stuff_1_node["name"]; + REQUIRE(stuff_1_name_node.is_string()); + REQUIRE(stuff_1_name_node.get_value_ref() == "Bar"); } SECTION("block mapping with explicit block mappings") { @@ -648,36 +685,46 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 4); - REQUIRE(root.contains(nullptr)); - REQUIRE(root[nullptr].is_float_number()); - REQUIRE(root[nullptr].get_value() == 3.14); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_mapping()); - REQUIRE(root["foo"].size() == 1); - REQUIRE(root["foo"].contains("bar")); - REQUIRE(root["foo"]["bar"].is_string()); - REQUIRE(root["foo"]["bar"].get_value_ref() == "baz"); + fkyaml::node key1 = {123, {{"foo", {{"bar", "baz"}}}}}; + REQUIRE(root.contains(key1)); + fkyaml::node key2 = {{"foo", "bar"}}; + REQUIRE(root.contains(key2)); + + fkyaml::node& null_node = root[nullptr]; + REQUIRE(null_node.is_float_number()); + REQUIRE(null_node.get_value() == 3.14); - fkyaml::node key = {123, {{"foo", {{"bar", "baz"}}}}}; - REQUIRE(root.contains(key)); - REQUIRE(root[key].is_mapping()); - REQUIRE(root[key].size() == 1); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_mapping()); + REQUIRE(foo_node.size() == 1); + + fkyaml::node& foo_bar_node = foo_node["bar"]; + REQUIRE(foo_bar_node.is_string()); + REQUIRE(foo_bar_node.get_value_ref() == "baz"); + + fkyaml::node& key1_node = root[key1]; + REQUIRE(key1_node.is_mapping()); + REQUIRE(key1_node.size() == 1); + REQUIRE(key1_node.contains("one")); - REQUIRE(root[key].contains("one")); - REQUIRE(root[key]["one"].is_boolean()); - REQUIRE(root[key]["one"].get_value() == true); + fkyaml::node& key1_one_node = key1_node["one"]; + REQUIRE(key1_one_node.is_boolean()); + REQUIRE(key1_one_node.get_value() == true); - key = {{"foo", "bar"}}; - REQUIRE(root.contains(key)); - REQUIRE(root[key].is_sequence()); - REQUIRE(root[key].size() == 2); - REQUIRE(root[key][0].is_string()); - REQUIRE(root[key][0].get_value_ref() == "baz"); - REQUIRE(root[key][1].is_string()); - REQUIRE(root[key][1].get_value_ref() == "qux"); + fkyaml::node& key2_node = root[key2]; + REQUIRE(key2_node.is_sequence()); + REQUIRE(key2_node.size() == 2); + + fkyaml::node& key2_0_node = key2_node[0]; + REQUIRE(key2_0_node.is_string()); + REQUIRE(key2_0_node.get_value_ref() == "baz"); + + fkyaml::node& key2_1_node = key2_node[1]; + REQUIRE(key2_1_node.is_string()); + REQUIRE(key2_1_node.get_value_ref() == "qux"); } SECTION("block mapping with keys containing flow indicators") { @@ -686,52 +733,84 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); - REQUIRE(root.contains("Foo,Bar")); - REQUIRE(root["Foo,Bar"].get_value() == true); - REQUIRE(root.contains("Baz[123]")); - REQUIRE(root["Baz[123]"].get_value() == 3.14); + + fkyaml::node& foobar_node = root["Foo,Bar"]; + REQUIRE(foobar_node.is_boolean()); + REQUIRE(foobar_node.get_value() == true); + + fkyaml::node& baz123_node = root["Baz[123]"]; + REQUIRE(baz123_node.is_float_number()); + REQUIRE(baz123_node.get_value() == 3.14); } SECTION("Flow indicators inside unquoted plain scalar values") { - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc{abc"))); - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - REQUIRE(root["Foo"].is_string()); - REQUIRE(root["Foo"].get_value_ref() == "Bar, abc{abc"); + SECTION("plain scalar contains \'{\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc{abc"))); - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc}abc"))); - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - REQUIRE(root["Foo"].is_string()); - REQUIRE(root["Foo"].get_value_ref() == "Bar, abc}abc"); + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc[abc"))); - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - REQUIRE(root["Foo"].is_string()); - REQUIRE(root["Foo"].get_value_ref() == "Bar, abc[abc"); + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc{abc"); + } - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc]abc"))); - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - REQUIRE(root["Foo"].is_string()); - REQUIRE(root["Foo"].get_value_ref() == "Bar, abc]abc"); + SECTION("plain scalar contains \'}\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc}abc"))); - REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] :3.14}"))); - REQUIRE(root.is_mapping()); - REQUIRE(root.size() == 1); - REQUIRE(root.contains("Foo")); - REQUIRE(root["Foo"].is_string()); - REQUIRE(root["Foo"].get_value_ref() == "Bar, {[123] :3.14}"); - REQUIRE_THROWS_AS( - root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] : 3.14}")), - fkyaml::parse_error); + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc}abc"); + } + + SECTION("plain scalar contains \'[\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc[abc"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc[abc"); + } + + SECTION("plain scalar contains \']\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, abc]abc"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, abc]abc"); + } + + SECTION("plain scalar contains \':\'") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] :3.14}"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("Foo")); + + fkyaml::node& foo_node = root["Foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "Bar, {[123] :3.14}"); + } + + SECTION("plain scalar contains \": \"") { + REQUIRE_THROWS_AS( + root = deserializer.deserialize(fkyaml::detail::input_adapter("Foo: Bar, {[123] : 3.14}")), + fkyaml::parse_error); + } } SECTION("a comment right after a block mapping key.") { @@ -742,12 +821,14 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.size() == 1); REQUIRE(root.contains("baz")); - REQUIRE(root["baz"].is_mapping()); - REQUIRE(root["baz"].size() == 1); - REQUIRE(root["baz"].contains("qux")); + fkyaml::node& baz_node = root["baz"]; + REQUIRE(baz_node.is_mapping()); + REQUIRE(baz_node.size() == 1); + REQUIRE(baz_node.contains("qux")); - REQUIRE(root["baz"]["qux"].is_integer()); - REQUIRE(root["baz"]["qux"].get_value() == 123); + fkyaml::node& baz_qux_node = baz_node["qux"]; + REQUIRE(baz_qux_node.is_integer()); + REQUIRE(baz_qux_node.get_value() == 123); } SECTION("mapping entries split across newlines") { @@ -768,26 +849,37 @@ TEST_CASE("Deserializer_BlockMapping") { REQUIRE(root.contains(nullptr)); REQUIRE(root.contains("qux")); - REQUIRE(root["foo"].is_string()); - REQUIRE(root["foo"].get_value_ref() == "bar"); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "bar"); + + fkyaml::node& baz_node = root["baz"]; + REQUIRE(baz_node.is_integer()); + REQUIRE(baz_node.get_value() == 123); + + fkyaml::node& null_node = root[nullptr]; + REQUIRE(null_node.is_mapping()); + REQUIRE(null_node.contains(false)); - REQUIRE(root["baz"].is_integer()); - REQUIRE(root["baz"].get_value() == 123); + fkyaml::node& null_false_node = null_node[false]; + REQUIRE(null_false_node.is_float_number()); + REQUIRE(null_false_node.get_value() == 3.14); - REQUIRE(root[nullptr].is_mapping()); - REQUIRE(root[nullptr].contains(false)); - REQUIRE(root[nullptr][false].is_float_number()); - REQUIRE(root[nullptr][false].get_value() == 3.14); + fkyaml::node& qux_node = root["qux"]; + REQUIRE(qux_node.is_sequence()); + REQUIRE(qux_node.size() == 3); - REQUIRE(root["qux"].is_sequence()); - REQUIRE(root["qux"].size() == 3); + fkyaml::node& qux_0_node = qux_node[0]; + REQUIRE(qux_0_node.is_string()); + REQUIRE(qux_0_node.get_value_ref() == "r"); - REQUIRE(root["qux"][0].is_string()); - REQUIRE(root["qux"][0].get_value_ref() == "r"); - REQUIRE(root["qux"][1].is_string()); - REQUIRE(root["qux"][1].get_value_ref() == "g"); - REQUIRE(root["qux"][2].is_string()); - REQUIRE(root["qux"][2].get_value_ref() == "b"); + fkyaml::node& qux_1_node = qux_node[1]; + REQUIRE(qux_1_node.is_string()); + REQUIRE(qux_1_node.get_value_ref() == "g"); + + fkyaml::node& qux_2_node = qux_node[2]; + REQUIRE(qux_2_node.is_string()); + REQUIRE(qux_2_node.get_value_ref() == "b"); } } @@ -801,24 +893,19 @@ TEST_CASE("Deserializer_FlowSequence") { REQUIRE(root.is_mapping()); REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_sequence()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 2); - REQUIRE_NOTHROW(test_node[0]); fkyaml::node& test_0_node = test_node[0]; REQUIRE(test_0_node.is_string()); - REQUIRE_NOTHROW(test_0_node.get_value_ref()); - REQUIRE(test_0_node.get_value_ref().compare("foo") == 0); + REQUIRE(test_0_node.get_value_ref() == "foo"); - REQUIRE_NOTHROW(test_node[1]); fkyaml::node& test_1_node = test_node[1]; REQUIRE(test_1_node.is_string()); - REQUIRE_NOTHROW(test_1_node.get_value_ref()); - REQUIRE(test_1_node.get_value_ref().compare("bar") == 0); + REQUIRE(test_1_node.get_value_ref() == "bar"); } SECTION("lack the beginning of a flow sequence") { @@ -830,14 +917,17 @@ TEST_CASE("Deserializer_FlowSequence") { REQUIRE(root.is_sequence()); REQUIRE(root.size() == 3); - REQUIRE(root[0].is_string()); - REQUIRE(root[0].get_value_ref() == "foo"); + fkyaml::node& root_0_node = root[0]; + REQUIRE(root_0_node.is_string()); + REQUIRE(root_0_node.get_value_ref() == "foo"); - REQUIRE(root[1].is_integer()); - REQUIRE(root[1].get_value() == 123); + fkyaml::node& root_1_node = root[1]; + REQUIRE(root_1_node.is_integer()); + REQUIRE(root_1_node.get_value() == 123); - REQUIRE(root[2].is_float_number()); - REQUIRE(root[2].get_value() == 3.14); + fkyaml::node& root_2_node = root[2]; + REQUIRE(root_2_node.is_float_number()); + REQUIRE(root_2_node.get_value() == 3.14); } } @@ -852,30 +942,26 @@ TEST_CASE("Deserializer_FlowMapping") { REQUIRE(root.is_mapping()); REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_mapping()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 3); + REQUIRE(test_node.contains("bool")); + REQUIRE(test_node.contains("foo")); + REQUIRE(test_node.contains("pi")); - REQUIRE_NOTHROW(test_node["bool"]); fkyaml::node& test_bool_node = test_node["bool"]; REQUIRE(test_bool_node.is_boolean()); - REQUIRE_NOTHROW(test_bool_node.get_value()); - REQUIRE(test_bool_node.get_value() == true); + REQUIRE(test_bool_node.get_value() == true); - REQUIRE_NOTHROW(test_node["foo"]); fkyaml::node& test_foo_node = test_node["foo"]; REQUIRE(test_foo_node.is_string()); - REQUIRE_NOTHROW(test_foo_node.get_value_ref()); - REQUIRE(test_foo_node.get_value_ref().compare("bar") == 0); + REQUIRE(test_foo_node.get_value_ref() == "bar"); - REQUIRE_NOTHROW(test_node["pi"]); fkyaml::node& test_pi_node = test_node["pi"]; REQUIRE(test_pi_node.is_float_number()); - REQUIRE_NOTHROW(test_pi_node.get_value()); - REQUIRE(test_pi_node.get_value() == 3.14); + REQUIRE(test_pi_node.get_value() == 3.14); } SECTION("Correct traversal after deserializing flow mapping value") { @@ -885,24 +971,21 @@ TEST_CASE("Deserializer_FlowMapping") { REQUIRE(root.is_mapping()); REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 2); + REQUIRE(root.contains("test")); + REQUIRE(root.contains("sibling")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_mapping()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 1); + REQUIRE(test_node.contains("foo")); - REQUIRE_NOTHROW(test_node["foo"]); fkyaml::node& test_foo_node = test_node["foo"]; REQUIRE(test_foo_node.is_string()); - REQUIRE_NOTHROW(test_foo_node.get_value_ref()); - REQUIRE(test_foo_node.get_value_ref().compare("bar") == 0); + REQUIRE(test_foo_node.get_value_ref() == "bar"); - REQUIRE_NOTHROW(root["sibling"]); fkyaml::node& sibling_node = root["sibling"]; REQUIRE(sibling_node.is_string()); - REQUIRE_NOTHROW(sibling_node.get_value_ref()); - REQUIRE(sibling_node.get_value_ref().compare("a_string_val") == 0); + REQUIRE(sibling_node.get_value_ref() == "a_string_val"); } SECTION("lack the beginning of a flow mapping") { @@ -925,11 +1008,13 @@ TEST_CASE("Deserializer_FlowMapping") { REQUIRE(test_foo_node.is_sequence()); REQUIRE(test_foo_node.size() == 2); - REQUIRE(test_foo_node[0].is_boolean()); - REQUIRE(test_foo_node[0].get_value() == true); + fkyaml::node& test_foo_0_node = test_foo_node[0]; + REQUIRE(test_foo_0_node.is_boolean()); + REQUIRE(test_foo_0_node.get_value() == true); - REQUIRE(test_foo_node[1].is_integer()); - REQUIRE(test_foo_node[1].get_value() == 123); + fkyaml::node& test_foo_1_node = test_foo_node[1]; + REQUIRE(test_foo_1_node.is_integer()); + REQUIRE(test_foo_1_node.get_value() == 123); } SECTION("root flow mapping") { @@ -940,11 +1025,13 @@ TEST_CASE("Deserializer_FlowMapping") { REQUIRE(root.contains("foo")); REQUIRE(root.contains(true)); - REQUIRE(root["foo"].is_integer()); - REQUIRE(root["foo"].get_value() == 123); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_integer()); + REQUIRE(foo_node.get_value() == 123); - REQUIRE(root[true].is_float_number()); - REQUIRE(root[true].get_value() == 3.14); + fkyaml::node& true_node = root[true]; + REQUIRE(true_node.is_float_number()); + REQUIRE(true_node.get_value() == 3.14); } } @@ -957,24 +1044,21 @@ TEST_CASE("Deserializer_InputWithComment") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 3); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("bar")); + REQUIRE(root.contains("pi")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; REQUIRE(foo_node.is_string()); - REQUIRE_NOTHROW(foo_node.get_value_ref()); - REQUIRE(foo_node.get_value_ref().compare("one") == 0); + REQUIRE(foo_node.get_value_ref() == "one"); - REQUIRE_NOTHROW(root["bar"]); fkyaml::node& bar_node = root["bar"]; REQUIRE(bar_node.is_boolean()); - REQUIRE_NOTHROW(bar_node.get_value()); - REQUIRE(bar_node.get_value() == true); + REQUIRE(bar_node.get_value() == true); - REQUIRE_NOTHROW(root["pi"]); fkyaml::node& pi_node = root["pi"]; REQUIRE(pi_node.is_float_number()); - REQUIRE_NOTHROW(pi_node.get_value()); - REQUIRE(pi_node.get_value() == 3.14); + REQUIRE(pi_node.get_value() == 3.14); } TEST_CASE("Deserializer_YAMLVerDirective") { @@ -987,13 +1071,12 @@ TEST_CASE("Deserializer_YAMLVerDirective") { REQUIRE(root.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_1); REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("foo")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; REQUIRE(root.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_1); REQUIRE(foo_node.is_string()); - REQUIRE_NOTHROW(foo_node.get_value_ref()); - REQUIRE(foo_node.get_value_ref().compare("one") == 0); + REQUIRE(foo_node.get_value_ref() == "one"); } SECTION("YAML 1.2") { @@ -1002,13 +1085,12 @@ TEST_CASE("Deserializer_YAMLVerDirective") { REQUIRE(root.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_2); REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("foo")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; REQUIRE(root.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_2); REQUIRE(foo_node.is_string()); - REQUIRE_NOTHROW(foo_node.get_value_ref()); - REQUIRE(foo_node.get_value_ref().compare("one") == 0); + REQUIRE(foo_node.get_value_ref() == "one"); } SECTION("YAML directive in the content to be ignored") { @@ -1018,14 +1100,16 @@ TEST_CASE("Deserializer_YAMLVerDirective") { REQUIRE(root.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_2); REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_string()); - REQUIRE(root["foo"].get_value_ref() == "bar"); - REQUIRE(root.contains(true)); - REQUIRE(root[true].is_integer()); - REQUIRE(root[true].get_value() == 123); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "bar"); + + fkyaml::node& true_node = root[true]; + REQUIRE(true_node.is_integer()); + REQUIRE(true_node.get_value() == 123); } SECTION("YAML directive more than once") { @@ -1046,12 +1130,13 @@ TEST_CASE("Deserializer_TagDirective") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_string()); - REQUIRE(root["foo"].get_value_ref() == "bar"); - REQUIRE(root["foo"].has_tag_name()); - REQUIRE(root["foo"].get_tag_name() == "!local"); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "bar"); + REQUIRE(foo_node.has_tag_name()); + REQUIRE(foo_node.get_tag_name() == "!local"); } SECTION("primary tag handle more than once") { @@ -1070,12 +1155,13 @@ TEST_CASE("Deserializer_TagDirective") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_string()); - REQUIRE(root["foo"].get_value_ref() == "bar"); - REQUIRE(root["foo"].has_tag_name()); - REQUIRE(root["foo"].get_tag_name() == "!!local"); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "bar"); + REQUIRE(foo_node.has_tag_name()); + REQUIRE(foo_node.get_tag_name() == "!!local"); } SECTION("secondary tag handle more than once") { @@ -1096,18 +1182,20 @@ TEST_CASE("Deserializer_TagDirective") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_string()); - REQUIRE(root["foo"].get_value_ref() == "bar"); - REQUIRE(root["foo"].has_tag_name()); - REQUIRE(root["foo"].get_tag_name() == "!e!global"); - REQUIRE(root.contains("baz")); - REQUIRE(root["baz"].is_string()); - REQUIRE(root["baz"].get_value_ref() == "qux"); - REQUIRE(root["baz"].has_tag_name()); - REQUIRE(root["baz"].get_tag_name() == "!f!local"); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "bar"); + REQUIRE(foo_node.has_tag_name()); + REQUIRE(foo_node.get_tag_name() == "!e!global"); + + fkyaml::node& baz_node = root["baz"]; + REQUIRE(baz_node.is_string()); + REQUIRE(baz_node.get_value_ref() == "qux"); + REQUIRE(baz_node.has_tag_name()); + REQUIRE(baz_node.get_tag_name() == "!f!local"); } SECTION("named tag handle more than once") { @@ -1139,27 +1227,25 @@ TEST_CASE("Deserializer_Anchor") { REQUIRE(root.is_mapping()); REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_sequence()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 2); - REQUIRE_NOTHROW(test_node[0]); fkyaml::node& test_0_node = test_node[0]; + REQUIRE(test_0_node.is_anchor()); REQUIRE(test_0_node.has_anchor_name()); - REQUIRE(test_0_node.get_anchor_name().compare("anchor") == 0); + REQUIRE(test_0_node.get_anchor_name() == "anchor"); REQUIRE(test_0_node.is_boolean()); - REQUIRE_NOTHROW(test_0_node.get_value()); - REQUIRE(test_0_node.get_value() == true); + REQUIRE(test_0_node.get_value() == true); - REQUIRE_NOTHROW(test_node[1]); fkyaml::node& test_1_node = test_node[1]; + REQUIRE(test_1_node.is_alias()); + REQUIRE(test_1_node.has_anchor_name()); + REQUIRE(test_1_node.get_anchor_name() == "anchor"); REQUIRE(test_1_node.is_boolean()); - REQUIRE_NOTHROW(test_1_node.get_value()); - REQUIRE( - test_1_node.get_value() == test_0_node.get_value()); + REQUIRE(test_1_node.get_value() == test_0_node.get_value()); } SECTION("block sequence with anchored integer scalar") { @@ -1167,29 +1253,25 @@ TEST_CASE("Deserializer_Anchor") { root = deserializer.deserialize(fkyaml::detail::input_adapter("test:\n - &anchor -123\n - *anchor"))); REQUIRE(root.is_mapping()); - REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_sequence()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 2); - REQUIRE_NOTHROW(test_node[0]); fkyaml::node& test_0_node = test_node[0]; REQUIRE(test_0_node.has_anchor_name()); REQUIRE(test_0_node.get_anchor_name().compare("anchor") == 0); REQUIRE(test_0_node.is_integer()); - REQUIRE_NOTHROW(test_0_node.get_value()); - REQUIRE(test_0_node.get_value() == -123); + REQUIRE(test_0_node.get_value() == -123); - REQUIRE_NOTHROW(test_node[1]); fkyaml::node& test_1_node = test_node[1]; + REQUIRE(test_1_node.is_alias()); + REQUIRE(test_1_node.has_anchor_name()); + REQUIRE(test_1_node.get_anchor_name() == "anchor"); REQUIRE(test_1_node.is_integer()); - REQUIRE_NOTHROW(test_1_node.get_value()); - REQUIRE( - test_1_node.get_value() == test_0_node.get_value()); + REQUIRE(test_1_node.get_value() == test_0_node.get_value()); } SECTION("block sequence with anchored floating point number scalar") { @@ -1197,30 +1279,26 @@ TEST_CASE("Deserializer_Anchor") { root = deserializer.deserialize(fkyaml::detail::input_adapter("test:\n - &anchor 3.14\n - *anchor"))); REQUIRE(root.is_mapping()); - REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_sequence()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 2); - REQUIRE_NOTHROW(test_node[0]); fkyaml::node& test_0_node = test_node[0]; + REQUIRE(test_0_node.is_anchor()); REQUIRE(test_0_node.has_anchor_name()); - REQUIRE(test_0_node.get_anchor_name().compare("anchor") == 0); + REQUIRE(test_0_node.get_anchor_name() == "anchor"); REQUIRE(test_0_node.is_float_number()); - REQUIRE_NOTHROW(test_0_node.get_value()); - REQUIRE(test_0_node.get_value() == 3.14); + REQUIRE(test_0_node.get_value() == 3.14); - REQUIRE_NOTHROW(test_node[1]); fkyaml::node& test_1_node = test_node[1]; + REQUIRE(test_1_node.is_alias()); + REQUIRE(test_1_node.has_anchor_name()); + REQUIRE(test_1_node.get_anchor_name() == "anchor"); REQUIRE(test_1_node.is_float_number()); - REQUIRE_NOTHROW(test_1_node.get_value()); - REQUIRE( - test_1_node.get_value() == - test_0_node.get_value()); + REQUIRE(test_1_node.get_value() == test_0_node.get_value()); } SECTION("block sequence with anchored string scalar") { @@ -1228,32 +1306,26 @@ TEST_CASE("Deserializer_Anchor") { root = deserializer.deserialize(fkyaml::detail::input_adapter("test:\n - &anchor foo\n - *anchor"))); REQUIRE(root.is_mapping()); - REQUIRE_NOTHROW(root.size()); REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); - REQUIRE_NOTHROW(root["test"]); fkyaml::node& test_node = root["test"]; REQUIRE(test_node.is_sequence()); - REQUIRE_NOTHROW(test_node.size()); REQUIRE(test_node.size() == 2); - REQUIRE_NOTHROW(test_node[0]); fkyaml::node& test_0_node = test_node[0]; + REQUIRE(test_0_node.is_anchor()); REQUIRE(test_0_node.has_anchor_name()); - REQUIRE(test_0_node.get_anchor_name().compare("anchor") == 0); + REQUIRE(test_0_node.get_anchor_name() == "anchor"); REQUIRE(test_0_node.is_string()); - REQUIRE_NOTHROW(test_0_node.size()); - REQUIRE(test_0_node.size() == 3); - REQUIRE_NOTHROW(test_0_node.get_value_ref()); - REQUIRE(test_0_node.get_value_ref().compare("foo") == 0); + REQUIRE(test_0_node.get_value_ref() == "foo"); - REQUIRE_NOTHROW(test_node[1]); fkyaml::node& test_1_node = test_node[1]; + REQUIRE(test_1_node.is_alias()); + REQUIRE(test_1_node.has_anchor_name()); + REQUIRE(test_1_node.get_anchor_name() == "anchor"); REQUIRE(test_1_node.is_string()); - REQUIRE_NOTHROW(test_1_node.size()); - REQUIRE(test_1_node.size() == 3); - REQUIRE_NOTHROW(test_1_node.get_value_ref()); - REQUIRE(test_1_node.get_value_ref().compare("foo") == 0); + REQUIRE(test_1_node.get_value_ref() == test_0_node.get_value_ref()); } SECTION("block mapping with anchored boolean scalar") { @@ -1262,20 +1334,22 @@ TEST_CASE("Deserializer_Anchor") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("bar")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_anchor()); REQUIRE(foo_node.has_anchor_name()); - REQUIRE(foo_node.get_anchor_name().compare("anchor") == 0); + REQUIRE(foo_node.get_anchor_name() == "anchor"); REQUIRE(foo_node.is_boolean()); - REQUIRE_NOTHROW(foo_node.get_value()); - REQUIRE(foo_node.get_value() == true); + REQUIRE(foo_node.get_value() == true); - REQUIRE_NOTHROW(root["bar"]); fkyaml::node& bar_node = root["bar"]; + REQUIRE(bar_node.is_alias()); + REQUIRE(bar_node.has_anchor_name()); + REQUIRE(bar_node.get_anchor_name() == "anchor"); REQUIRE(bar_node.is_boolean()); - REQUIRE_NOTHROW(bar_node.get_value()); - REQUIRE(bar_node.get_value() == foo_node.get_value()); + REQUIRE(bar_node.get_value() == foo_node.get_value()); } SECTION("block mapping with anchored integer scalar") { @@ -1284,20 +1358,22 @@ TEST_CASE("Deserializer_Anchor") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("bar")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_anchor()); REQUIRE(foo_node.has_anchor_name()); - REQUIRE(foo_node.get_anchor_name().compare("anchor") == 0); + REQUIRE(foo_node.get_anchor_name() == "anchor"); REQUIRE(foo_node.is_integer()); - REQUIRE_NOTHROW(foo_node.get_value()); - REQUIRE(foo_node.get_value() == -123); + REQUIRE(foo_node.get_value() == -123); - REQUIRE_NOTHROW(root["bar"]); fkyaml::node& bar_node = root["bar"]; + REQUIRE(bar_node.is_alias()); + REQUIRE(bar_node.has_anchor_name()); + REQUIRE(bar_node.get_anchor_name() == "anchor"); REQUIRE(bar_node.is_integer()); - REQUIRE_NOTHROW(bar_node.get_value()); - REQUIRE(bar_node.get_value() == foo_node.get_value()); + REQUIRE(bar_node.get_value() == foo_node.get_value()); } SECTION("block mapping with anchored floating point number scalar") { @@ -1306,22 +1382,22 @@ TEST_CASE("Deserializer_Anchor") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("bar")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_anchor()); REQUIRE(foo_node.has_anchor_name()); - REQUIRE(foo_node.get_anchor_name().compare("anchor") == 0); + REQUIRE(foo_node.get_anchor_name() == "anchor"); REQUIRE(foo_node.is_float_number()); - REQUIRE_NOTHROW(foo_node.get_value()); - REQUIRE(foo_node.get_value() == 3.14); + REQUIRE(foo_node.get_value() == 3.14); - REQUIRE_NOTHROW(root["bar"]); fkyaml::node& bar_node = root["bar"]; + REQUIRE(bar_node.is_alias()); + REQUIRE(bar_node.has_anchor_name()); + REQUIRE(bar_node.get_anchor_name() == "anchor"); REQUIRE(bar_node.is_float_number()); - REQUIRE_NOTHROW(bar_node.get_value()); - REQUIRE( - bar_node.get_value() == - foo_node.get_value()); + REQUIRE(bar_node.get_value() == foo_node.get_value()); } SECTION("block mapping with anchored string scalar") { @@ -1330,22 +1406,22 @@ TEST_CASE("Deserializer_Anchor") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 2); + REQUIRE(root.contains("foo")); + REQUIRE(root.contains("bar")); - REQUIRE_NOTHROW(root["foo"]); fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_anchor()); REQUIRE(foo_node.has_anchor_name()); - REQUIRE(foo_node.get_anchor_name().compare("anchor") == 0); + REQUIRE(foo_node.get_anchor_name() == "anchor"); REQUIRE(foo_node.is_string()); - REQUIRE_NOTHROW(foo_node.get_value_ref()); - REQUIRE(foo_node.get_value_ref().compare("one") == 0); + REQUIRE(foo_node.get_value_ref() == "one"); - REQUIRE_NOTHROW(root["bar"]); fkyaml::node& bar_node = root["bar"]; + REQUIRE(bar_node.is_alias()); + REQUIRE(bar_node.has_anchor_name()); + REQUIRE(bar_node.get_anchor_name() == "anchor"); REQUIRE(bar_node.is_string()); - REQUIRE_NOTHROW(bar_node.get_value_ref()); - REQUIRE( - bar_node.get_value_ref() == - foo_node.get_value_ref()); + REQUIRE(bar_node.get_value_ref() == foo_node.get_value_ref()); } SECTION("parse alias mapping key") { @@ -1354,11 +1430,15 @@ TEST_CASE("Deserializer_Anchor") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_mapping()); - REQUIRE(root["foo"].size() == 1); - REQUIRE(root["foo"].contains("foo")); - REQUIRE(root["foo"]["foo"].is_integer()); - REQUIRE(root["foo"]["foo"].get_value() == 123); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_mapping()); + REQUIRE(foo_node.size() == 1); + REQUIRE(foo_node.contains("foo")); + + fkyaml::node& foo_foo_node = foo_node["foo"]; + REQUIRE(foo_foo_node.is_integer()); + REQUIRE(foo_foo_node.get_value() == 123); } SECTION("multiple anchors specified") { @@ -1391,82 +1471,111 @@ TEST_CASE("Deserializer_Tag") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 11); - REQUIRE(root.contains("str")); - REQUIRE(root["str"].has_tag_name()); - REQUIRE(root["str"].get_tag_name() == "!!str"); - REQUIRE(root["str"].is_string()); - REQUIRE(root["str"].get_value_ref() == "true"); - REQUIRE(root.contains("int")); - REQUIRE(root["int"].has_tag_name()); - REQUIRE(root["int"].get_tag_name() == "!"); - REQUIRE(root["int"].is_integer()); - REQUIRE(root["int"].get_value() == 123); - REQUIRE(root.contains("nil")); - REQUIRE(root["nil"].has_tag_name()); - REQUIRE(root["nil"].get_tag_name() == "!!null"); - REQUIRE(root["nil"].is_null()); - REQUIRE(root["nil"].get_value() == nullptr); - REQUIRE(root.contains("bool")); - REQUIRE(root["bool"].has_tag_name()); - REQUIRE(root["bool"].get_tag_name() == "!!bool"); - REQUIRE(root["bool"].is_boolean()); - REQUIRE(root["bool"].get_value() == false); - REQUIRE(root.contains("float")); - REQUIRE(root["float"].has_tag_name()); - REQUIRE(root["float"].get_tag_name() == "!!float"); - REQUIRE(root["float"].is_float_number()); - REQUIRE(root["float"].get_value() == 3.14); - REQUIRE(root.contains("non specific")); - REQUIRE(root["non specific"].has_tag_name()); - REQUIRE(root["non specific"].get_tag_name() == "!"); - REQUIRE(root["non specific"].is_string()); - REQUIRE(root["non specific"].get_value_ref() == "non specific"); - REQUIRE(root.contains("custom")); - REQUIRE(root["custom"].has_tag_name()); - REQUIRE(root["custom"].get_tag_name() == "!local"); - REQUIRE(root["custom"].is_string()); - REQUIRE(root["custom"].get_value_ref() == "value"); - REQUIRE(root.contains("map")); - REQUIRE(root["map"].has_tag_name()); - REQUIRE(root["map"].get_tag_name() == "!!map"); - REQUIRE(root["map"].is_mapping()); - REQUIRE(root["map"].size() == 1); - REQUIRE(root["map"].begin().key().has_tag_name()); - REQUIRE(root["map"].begin().key().get_tag_name() == "!!str"); - REQUIRE(root["map"].contains("foo")); - REQUIRE(root["map"]["foo"].get_value_ref() == "bar"); - REQUIRE(root.contains("map_flow")); - REQUIRE(root["map_flow"].has_tag_name()); - REQUIRE(root["map_flow"].get_tag_name() == "!"); - REQUIRE(root["map_flow"].is_mapping()); - REQUIRE(root["map_flow"].size() == 1); - REQUIRE(root["map_flow"].contains("foo")); - REQUIRE(root["map_flow"]["foo"].get_value_ref() == "bar"); - REQUIRE(root.contains("seq")); - REQUIRE(root["seq"].has_tag_name()); - REQUIRE(root["seq"].get_tag_name() == "!"); - REQUIRE(root["seq"].is_sequence()); - REQUIRE(root["seq"].size() == 2); - REQUIRE(root["seq"][0].get_value() == 123); - REQUIRE(root["seq"][1].get_value() == 3.14f); - REQUIRE(root.contains("seq_flow")); - REQUIRE(root["seq_flow"].has_tag_name()); - REQUIRE(root["seq_flow"].get_tag_name() == "!!seq"); - REQUIRE(root["seq_flow"].is_sequence()); - REQUIRE(root["seq_flow"].size() == 2); - REQUIRE(root["seq_flow"][0].get_value() == 123); - REQUIRE(root["seq_flow"][1].get_value() == 3.14f); + + fkyaml::node& str_node = root["str"]; + REQUIRE(str_node.has_tag_name()); + REQUIRE(str_node.get_tag_name() == "!!str"); + REQUIRE(str_node.is_string()); + REQUIRE(str_node.get_value_ref() == "true"); + + fkyaml::node& int_node = root["int"]; + REQUIRE(int_node.has_tag_name()); + REQUIRE(int_node.get_tag_name() == "!"); + REQUIRE(int_node.is_integer()); + REQUIRE(int_node.get_value() == 123); + + fkyaml::node& nil_node = root["nil"]; + REQUIRE(nil_node.has_tag_name()); + REQUIRE(nil_node.get_tag_name() == "!!null"); + REQUIRE(nil_node.is_null()); + REQUIRE(nil_node.get_value() == nullptr); + + fkyaml::node& bool_node = root["bool"]; + REQUIRE(bool_node.has_tag_name()); + REQUIRE(bool_node.get_tag_name() == "!!bool"); + REQUIRE(bool_node.is_boolean()); + REQUIRE(bool_node.get_value() == false); + + fkyaml::node& float_node = root["float"]; + REQUIRE(float_node.has_tag_name()); + REQUIRE(float_node.get_tag_name() == "!!float"); + REQUIRE(float_node.is_float_number()); + REQUIRE(float_node.get_value() == 3.14); + + fkyaml::node& non_specific_node = root["non specific"]; + REQUIRE(non_specific_node.has_tag_name()); + REQUIRE(non_specific_node.get_tag_name() == "!"); + REQUIRE(non_specific_node.is_string()); + REQUIRE(non_specific_node.get_value_ref() == "non specific"); + + fkyaml::node& custom_node = root["custom"]; + REQUIRE(custom_node.has_tag_name()); + REQUIRE(custom_node.get_tag_name() == "!local"); + REQUIRE(custom_node.is_string()); + REQUIRE(custom_node.get_value_ref() == "value"); + + fkyaml::node& map_node = root["map"]; + REQUIRE(map_node.has_tag_name()); + REQUIRE(map_node.get_tag_name() == "!!map"); + REQUIRE(map_node.is_mapping()); + REQUIRE(map_node.size() == 1); + REQUIRE(map_node.begin().key().has_tag_name()); + REQUIRE(map_node.begin().key().get_tag_name() == "!!str"); + REQUIRE(map_node.contains("foo")); + + fkyaml::node& map_foo_node = map_node["foo"]; + REQUIRE(map_foo_node.is_string()); + REQUIRE(map_foo_node.get_value_ref() == "bar"); + + fkyaml::node& map_flow_node = root["map_flow"]; + REQUIRE(map_flow_node.has_tag_name()); + REQUIRE(map_flow_node.get_tag_name() == "!"); + REQUIRE(map_flow_node.is_mapping()); + REQUIRE(map_flow_node.size() == 1); + REQUIRE(map_flow_node.contains("foo")); + + fkyaml::node& map_flow_foo_node = map_flow_node["foo"]; + REQUIRE(map_flow_foo_node.is_string()); + REQUIRE(map_flow_foo_node.get_value_ref() == "bar"); + + fkyaml::node& seq_node = root["seq"]; + REQUIRE(seq_node.has_tag_name()); + REQUIRE(seq_node.get_tag_name() == "!"); + REQUIRE(seq_node.is_sequence()); + REQUIRE(seq_node.size() == 2); + + fkyaml::node& seq_0_node = seq_node[0]; + REQUIRE(seq_0_node.is_integer()); + REQUIRE(seq_0_node.get_value() == 123); + + fkyaml::node& seq_1_node = seq_node[1]; + REQUIRE(seq_1_node.is_float_number()); + REQUIRE(seq_1_node.get_value() == 3.14f); + + fkyaml::node& seq_flow_node = root["seq_flow"]; + REQUIRE(seq_flow_node.has_tag_name()); + REQUIRE(seq_flow_node.get_tag_name() == "!!seq"); + REQUIRE(seq_flow_node.is_sequence()); + REQUIRE(seq_flow_node.size() == 2); + + fkyaml::node& seq_flow_0_node = seq_flow_node[0]; + REQUIRE(seq_flow_0_node.is_integer()); + REQUIRE(seq_flow_0_node.get_value() == 123); + + fkyaml::node& seq_flow_1_node = seq_flow_node[1]; + REQUIRE(seq_flow_1_node.is_float_number()); + REQUIRE(seq_flow_1_node.get_value() == 3.14f); } SECTION("specify tags using TAG directives") { @@ -1478,10 +1587,11 @@ TEST_CASE("Deserializer_Tag") { REQUIRE(root.is_sequence()); REQUIRE(root.size() == 1); - REQUIRE(root[0].has_tag_name()); - REQUIRE(root[0].get_tag_name() == "!e!foo"); - REQUIRE(root[0].is_string()); - REQUIRE(root[0].get_value_ref() == "bar"); + fkyaml::node& root_0_node = root[0]; + REQUIRE(root_0_node.has_tag_name()); + REQUIRE(root_0_node.get_tag_name() == "!e!foo"); + REQUIRE(root_0_node.is_string()); + REQUIRE(root_0_node.get_value_ref() == "bar"); } SECTION("multiple tags specified") { @@ -1503,18 +1613,20 @@ TEST_CASE("Deserializer_NodeProperties") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].is_mapping()); - REQUIRE(root["foo"].has_anchor_name()); - REQUIRE(root["foo"].get_anchor_name() == "anchor"); - REQUIRE(root["foo"].has_tag_name()); - REQUIRE(root["foo"].get_tag_name() == "!!map"); - REQUIRE(root["foo"].size() == 1); - REQUIRE(root["foo"].contains("bar")); - REQUIRE(root["foo"]["bar"].is_string()); - REQUIRE(root["foo"]["bar"].get_value_ref() == "baz"); + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_mapping()); + REQUIRE(foo_node.has_anchor_name()); + REQUIRE(foo_node.get_anchor_name() == "anchor"); + REQUIRE(foo_node.has_tag_name()); + REQUIRE(foo_node.get_tag_name() == "!!map"); + REQUIRE(foo_node.size() == 1); + REQUIRE(foo_node.contains("bar")); + + fkyaml::node& foo_bar_node = foo_node["bar"]; + REQUIRE(foo_bar_node.is_string()); + REQUIRE(foo_bar_node.get_value_ref() == "baz"); } SECTION("alias node with tag") { @@ -1536,7 +1648,9 @@ TEST_CASE("Deserializer_DocumentWithMarkers") { REQUIRE(root.is_mapping()); REQUIRE(root.size() == 1); REQUIRE(root.get_yaml_version() == fkyaml::node::yaml_version_t::VER_1_2); - REQUIRE(root.contains("foo")); - REQUIRE(root["foo"].get_value_ref() == "one"); + + fkyaml::node& foo_node = root["foo"]; + REQUIRE(foo_node.is_string()); + REQUIRE(foo_node.get_value_ref() == "one"); } diff --git a/test/unit_test/test_utf_encodings.cpp b/test/unit_test/test_utf_encodings.cpp index 9cf2d24f..e2ef0cd3 100644 --- a/test/unit_test/test_utf_encodings.cpp +++ b/test/unit_test/test_utf_encodings.cpp @@ -288,8 +288,8 @@ TEST_CASE("UTF8_FromUTF16") { std::array utf8_bytes; utf8_bytes.fill(0); - std::size_t consumed_size {0}; - std::size_t encoded_size {0}; + uint32_t consumed_size {0}; + uint32_t encoded_size {0}; fkyaml::detail::utf8::from_utf16(params.utf16, utf8_bytes, consumed_size, encoded_size); @@ -305,8 +305,8 @@ TEST_CASE("UTF8_FromUTF16") { std::array {{char16_t(0xDBFFu), char16_t(0xE000u)}}); std::array utf8_bytes; - std::size_t consumed_size; - std::size_t encoded_size; + uint32_t consumed_size; + uint32_t encoded_size; REQUIRE_THROWS_AS( fkyaml::detail::utf8::from_utf16(utf16, utf8_bytes, consumed_size, encoded_size), fkyaml::invalid_encoding); @@ -318,7 +318,7 @@ TEST_CASE("UTF8_FromUTF32") { struct test_params { char32_t utf32; std::array utf8_bytes; - std::size_t size; + uint32_t size; }; auto params = GENERATE( test_params {0x00u, {{uint8_t(0x00u)}}, 1}, @@ -339,7 +339,7 @@ TEST_CASE("UTF8_FromUTF32") { std::array utf8_bytes; utf8_bytes.fill(0); - std::size_t size {0}; + uint32_t size {0}; fkyaml::detail::utf8::from_utf32(params.utf32, utf8_bytes, size); REQUIRE(utf8_bytes == params.utf8_bytes); @@ -349,7 +349,7 @@ TEST_CASE("UTF8_FromUTF32") { SECTION("invalid UTF-32 character") { char32_t utf32 = 0x110000u; std::array utf8_bytes; - std::size_t encoded_size; + uint32_t encoded_size; REQUIRE_THROWS_AS(fkyaml::detail::utf8::from_utf32(utf32, utf8_bytes, encoded_size), fkyaml::invalid_encoding); } From 9cbff1778d8d0aa6112a888a1da2c5f77a1ce875 Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 2 May 2024 07:06:15 +0900 Subject: [PATCH 6/8] Fix parse error on block sequences with child flow style container nodes (#332) * fixed parse error on root block sequence with child flow sequences * refactored the stacking of parse contexts * fixed parsing child sequences of the non-first sequence element * fixed parse error on root block sequence with child flow mappings * modified to cover all the lines/branches in the deserializer/lexer impls --- include/fkYAML/detail/input/deserializer.hpp | 293 ++++++++++------- .../fkYAML/detail/input/lexical_analyzer.hpp | 6 - single_include/fkYAML/node.hpp | 299 +++++++++++------- test/unit_test/test_custom_from_node.cpp | 1 + test/unit_test/test_deserializer_class.cpp | 148 ++++++++- 5 files changed, 512 insertions(+), 235 deletions(-) diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index d1aa66ec..601696c5 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -47,9 +47,13 @@ class basic_deserializer { /// @brief Definition of state types of parse contexts. enum class context_state_t { - BLOCK_MAPPING_KEY_IMPLICIT, //!< The underlying node is an implicit block mapping key. - BLOCK_MAPPING_KEY_EXPLICIT, //!< The underlying node is an explicit block mapping key. - BLOCK_SEQUENCE_ENTRY, //!< The underlying node is a sequence. + BLOCK_MAPPING, //!< The underlying node is a block mapping. + BLOCK_MAPPING_EXPLICIT_KEY, //!< The underlying node is an explicit block mapping key. + BLOCK_MAPPING_EXPLICIT_VALUE, //!< The underlying node is an explicit block mapping value. + MAPPING_VALUE, //!< The underlying node is a block mapping value. + BLOCK_SEQUENCE, //!< The underlying node is a block sequence. + FLOW_SEQUENCE, //!< The underlying node is a flow sequence. + FLOW_MAPPING, //!< The underlying node is a flow mapping. }; /// @brief Context information set for parsing. @@ -74,8 +78,8 @@ class basic_deserializer { /// The indentation width in the current line. (count from zero) uint32_t indent {0}; /// The parse context type. - context_state_t state {context_state_t::BLOCK_MAPPING_KEY_IMPLICIT}; - /// The underlying node associated to this context. + context_state_t state {context_state_t::BLOCK_MAPPING}; + /// The pointer to the associated node to this context. node_type* p_node {nullptr}; }; @@ -98,23 +102,40 @@ class basic_deserializer { deserialize_directives(lexer, type); switch (type) { - case lexical_token_t::SEQUENCE_BLOCK_PREFIX: - case lexical_token_t::SEQUENCE_FLOW_BEGIN: { + case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { root = node_type::sequence(); apply_directive_set(root); parse_context context( - lexer.get_lines_processed(), - lexer.get_last_token_begin_pos(), - context_state_t::BLOCK_SEQUENCE_ENTRY, - &root); + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, &root); m_context_stack.emplace_back(std::move(context)); + type = lexer.get_next_token(); break; } - default: + case lexical_token_t::SEQUENCE_FLOW_BEGIN: + ++m_flow_context_depth; + root = node_type::sequence(); + apply_directive_set(root); + m_context_stack.emplace_back( + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_SEQUENCE, &root); + type = lexer.get_next_token(); + break; + case lexical_token_t::MAPPING_FLOW_BEGIN: + ++m_flow_context_depth; root = node_type::mapping(); apply_directive_set(root); + m_context_stack.emplace_back( + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_MAPPING, &root); + type = lexer.get_next_token(); + break; + default: { + root = node_type::mapping(); + apply_directive_set(root); + parse_context context( + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_MAPPING, &root); + m_context_stack.emplace_back(std::move(context)); break; } + } mp_current_node = &root; @@ -226,19 +247,26 @@ class basic_deserializer { // This handles an empty input. break; case lexical_token_t::EXPLICIT_KEY_PREFIX: { - bool needs_to_move_back = !m_context_stack.empty() && indent < m_context_stack.back().indent; - if (needs_to_move_back) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { return indent > c.indent; }); - - auto pop_num = std::distance(m_context_stack.rbegin(), target_itr); - for (auto i = 0; i < pop_num; i++) { + uint32_t pop_num = 0; + if (indent == 0) { + pop_num = static_cast(m_context_stack.size() - 1); + } + else { + bool needs_to_move_back = indent < m_context_stack.back().indent; + if (needs_to_move_back) { + auto target_itr = std::find_if( // LCOV_EXCL_LINE + m_context_stack.rbegin(), + m_context_stack.rend(), + [indent](const parse_context& c) { return indent > c.indent; }); + pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); + } + } + if (pop_num > 0) { + for (uint32_t i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } + mp_current_node = m_context_stack.back().p_node; } if (mp_current_node->is_null()) { @@ -253,23 +281,24 @@ class basic_deserializer { apply_directive_set(*mp_current_node); } - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_MAPPING_KEY_EXPLICIT, mp_current_node); - type = lexer.get_next_token(); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { - mp_current_node = new node_type(node_t::SEQUENCE); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_KEY, new node_type(node_t::SEQUENCE)); + mp_current_node = m_context_stack.back().p_node; + apply_directive_set(*mp_current_node); parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), - context_state_t::BLOCK_SEQUENCE_ENTRY, + context_state_t::BLOCK_SEQUENCE, mp_current_node); m_context_stack.emplace_back(std::move(context)); - apply_directive_set(*mp_current_node); break; } - mp_current_node = new node_type(); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_KEY, new node_type()); + mp_current_node = m_context_stack.back().p_node; apply_directive_set(*mp_current_node); indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); @@ -328,15 +357,18 @@ class basic_deserializer { bool do_continue = true; switch (type) { - case lexical_token_t::SEQUENCE_BLOCK_PREFIX: + case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { // a key separator preceeding block sequence entries *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); + auto& cur_context = m_context_stack.back(); + cur_context.line = line; + cur_context.indent = indent; + cur_context.state = context_state_t::BLOCK_SEQUENCE; do_continue = false; break; + } case lexical_token_t::EXPLICIT_KEY_PREFIX: // a key separator for a explicit block mapping key. // defer the handling of the explicit key prefix token until the next loop. @@ -364,24 +396,24 @@ class basic_deserializer { // handle explicit mapping key separators. - while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { - mp_current_node = m_context_stack.back().p_node; + while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { m_context_stack.pop_back(); } - node_type* key_node = mp_current_node; + node_type* key_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); m_context_stack.back().p_node->template get_value_ref().emplace(*key_node, node_type()); mp_current_node = &(m_context_stack.back().p_node->operator[](*key_node)); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE, mp_current_node); delete key_node; key_node = nullptr; - m_context_stack.back().state = context_state_t::BLOCK_MAPPING_KEY_IMPLICIT; - m_context_stack.emplace_back(m_context_stack.back()); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); break; } @@ -406,71 +438,109 @@ class basic_deserializer { // the correct indent width for the "bar" node key. continue; - case lexical_token_t::SEQUENCE_BLOCK_PREFIX: - if (mp_current_node->is_sequence()) { - bool is_empty = mp_current_node->empty(); - if (is_empty) { - bool is_further_nested = !m_context_stack.empty() && m_context_stack.back().indent < indent; - if (is_further_nested) { - mp_current_node->template get_value_ref().emplace_back( - node_type::sequence()); - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); - mp_current_node = &(mp_current_node->template get_value_ref().back()); - break; - } - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); - break; - } - - // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent < m_context_stack.back().indent) { - mp_current_node = m_context_stack.back().p_node; - m_context_stack.pop_back(); - } + case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { + bool is_further_nested = m_context_stack.back().indent < indent; + if (is_further_nested) { + mp_current_node->template get_value_ref().emplace_back(node_type::sequence()); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); break; } // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent != m_context_stack.back().indent) { - mp_current_node = m_context_stack.back().p_node; + while (m_context_stack.back().state != context_state_t::BLOCK_SEQUENCE || + indent != m_context_stack.back().indent) { m_context_stack.pop_back(); } - - // for mappings in a sequence. - mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); - mp_current_node = &(mp_current_node->template get_value_ref().back()); - apply_directive_set(*mp_current_node); + mp_current_node = m_context_stack.back().p_node; break; - case lexical_token_t::SEQUENCE_FLOW_BEGIN: - ++m_flow_context_depth; - *mp_current_node = node_type::sequence(); + } + case lexical_token_t::SEQUENCE_FLOW_BEGIN: { + bool is_more_nested_in_block = m_flow_context_depth++ == 0 && m_context_stack.back().indent < indent; + if (is_more_nested_in_block) { + if (mp_current_node->is_sequence()) { + mp_current_node->template get_value_ref().emplace_back(node_type::sequence()); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + } + else { + *mp_current_node = node_type::sequence(); + } + } + else { + *mp_current_node = node_type::sequence(); + } apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::FLOW_SEQUENCE, mp_current_node); break; + } case lexical_token_t::SEQUENCE_FLOW_END: { - FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - mp_current_node = m_context_stack.back().p_node; - m_context_stack.pop_back(); + + // find the corresponding flow sequence beginning. + auto itr = std::find_if( // LCOV_EXCL_LINE + m_context_stack.rbegin(), + m_context_stack.rend(), + [](const parse_context& c) { return c.state == context_state_t::FLOW_SEQUENCE; }); + + bool is_valid = itr != m_context_stack.rend(); + if (!is_valid) { + throw parse_error("invalid flow sequence ending is found.", line, indent); + } + + // move back to the context before the flow sequence. + auto pop_num = std::distance(m_context_stack.rbegin(), itr) + 1; + for (auto i = 0; i < pop_num; i++) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); + } + if (!m_context_stack.empty()) { + mp_current_node = m_context_stack.back().p_node; + } break; } - case lexical_token_t::MAPPING_FLOW_BEGIN: - ++m_flow_context_depth; - *mp_current_node = node_type::mapping(); + case lexical_token_t::MAPPING_FLOW_BEGIN: { + bool is_more_nested_in_block = m_flow_context_depth++ == 0 && m_context_stack.back().indent < indent; + if (is_more_nested_in_block) { + if (mp_current_node->is_sequence()) { + mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + } + else { + *mp_current_node = node_type::mapping(); + } + } + else { + *mp_current_node = node_type::mapping(); + } apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::FLOW_MAPPING, mp_current_node); break; + } case lexical_token_t::MAPPING_FLOW_END: { - FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - bool is_stack_empty = m_context_stack.empty(); - if (!is_stack_empty) { + + // find the corresponding flow mapping beginning. + auto itr = std::find_if( // LCOV_EXCL_LINE + m_context_stack.rbegin(), + m_context_stack.rend(), + [](const parse_context& c) { return c.state == context_state_t::FLOW_MAPPING; }); + + bool is_valid = itr != m_context_stack.rend(); + if (!is_valid) { + throw parse_error("invalid flow mapping ending is found.", line, indent); + } + + // move back to the context before the flow sequence. + auto pop_num = std::distance(m_context_stack.rbegin(), itr) + 1; + for (auto i = 0; i < pop_num; i++) { mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } + if (!m_context_stack.empty()) { + mp_current_node = m_context_stack.back().p_node; + } break; } case lexical_token_t::ALIAS_PREFIX: @@ -572,7 +642,11 @@ class basic_deserializer { /// @param indent The indentation width in the current line where the key is found. /// @param line The line where the key is found. void add_new_key(node_type&& key, const uint32_t indent, const uint32_t line) { - if (!m_context_stack.empty() && indent < m_context_stack.back().indent) { + uint32_t pop_num = 0; + if (indent == 0) { + pop_num = static_cast(m_context_stack.size() - 1); + } + else if (indent < m_context_stack.back().indent) { auto target_itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), [indent](const parse_context& c) { return indent == c.indent; @@ -582,39 +656,29 @@ class basic_deserializer { throw parse_error("Detected invalid indentaion.", line, indent); } - auto pop_num = std::distance(m_context_stack.rbegin(), target_itr) + 1; - for (auto i = 0; i < pop_num; i++) { + pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); + } + if (pop_num > 0) { + for (uint32_t i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } + mp_current_node = m_context_stack.back().p_node; } if (mp_current_node->is_sequence()) { mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); } - mapping_type& map = mp_current_node->template get_value_ref(); - bool is_empty = map.empty(); - if (is_empty) { - if (m_flow_context_depth == 0) { - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); - } - } - else { - // check key duplication in the current mapping if not empty. - auto itr = map.find(key); - if (itr != map.end()) { - throw parse_error("Detected duplication in mapping keys.", line, indent); - } + auto itr = mp_current_node->template get_value_ref().emplace(std::move(key), node_type()); + if (!itr.second) { + throw parse_error("Detected duplication in mapping keys.", line, indent); } - map.emplace(key, node_type()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); - mp_current_node = &(mp_current_node->operator[](std::move(key))); + mp_current_node = &(itr.first->second); + m_context_stack.emplace_back(line, indent, context_state_t::MAPPING_VALUE, mp_current_node); } /// @brief Assign node value to the current node. @@ -627,9 +691,9 @@ class basic_deserializer { // a scalar node *mp_current_node = std::move(node_value); - if (m_flow_context_depth > 0 || m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { - mp_current_node = m_context_stack.back().p_node; + if (m_flow_context_depth > 0 || m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { m_context_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; } } @@ -737,7 +801,7 @@ class basic_deserializer { if (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator(:) assign_node_value(std::move(node)); - if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } @@ -746,9 +810,20 @@ class basic_deserializer { return true; } - parse_context& last_context = m_context_stack.back(); - if (last_context.line == line && last_context.state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { - throw parse_error("multiple mapping keys are specified on the same line.", line, indent); + parse_context& cur_context = m_context_stack.back(); + switch (cur_context.state) { + case context_state_t::BLOCK_MAPPING_EXPLICIT_KEY: + case context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE: + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + break; + default: + if (cur_context.line == line) { + throw parse_error("Multiple mapping keys are specified on the same line.", line, indent); + } + cur_context.line = line; + cur_context.indent = indent; + cur_context.state = context_state_t::BLOCK_MAPPING; + break; } *mp_current_node = node_type::mapping(); diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 6398804f..6fd99053 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -175,9 +175,6 @@ class lexical_analyzer { ++m_cur_itr; return lexical_token_t::SEQUENCE_FLOW_BEGIN; case ']': // sequence flow end - if (m_flow_context_depth == 0) { - emit_error("An invalid flow sequence ending."); - } m_flow_context_depth--; ++m_cur_itr; return lexical_token_t::SEQUENCE_FLOW_END; @@ -186,9 +183,6 @@ class lexical_analyzer { ++m_cur_itr; return lexical_token_t::MAPPING_FLOW_BEGIN; case '}': // mapping flow end - if (m_flow_context_depth == 0) { - emit_error("An invalid flow mapping ending."); - } m_flow_context_depth--; ++m_cur_itr; return lexical_token_t::MAPPING_FLOW_END; diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 80440877..d16e3c62 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -2427,9 +2427,6 @@ class lexical_analyzer { ++m_cur_itr; return lexical_token_t::SEQUENCE_FLOW_BEGIN; case ']': // sequence flow end - if (m_flow_context_depth == 0) { - emit_error("An invalid flow sequence ending."); - } m_flow_context_depth--; ++m_cur_itr; return lexical_token_t::SEQUENCE_FLOW_END; @@ -2438,9 +2435,6 @@ class lexical_analyzer { ++m_cur_itr; return lexical_token_t::MAPPING_FLOW_BEGIN; case '}': // mapping flow end - if (m_flow_context_depth == 0) { - emit_error("An invalid flow mapping ending."); - } m_flow_context_depth--; ++m_cur_itr; return lexical_token_t::MAPPING_FLOW_END; @@ -3923,9 +3917,13 @@ class basic_deserializer { /// @brief Definition of state types of parse contexts. enum class context_state_t { - BLOCK_MAPPING_KEY_IMPLICIT, //!< The underlying node is an implicit block mapping key. - BLOCK_MAPPING_KEY_EXPLICIT, //!< The underlying node is an explicit block mapping key. - BLOCK_SEQUENCE_ENTRY, //!< The underlying node is a sequence. + BLOCK_MAPPING, //!< The underlying node is a block mapping. + BLOCK_MAPPING_EXPLICIT_KEY, //!< The underlying node is an explicit block mapping key. + BLOCK_MAPPING_EXPLICIT_VALUE, //!< The underlying node is an explicit block mapping value. + MAPPING_VALUE, //!< The underlying node is a block mapping value. + BLOCK_SEQUENCE, //!< The underlying node is a block sequence. + FLOW_SEQUENCE, //!< The underlying node is a flow sequence. + FLOW_MAPPING, //!< The underlying node is a flow mapping. }; /// @brief Context information set for parsing. @@ -3950,8 +3948,8 @@ class basic_deserializer { /// The indentation width in the current line. (count from zero) uint32_t indent {0}; /// The parse context type. - context_state_t state {context_state_t::BLOCK_MAPPING_KEY_IMPLICIT}; - /// The underlying node associated to this context. + context_state_t state {context_state_t::BLOCK_MAPPING}; + /// The pointer to the associated node to this context. node_type* p_node {nullptr}; }; @@ -3974,23 +3972,40 @@ class basic_deserializer { deserialize_directives(lexer, type); switch (type) { - case lexical_token_t::SEQUENCE_BLOCK_PREFIX: - case lexical_token_t::SEQUENCE_FLOW_BEGIN: { + case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { root = node_type::sequence(); apply_directive_set(root); parse_context context( - lexer.get_lines_processed(), - lexer.get_last_token_begin_pos(), - context_state_t::BLOCK_SEQUENCE_ENTRY, - &root); + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_SEQUENCE, &root); m_context_stack.emplace_back(std::move(context)); + type = lexer.get_next_token(); break; } - default: + case lexical_token_t::SEQUENCE_FLOW_BEGIN: + ++m_flow_context_depth; + root = node_type::sequence(); + apply_directive_set(root); + m_context_stack.emplace_back( + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_SEQUENCE, &root); + type = lexer.get_next_token(); + break; + case lexical_token_t::MAPPING_FLOW_BEGIN: + ++m_flow_context_depth; + root = node_type::mapping(); + apply_directive_set(root); + m_context_stack.emplace_back( + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::FLOW_MAPPING, &root); + type = lexer.get_next_token(); + break; + default: { root = node_type::mapping(); apply_directive_set(root); + parse_context context( + lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), context_state_t::BLOCK_MAPPING, &root); + m_context_stack.emplace_back(std::move(context)); break; } + } mp_current_node = &root; @@ -4102,19 +4117,26 @@ class basic_deserializer { // This handles an empty input. break; case lexical_token_t::EXPLICIT_KEY_PREFIX: { - bool needs_to_move_back = !m_context_stack.empty() && indent < m_context_stack.back().indent; - if (needs_to_move_back) { - auto target_itr = std::find_if( // LCOV_EXCL_LINE - m_context_stack.rbegin(), - m_context_stack.rend(), - [indent](const parse_context& c) { return indent > c.indent; }); - - auto pop_num = std::distance(m_context_stack.rbegin(), target_itr); - for (auto i = 0; i < pop_num; i++) { + uint32_t pop_num = 0; + if (indent == 0) { + pop_num = static_cast(m_context_stack.size() - 1); + } + else { + bool needs_to_move_back = indent < m_context_stack.back().indent; + if (needs_to_move_back) { + auto target_itr = std::find_if( // LCOV_EXCL_LINE + m_context_stack.rbegin(), + m_context_stack.rend(), + [indent](const parse_context& c) { return indent > c.indent; }); + pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); + } + } + if (pop_num > 0) { + for (uint32_t i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } + mp_current_node = m_context_stack.back().p_node; } if (mp_current_node->is_null()) { @@ -4129,23 +4151,24 @@ class basic_deserializer { apply_directive_set(*mp_current_node); } - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_MAPPING_KEY_EXPLICIT, mp_current_node); - type = lexer.get_next_token(); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { - mp_current_node = new node_type(node_t::SEQUENCE); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_KEY, new node_type(node_t::SEQUENCE)); + mp_current_node = m_context_stack.back().p_node; + apply_directive_set(*mp_current_node); parse_context context( lexer.get_lines_processed(), lexer.get_last_token_begin_pos(), - context_state_t::BLOCK_SEQUENCE_ENTRY, + context_state_t::BLOCK_SEQUENCE, mp_current_node); m_context_stack.emplace_back(std::move(context)); - apply_directive_set(*mp_current_node); break; } - mp_current_node = new node_type(); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_KEY, new node_type()); + mp_current_node = m_context_stack.back().p_node; apply_directive_set(*mp_current_node); indent = lexer.get_last_token_begin_pos(); line = lexer.get_lines_processed(); @@ -4204,15 +4227,18 @@ class basic_deserializer { bool do_continue = true; switch (type) { - case lexical_token_t::SEQUENCE_BLOCK_PREFIX: + case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { // a key separator preceeding block sequence entries *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); + auto& cur_context = m_context_stack.back(); + cur_context.line = line; + cur_context.indent = indent; + cur_context.state = context_state_t::BLOCK_SEQUENCE; do_continue = false; break; + } case lexical_token_t::EXPLICIT_KEY_PREFIX: // a key separator for a explicit block mapping key. // defer the handling of the explicit key prefix token until the next loop. @@ -4240,24 +4266,24 @@ class basic_deserializer { // handle explicit mapping key separators. - while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { - mp_current_node = m_context_stack.back().p_node; + while (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { m_context_stack.pop_back(); } - node_type* key_node = mp_current_node; + node_type* key_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); m_context_stack.back().p_node->template get_value_ref().emplace(*key_node, node_type()); mp_current_node = &(m_context_stack.back().p_node->operator[](*key_node)); + m_context_stack.emplace_back( + line, indent, context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE, mp_current_node); delete key_node; key_node = nullptr; - m_context_stack.back().state = context_state_t::BLOCK_MAPPING_KEY_IMPLICIT; - m_context_stack.emplace_back(m_context_stack.back()); if (type == lexical_token_t::SEQUENCE_BLOCK_PREFIX) { *mp_current_node = node_type::sequence(); apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); break; } @@ -4282,71 +4308,109 @@ class basic_deserializer { // the correct indent width for the "bar" node key. continue; - case lexical_token_t::SEQUENCE_BLOCK_PREFIX: - if (mp_current_node->is_sequence()) { - bool is_empty = mp_current_node->empty(); - if (is_empty) { - bool is_further_nested = !m_context_stack.empty() && m_context_stack.back().indent < indent; - if (is_further_nested) { - mp_current_node->template get_value_ref().emplace_back( - node_type::sequence()); - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); - mp_current_node = &(mp_current_node->template get_value_ref().back()); - break; - } - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); - break; - } - - // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent < m_context_stack.back().indent) { - mp_current_node = m_context_stack.back().p_node; - m_context_stack.pop_back(); - } + case lexical_token_t::SEQUENCE_BLOCK_PREFIX: { + bool is_further_nested = m_context_stack.back().indent < indent; + if (is_further_nested) { + mp_current_node->template get_value_ref().emplace_back(node_type::sequence()); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE, mp_current_node); break; } // move back to the previous sequence if necessary. - while (!mp_current_node->is_sequence() || indent != m_context_stack.back().indent) { - mp_current_node = m_context_stack.back().p_node; + while (m_context_stack.back().state != context_state_t::BLOCK_SEQUENCE || + indent != m_context_stack.back().indent) { m_context_stack.pop_back(); } - - // for mappings in a sequence. - mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); - mp_current_node = &(mp_current_node->template get_value_ref().back()); - apply_directive_set(*mp_current_node); + mp_current_node = m_context_stack.back().p_node; break; - case lexical_token_t::SEQUENCE_FLOW_BEGIN: - ++m_flow_context_depth; - *mp_current_node = node_type::sequence(); + } + case lexical_token_t::SEQUENCE_FLOW_BEGIN: { + bool is_more_nested_in_block = m_flow_context_depth++ == 0 && m_context_stack.back().indent < indent; + if (is_more_nested_in_block) { + if (mp_current_node->is_sequence()) { + mp_current_node->template get_value_ref().emplace_back(node_type::sequence()); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + } + else { + *mp_current_node = node_type::sequence(); + } + } + else { + *mp_current_node = node_type::sequence(); + } apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::FLOW_SEQUENCE, mp_current_node); break; + } case lexical_token_t::SEQUENCE_FLOW_END: { - FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - mp_current_node = m_context_stack.back().p_node; - m_context_stack.pop_back(); + + // find the corresponding flow sequence beginning. + auto itr = std::find_if( // LCOV_EXCL_LINE + m_context_stack.rbegin(), + m_context_stack.rend(), + [](const parse_context& c) { return c.state == context_state_t::FLOW_SEQUENCE; }); + + bool is_valid = itr != m_context_stack.rend(); + if (!is_valid) { + throw parse_error("invalid flow sequence ending is found.", line, indent); + } + + // move back to the context before the flow sequence. + auto pop_num = std::distance(m_context_stack.rbegin(), itr) + 1; + for (auto i = 0; i < pop_num; i++) { + mp_current_node = m_context_stack.back().p_node; + m_context_stack.pop_back(); + } + if (!m_context_stack.empty()) { + mp_current_node = m_context_stack.back().p_node; + } break; } - case lexical_token_t::MAPPING_FLOW_BEGIN: - ++m_flow_context_depth; - *mp_current_node = node_type::mapping(); + case lexical_token_t::MAPPING_FLOW_BEGIN: { + bool is_more_nested_in_block = m_flow_context_depth++ == 0 && m_context_stack.back().indent < indent; + if (is_more_nested_in_block) { + if (mp_current_node->is_sequence()) { + mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); + mp_current_node = &(mp_current_node->template get_value_ref().back()); + } + else { + *mp_current_node = node_type::mapping(); + } + } + else { + *mp_current_node = node_type::mapping(); + } apply_directive_set(*mp_current_node); apply_node_properties(*mp_current_node); + m_context_stack.emplace_back(line, indent, context_state_t::FLOW_MAPPING, mp_current_node); break; + } case lexical_token_t::MAPPING_FLOW_END: { - FK_YAML_ASSERT(m_flow_context_depth > 0); --m_flow_context_depth; - bool is_stack_empty = m_context_stack.empty(); - if (!is_stack_empty) { + + // find the corresponding flow mapping beginning. + auto itr = std::find_if( // LCOV_EXCL_LINE + m_context_stack.rbegin(), + m_context_stack.rend(), + [](const parse_context& c) { return c.state == context_state_t::FLOW_MAPPING; }); + + bool is_valid = itr != m_context_stack.rend(); + if (!is_valid) { + throw parse_error("invalid flow mapping ending is found.", line, indent); + } + + // move back to the context before the flow sequence. + auto pop_num = std::distance(m_context_stack.rbegin(), itr) + 1; + for (auto i = 0; i < pop_num; i++) { mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } + if (!m_context_stack.empty()) { + mp_current_node = m_context_stack.back().p_node; + } break; } case lexical_token_t::ALIAS_PREFIX: @@ -4448,7 +4512,11 @@ class basic_deserializer { /// @param indent The indentation width in the current line where the key is found. /// @param line The line where the key is found. void add_new_key(node_type&& key, const uint32_t indent, const uint32_t line) { - if (!m_context_stack.empty() && indent < m_context_stack.back().indent) { + uint32_t pop_num = 0; + if (indent == 0) { + pop_num = static_cast(m_context_stack.size() - 1); + } + else if (indent < m_context_stack.back().indent) { auto target_itr = std::find_if(m_context_stack.rbegin(), m_context_stack.rend(), [indent](const parse_context& c) { return indent == c.indent; @@ -4458,39 +4526,29 @@ class basic_deserializer { throw parse_error("Detected invalid indentaion.", line, indent); } - auto pop_num = std::distance(m_context_stack.rbegin(), target_itr) + 1; - for (auto i = 0; i < pop_num; i++) { + pop_num = static_cast(std::distance(m_context_stack.rbegin(), target_itr)); + } + if (pop_num > 0) { + for (uint32_t i = 0; i < pop_num; i++) { // move back to the previous container node. - mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } + mp_current_node = m_context_stack.back().p_node; } if (mp_current_node->is_sequence()) { mp_current_node->template get_value_ref().emplace_back(node_type::mapping()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_SEQUENCE_ENTRY, mp_current_node); mp_current_node = &(mp_current_node->operator[](mp_current_node->size() - 1)); + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); } - mapping_type& map = mp_current_node->template get_value_ref(); - bool is_empty = map.empty(); - if (is_empty) { - if (m_flow_context_depth == 0) { - m_context_stack.emplace_back( - line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); - } - } - else { - // check key duplication in the current mapping if not empty. - auto itr = map.find(key); - if (itr != map.end()) { - throw parse_error("Detected duplication in mapping keys.", line, indent); - } + auto itr = mp_current_node->template get_value_ref().emplace(std::move(key), node_type()); + if (!itr.second) { + throw parse_error("Detected duplication in mapping keys.", line, indent); } - map.emplace(key, node_type()); - m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING_KEY_IMPLICIT, mp_current_node); - mp_current_node = &(mp_current_node->operator[](std::move(key))); + mp_current_node = &(itr.first->second); + m_context_stack.emplace_back(line, indent, context_state_t::MAPPING_VALUE, mp_current_node); } /// @brief Assign node value to the current node. @@ -4503,9 +4561,9 @@ class basic_deserializer { // a scalar node *mp_current_node = std::move(node_value); - if (m_flow_context_depth > 0 || m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { - mp_current_node = m_context_stack.back().p_node; + if (m_flow_context_depth > 0 || m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { m_context_stack.pop_back(); + mp_current_node = m_context_stack.back().p_node; } } @@ -4613,7 +4671,7 @@ class basic_deserializer { if (line != lexer.get_lines_processed()) { // This path is for explicit mapping key separator(:) assign_node_value(std::move(node)); - if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { + if (m_context_stack.back().state != context_state_t::BLOCK_MAPPING_EXPLICIT_KEY) { mp_current_node = m_context_stack.back().p_node; m_context_stack.pop_back(); } @@ -4622,9 +4680,20 @@ class basic_deserializer { return true; } - parse_context& last_context = m_context_stack.back(); - if (last_context.line == line && last_context.state != context_state_t::BLOCK_MAPPING_KEY_EXPLICIT) { - throw parse_error("multiple mapping keys are specified on the same line.", line, indent); + parse_context& cur_context = m_context_stack.back(); + switch (cur_context.state) { + case context_state_t::BLOCK_MAPPING_EXPLICIT_KEY: + case context_state_t::BLOCK_MAPPING_EXPLICIT_VALUE: + m_context_stack.emplace_back(line, indent, context_state_t::BLOCK_MAPPING, mp_current_node); + break; + default: + if (cur_context.line == line) { + throw parse_error("Multiple mapping keys are specified on the same line.", line, indent); + } + cur_context.line = line; + cur_context.indent = indent; + cur_context.state = context_state_t::BLOCK_MAPPING; + break; } *mp_current_node = node_type::mapping(); diff --git a/test/unit_test/test_custom_from_node.cpp b/test/unit_test/test_custom_from_node.cpp index fbde426b..a9a09b7b 100644 --- a/test/unit_test/test_custom_from_node.cpp +++ b/test/unit_test/test_custom_from_node.cpp @@ -75,6 +75,7 @@ TEST_CASE("FromNode_UserDefinedTypeVector") { fkyaml::node node = fkyaml::node::deserialize(input); auto novels = node["novels"].get_value>(); + REQUIRE(novels.size() == 2); REQUIRE(novels[0].title == "Robinson Crusoe"); REQUIRE(novels[0].author == "Daniel Defoe"); REQUIRE(novels[0].year == 1678); diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 76c74804..6ba7d02f 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -299,11 +299,13 @@ TEST_CASE("Deserializer_BlockSequence") { SECTION("root sequence with nested child block sequence") { std::string input = "- - foo\n" " - 123\n" - "- 3.14"; + "- 3.14\n" + "- - True\n" + " - null"; REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); REQUIRE(root.is_sequence()); - REQUIRE(root.size() == 2); + REQUIRE(root.size() == 3); fkyaml::node& root_0_node = root[0]; REQUIRE(root_0_node.is_sequence()); @@ -320,6 +322,120 @@ TEST_CASE("Deserializer_BlockSequence") { fkyaml::node& root_1_node = root[1]; REQUIRE(root_1_node.is_float_number()); REQUIRE(root_1_node.get_value() == 3.14); + + fkyaml::node& root_2_node = root[2]; + REQUIRE(root_2_node.is_sequence()); + REQUIRE(root_2_node.size() == 2); + + fkyaml::node& root_2_0_node = root_2_node[0]; + REQUIRE(root_2_0_node.is_boolean()); + REQUIRE(root_2_0_node.get_value() == true); + + fkyaml::node& root_2_1_node = root_2_node[1]; + REQUIRE(root_2_1_node.is_null()); + } + + SECTION("root sequence with child flow sequence") { + std::string input = "- [username, identifier, score]\n" + "- [booker12, 9012 , 61.25]\n" + "- [grey07 , 2070 , 84.50]"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_sequence()); + REQUIRE(root.size() == 3); + + fkyaml::node& root_0_node = root[0]; + REQUIRE(root_0_node.is_sequence()); + REQUIRE(root_0_node.size() == 3); + + fkyaml::node& root_0_0_node = root_0_node[0]; + REQUIRE(root_0_0_node.is_string()); + REQUIRE(root_0_0_node.get_value_ref() == "username"); + + fkyaml::node& root_0_1_node = root_0_node[1]; + REQUIRE(root_0_1_node.is_string()); + REQUIRE(root_0_1_node.get_value_ref() == "identifier"); + + fkyaml::node& root_0_2_node = root_0_node[2]; + REQUIRE(root_0_2_node.is_string()); + REQUIRE(root_0_2_node.get_value_ref() == "score"); + + fkyaml::node& root_1_node = root[1]; + REQUIRE(root_1_node.is_sequence()); + REQUIRE(root_1_node.size() == 3); + + fkyaml::node& root_1_0_node = root_1_node[0]; + REQUIRE(root_1_0_node.is_string()); + REQUIRE(root_1_0_node.get_value_ref() == "booker12"); + + fkyaml::node& root_1_1_node = root_1_node[1]; + REQUIRE(root_1_1_node.is_integer()); + REQUIRE(root_1_1_node.get_value() == 9012); + + fkyaml::node& root_1_2_node = root_1_node[2]; + REQUIRE(root_1_2_node.is_float_number()); + REQUIRE(root_1_2_node.get_value() == 61.25); + + fkyaml::node& root_2_node = root[2]; + REQUIRE(root_2_node.is_sequence()); + REQUIRE(root_2_node.size() == 3); + + fkyaml::node& root_2_0_node = root_2_node[0]; + REQUIRE(root_2_0_node.is_string()); + REQUIRE(root_2_0_node.get_value_ref() == "grey07"); + + fkyaml::node& root_2_1_node = root_2_node[1]; + REQUIRE(root_2_1_node.is_integer()); + REQUIRE(root_2_1_node.get_value() == 2070); + + fkyaml::node& root_2_2_node = root_2_node[2]; + REQUIRE(root_2_2_node.is_float_number()); + REQUIRE(root_2_2_node.get_value() == 84.50); + } + + SECTION("root sequence with child flow mapping") { + std::string input = "- {foo: false, null: 123}\n" + "- {true: 3.14, bar: [0x30,0o30]}"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_sequence()); + REQUIRE(root.size() == 2); + + fkyaml::node& root_0_node = root[0]; + REQUIRE(root_0_node.is_mapping()); + REQUIRE(root_0_node.size() == 2); + REQUIRE(root_0_node.contains("foo")); + REQUIRE(root_0_node.contains(nullptr)); + + fkyaml::node& root_0_foo_node = root_0_node["foo"]; + REQUIRE(root_0_foo_node.is_boolean()); + REQUIRE(root_0_foo_node.get_value() == false); + + fkyaml::node& root_0_null_node = root_0_node[nullptr]; + REQUIRE(root_0_null_node.is_integer()); + REQUIRE(root_0_null_node.get_value() == 123); + + fkyaml::node& root_1_node = root[1]; + REQUIRE(root_1_node.is_mapping()); + REQUIRE(root_1_node.size() == 2); + REQUIRE(root_1_node.contains(true)); + REQUIRE(root_1_node.contains("bar")); + + fkyaml::node& root_1_true_node = root_1_node[true]; + REQUIRE(root_1_true_node.is_float_number()); + REQUIRE(root_1_true_node.get_value() == 3.14); + + fkyaml::node& root_1_bar_node = root_1_node["bar"]; + REQUIRE(root_1_bar_node.is_sequence()); + REQUIRE(root_1_bar_node.size() == 2); + + fkyaml::node& root_1_bar_0_node = root_1_bar_node[0]; + REQUIRE(root_1_bar_0_node.is_integer()); + REQUIRE(root_1_bar_0_node.get_value() == 0x30); + + fkyaml::node& root_1_bar_1_node = root_1_bar_node[1]; + REQUIRE(root_1_bar_1_node.is_integer()); + REQUIRE(root_1_bar_1_node.get_value() == 030); } } @@ -909,7 +1025,7 @@ TEST_CASE("Deserializer_FlowSequence") { } SECTION("lack the beginning of a flow sequence") { - REQUIRE_THROWS_AS(deserializer.deserialize(fkyaml::detail::input_adapter("test: ]")), fkyaml::parse_error); + REQUIRE_THROWS_AS(deserializer.deserialize(fkyaml::detail::input_adapter("test: {]}")), fkyaml::parse_error); } SECTION("root flow sequence") { @@ -989,10 +1105,10 @@ TEST_CASE("Deserializer_FlowMapping") { } SECTION("lack the beginning of a flow mapping") { - REQUIRE_THROWS_AS(deserializer.deserialize(fkyaml::detail::input_adapter("test: }")), fkyaml::parse_error); + REQUIRE_THROWS_AS(deserializer.deserialize(fkyaml::detail::input_adapter("test: [}]")), fkyaml::parse_error); } - SECTION("flow mapping with a flow sequence") { + SECTION("flow mapping with child flow sequence") { REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("test: {foo: [true,123]}"))); REQUIRE(root.is_mapping()); @@ -1017,6 +1133,28 @@ TEST_CASE("Deserializer_FlowMapping") { REQUIRE(test_foo_1_node.get_value() == 123); } + SECTION("flow mapping with child flow mapping") { + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("test: {foo: {true: 123}}"))); + + REQUIRE(root.is_mapping()); + REQUIRE(root.size() == 1); + REQUIRE(root.contains("test")); + + fkyaml::node& test_node = root["test"]; + REQUIRE(test_node.is_mapping()); + REQUIRE(test_node.size() == 1); + REQUIRE(test_node.contains("foo")); + + fkyaml::node& test_foo_node = test_node["foo"]; + REQUIRE(test_foo_node.is_mapping()); + REQUIRE(test_foo_node.size() == 1); + REQUIRE(test_foo_node.contains(true)); + + fkyaml::node& test_foo_true_node = test_foo_node[true]; + REQUIRE(test_foo_true_node.is_integer()); + REQUIRE(test_foo_true_node.get_value() == 123); + } + SECTION("root flow mapping") { REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter("{foo: 123, true: 3.14}"))); From 7f141c2b95c4def98fa5c7e4a634fbcdcee9c031 Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 2 May 2024 16:23:39 +0900 Subject: [PATCH 7/8] Fixed parse error on block sequences with child block mappings split by a newline code (#333) --- .../fkYAML/detail/input/lexical_analyzer.hpp | 18 ++++++- single_include/fkYAML/node.hpp | 18 ++++++- test/unit_test/test_deserializer_class.cpp | 53 +++++++++++++++++++ .../unit_test/test_lexical_analyzer_class.cpp | 17 ++++++ 4 files changed, 104 insertions(+), 2 deletions(-) diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 6fd99053..9e60b5fc 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -154,11 +154,27 @@ class lexical_analyzer { return scan_directive(); case '-': { char next = *(m_cur_itr + 1); - if (next == ' ') { + switch (next) { + case ' ': + case '\t': + case '\n': // Move a cursor to the beginning of the next token. m_cur_itr += 2; return lexical_token_t::SEQUENCE_BLOCK_PREFIX; + case '\r': + next = *(m_cur_itr + 2); + // Move a cursor to the beginning of the next token. + m_cur_itr += 2 + (next == '\n' ? 1 : 0); + return lexical_token_t::SEQUENCE_BLOCK_PREFIX; + break; + default: + break; } + // if (next == ' ') { + // // Move a cursor to the beginning of the next token. + // m_cur_itr += 2; + // return lexical_token_t::SEQUENCE_BLOCK_PREFIX; + // } bool is_available = (std::distance(m_cur_itr, m_end_itr) > 2); if (is_available) { diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index d16e3c62..15508fe9 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -2406,11 +2406,27 @@ class lexical_analyzer { return scan_directive(); case '-': { char next = *(m_cur_itr + 1); - if (next == ' ') { + switch (next) { + case ' ': + case '\t': + case '\n': // Move a cursor to the beginning of the next token. m_cur_itr += 2; return lexical_token_t::SEQUENCE_BLOCK_PREFIX; + case '\r': + next = *(m_cur_itr + 2); + // Move a cursor to the beginning of the next token. + m_cur_itr += 2 + (next == '\n' ? 1 : 0); + return lexical_token_t::SEQUENCE_BLOCK_PREFIX; + break; + default: + break; } + // if (next == ' ') { + // // Move a cursor to the beginning of the next token. + // m_cur_itr += 2; + // return lexical_token_t::SEQUENCE_BLOCK_PREFIX; + // } bool is_available = (std::distance(m_cur_itr, m_end_itr) > 2); if (is_available) { diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 6ba7d02f..23507877 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -437,6 +437,59 @@ TEST_CASE("Deserializer_BlockSequence") { REQUIRE(root_1_bar_1_node.is_integer()); REQUIRE(root_1_bar_1_node.get_value() == 030); } + + SECTION("block mapping with child block mapping (split by a newline code)") { + std::string input = "-\n" + " name: Mark McGwire\n" + " hr: 65\n" + " avg: 0.278\n" + "-\n" + " name: Sammy Sosa\n" + " hr: 63\n" + " avg: 0.288"; + REQUIRE_NOTHROW(root = deserializer.deserialize(fkyaml::detail::input_adapter(input))); + + REQUIRE(root.is_sequence()); + REQUIRE(root.size() == 2); + + fkyaml::node& root_0_node = root[0]; + REQUIRE(root_0_node.is_mapping()); + REQUIRE(root_0_node.size() == 3); + REQUIRE(root_0_node.contains("name")); + REQUIRE(root_0_node.contains("hr")); + REQUIRE(root_0_node.contains("avg")); + + fkyaml::node& root_0_name_node = root_0_node["name"]; + REQUIRE(root_0_name_node.is_string()); + REQUIRE(root_0_name_node.get_value_ref() == "Mark McGwire"); + + fkyaml::node& root_0_hr_node = root_0_node["hr"]; + REQUIRE(root_0_hr_node.is_integer()); + REQUIRE(root_0_hr_node.get_value() == 65); + + fkyaml::node& root_0_avg_node = root_0_node["avg"]; + REQUIRE(root_0_avg_node.is_float_number()); + REQUIRE(root_0_avg_node.get_value() == 0.278); + + fkyaml::node& root_1_node = root[1]; + REQUIRE(root_1_node.is_mapping()); + REQUIRE(root_1_node.size() == 3); + REQUIRE(root_1_node.contains("name")); + REQUIRE(root_1_node.contains("hr")); + REQUIRE(root_1_node.contains("avg")); + + fkyaml::node& root_1_name_node = root_1_node["name"]; + REQUIRE(root_1_name_node.is_string()); + REQUIRE(root_1_name_node.get_value_ref() == "Sammy Sosa"); + + fkyaml::node& root_1_hr_node = root_1_node["hr"]; + REQUIRE(root_1_hr_node.is_integer()); + REQUIRE(root_1_hr_node.get_value() == 63); + + fkyaml::node& root_1_avg_node = root_1_node["avg"]; + REQUIRE(root_1_avg_node.is_float_number()); + REQUIRE(root_1_avg_node.get_value() == 0.288); + } } TEST_CASE("Deserializer_BlockMapping") { diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/test/unit_test/test_lexical_analyzer_class.cpp index c4225ad3..041ea947 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/test/unit_test/test_lexical_analyzer_class.cpp @@ -309,6 +309,23 @@ TEST_CASE("LexicalAnalyzer_Colon") { } } +TEST_CASE("LexicalAnalzer_BlockSequenceEntryPrefix") { + auto input = GENERATE( + std::string("- foo"), + std::string("-\tfoo"), + std::string("-\r foo"), + std::string("-\r\n foo"), + std::string("-\n foo")); + + fkyaml::detail::lexical_token_t token; + lexer_t lexer(fkyaml::detail::input_adapter(input)); + REQUIRE_NOTHROW(token = lexer.get_next_token()); + REQUIRE(token == fkyaml::detail::lexical_token_t::SEQUENCE_BLOCK_PREFIX); + REQUIRE_NOTHROW(token = lexer.get_next_token()); + REQUIRE(token == fkyaml::detail::lexical_token_t::STRING_VALUE); + REQUIRE(lexer.get_string() == "foo"); +} + TEST_CASE("LexicalAnalyzer_Null") { fkyaml::detail::lexical_token_t token; From e60c4830098ecc7fcdbd06942034a7ca0e265a04 Mon Sep 17 00:00:00 2001 From: fktn Date: Thu, 2 May 2024 17:03:50 +0900 Subject: [PATCH 8/8] set version to 0.3.6 --- .reuse/templates/fkYAML.commented.jinja2 | 2 +- .reuse/templates/fkYAML_support.jinja2 | 2 +- CHANGELOG.md | 13 ++++ CMakeLists.txt | 2 +- Makefile | 2 +- .../ex_basic_node_add_anchor_name.cpp | 2 +- docs/examples/ex_basic_node_add_tag_name.cpp | 2 +- docs/examples/ex_basic_node_alias_of.cpp | 2 +- docs/examples/ex_basic_node_at_basic_node.cpp | 2 +- .../ex_basic_node_at_compatible_type.cpp | 2 +- docs/examples/ex_basic_node_begin.cpp | 2 +- docs/examples/ex_basic_node_boolean_type.cpp | 2 +- .../examples/ex_basic_node_const_iterator.cpp | 2 +- docs/examples/ex_basic_node_constructor_1.cpp | 2 +- docs/examples/ex_basic_node_constructor_2.cpp | 2 +- docs/examples/ex_basic_node_constructor_3.cpp | 2 +- docs/examples/ex_basic_node_constructor_4.cpp | 2 +- docs/examples/ex_basic_node_constructor_5.cpp | 2 +- docs/examples/ex_basic_node_constructor_6.cpp | 2 +- docs/examples/ex_basic_node_constructor_7.cpp | 2 +- docs/examples/ex_basic_node_contains.cpp | 2 +- ...ex_basic_node_copy_assignment_operator.cpp | 2 +- .../ex_basic_node_deserialize_char_array.cpp | 2 +- ...ex_basic_node_deserialize_file_pointer.cpp | 2 +- .../ex_basic_node_deserialize_iterators.cpp | 2 +- .../ex_basic_node_deserialize_string.cpp | 2 +- docs/examples/ex_basic_node_empty.cpp | 2 +- docs/examples/ex_basic_node_end.cpp | 2 +- .../ex_basic_node_extraction_operator.cpp | 2 +- .../ex_basic_node_float_number_type.cpp | 2 +- .../ex_basic_node_get_anchor_name.cpp | 2 +- docs/examples/ex_basic_node_get_tag_name.cpp | 2 +- docs/examples/ex_basic_node_get_value.cpp | 2 +- docs/examples/ex_basic_node_get_value_ref.cpp | 2 +- .../ex_basic_node_get_yaml_version.cpp | 2 +- .../ex_basic_node_has_anchor_name.cpp | 2 +- docs/examples/ex_basic_node_has_tag_name.cpp | 2 +- .../ex_basic_node_insertion_operator.cpp | 2 +- docs/examples/ex_basic_node_integer_type.cpp | 2 +- docs/examples/ex_basic_node_is_alias.cpp | 2 +- docs/examples/ex_basic_node_is_anchor.cpp | 2 +- docs/examples/ex_basic_node_is_boolean.cpp | 2 +- .../ex_basic_node_is_float_number.cpp | 2 +- docs/examples/ex_basic_node_is_integer.cpp | 2 +- docs/examples/ex_basic_node_is_mapping.cpp | 2 +- docs/examples/ex_basic_node_is_null.cpp | 2 +- docs/examples/ex_basic_node_is_scalar.cpp | 2 +- docs/examples/ex_basic_node_is_sequence.cpp | 2 +- docs/examples/ex_basic_node_is_string.cpp | 2 +- docs/examples/ex_basic_node_iterator.cpp | 2 +- docs/examples/ex_basic_node_mapping.cpp | 2 +- docs/examples/ex_basic_node_mapping_type.cpp | 2 +- docs/examples/ex_basic_node_node.cpp | 2 +- docs/examples/ex_basic_node_node_t.cpp | 2 +- docs/examples/ex_basic_node_operator_eq.cpp | 2 +- docs/examples/ex_basic_node_operator_ge.cpp | 2 +- docs/examples/ex_basic_node_operator_gt.cpp | 2 +- docs/examples/ex_basic_node_operator_le.cpp | 2 +- docs/examples/ex_basic_node_operator_lt.cpp | 2 +- docs/examples/ex_basic_node_operator_ne.cpp | 2 +- docs/examples/ex_basic_node_sequence.cpp | 2 +- docs/examples/ex_basic_node_sequence_type.cpp | 2 +- docs/examples/ex_basic_node_serialize.cpp | 2 +- .../ex_basic_node_set_yaml_version.cpp | 2 +- docs/examples/ex_basic_node_size.cpp | 2 +- docs/examples/ex_basic_node_string_type.cpp | 2 +- ...sic_node_subscript_operator_basic_node.cpp | 2 +- ...ode_subscript_operator_compatible_type.cpp | 2 +- docs/examples/ex_basic_node_swap_member.cpp | 2 +- docs/examples/ex_basic_node_swap_std.cpp | 2 +- docs/examples/ex_basic_node_type.cpp | 2 +- .../ex_basic_node_value_converter_type.cpp | 2 +- .../examples/ex_basic_node_yaml_version_t.cpp | 2 +- .../examples/ex_exception_constructor_msg.cpp | 2 +- .../ex_exception_constructor_noarg.cpp | 2 +- docs/examples/ex_exception_what.cpp | 2 +- docs/examples/ex_macros_versions.cpp | 2 +- docs/examples/ex_macros_versions.output | 2 +- .../ex_node_value_converter_from_node.cpp | 2 +- .../ex_node_value_converter_to_node.cpp | 2 +- docs/examples/ex_operator_literal_yaml.cpp | 2 +- docs/examples/ex_ordered_map_at.cpp | 2 +- ...dered_map_constructor_initializer_list.cpp | 2 +- .../ex_ordered_map_constructor_noarg.cpp | 2 +- docs/examples/ex_ordered_map_emplace.cpp | 2 +- docs/examples/ex_ordered_map_find.cpp | 2 +- .../ex_ordered_map_subscript_operator.cpp | 2 +- docs/examples/tutorial_1.cpp | 2 +- docs/examples/tutorial_2.cpp | 2 +- docs/examples/tutorial_3.cpp | 2 +- docs/examples/tutorial_4.cpp | 2 +- docs/mkdocs/docs/home/releases.md | 39 +++++++++- .../docs/tutorials/cmake_integration.md | 2 +- fkYAML.natvis | 24 +++--- include/fkYAML/detail/assert.hpp | 2 +- .../fkYAML/detail/conversions/from_node.hpp | 2 +- .../fkYAML/detail/conversions/from_string.hpp | 2 +- include/fkYAML/detail/conversions/to_node.hpp | 2 +- .../fkYAML/detail/conversions/to_string.hpp | 2 +- include/fkYAML/detail/directive_set.hpp | 2 +- .../detail/encodings/encode_detector.hpp | 2 +- .../fkYAML/detail/encodings/uri_encoding.hpp | 2 +- .../fkYAML/detail/encodings/utf_encode_t.hpp | 2 +- .../fkYAML/detail/encodings/utf_encodings.hpp | 2 +- include/fkYAML/detail/input/deserializer.hpp | 2 +- include/fkYAML/detail/input/input_adapter.hpp | 2 +- .../fkYAML/detail/input/lexical_analyzer.hpp | 2 +- .../fkYAML/detail/input/position_tracker.hpp | 2 +- .../fkYAML/detail/input/scalar_scanner.hpp | 2 +- include/fkYAML/detail/input/tag_resolver.hpp | 2 +- include/fkYAML/detail/input/tag_t.hpp | 2 +- include/fkYAML/detail/iterator.hpp | 2 +- .../detail/macros/cpp_config_macros.hpp | 2 +- .../fkYAML/detail/macros/version_macros.hpp | 6 +- include/fkYAML/detail/meta/detect.hpp | 2 +- .../detail/meta/input_adapter_traits.hpp | 2 +- include/fkYAML/detail/meta/node_traits.hpp | 2 +- include/fkYAML/detail/meta/stl_supplement.hpp | 2 +- include/fkYAML/detail/meta/type_traits.hpp | 2 +- include/fkYAML/detail/node_property.hpp | 2 +- include/fkYAML/detail/node_ref_storage.hpp | 2 +- include/fkYAML/detail/output/serializer.hpp | 2 +- include/fkYAML/detail/string_formatter.hpp | 2 +- .../fkYAML/detail/types/lexical_token_t.hpp | 2 +- include/fkYAML/detail/types/node_t.hpp | 2 +- .../fkYAML/detail/types/yaml_version_t.hpp | 2 +- include/fkYAML/exception.hpp | 2 +- include/fkYAML/node.hpp | 2 +- include/fkYAML/node_value_converter.hpp | 2 +- include/fkYAML/ordered_map.hpp | 2 +- single_include/fkYAML/node.hpp | 76 +++++++++---------- .../project/main.cpp | 2 +- .../project/CMakeLists.txt | 2 +- .../cmake_fetch_content_test/project/main.cpp | 2 +- test/cmake_find_package_test/project/main.cpp | 2 +- .../project/main.cpp | 2 +- test/unit_test/main.cpp | 2 +- test/unit_test/test_custom_from_node.cpp | 2 +- test/unit_test/test_deserializer_class.cpp | 2 +- test/unit_test/test_encode_detector.cpp | 2 +- test/unit_test/test_exception_class.cpp | 2 +- test/unit_test/test_from_string.cpp | 2 +- test/unit_test/test_input_adapter.cpp | 2 +- test/unit_test/test_iterator_class.cpp | 2 +- .../unit_test/test_lexical_analyzer_class.cpp | 2 +- test/unit_test/test_node_class.cpp | 2 +- .../unit_test/test_node_ref_storage_class.cpp | 2 +- test/unit_test/test_ordered_map_class.cpp | 2 +- .../unit_test/test_position_tracker_class.cpp | 2 +- test/unit_test/test_scalar_scanner_class.cpp | 2 +- test/unit_test/test_serializer_class.cpp | 2 +- test/unit_test/test_string_formatter.cpp | 2 +- test/unit_test/test_tag_resolver_class.cpp | 2 +- test/unit_test/test_uri_encoding_class.cpp | 2 +- test/unit_test/test_utf_encodings.cpp | 2 +- tool/natvis_generator/params.json | 2 +- 156 files changed, 255 insertions(+), 205 deletions(-) diff --git a/.reuse/templates/fkYAML.commented.jinja2 b/.reuse/templates/fkYAML.commented.jinja2 index f923c838..d9d2b7ce 100644 --- a/.reuse/templates/fkYAML.commented.jinja2 +++ b/.reuse/templates/fkYAML.commented.jinja2 @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// {% for copyright_line in copyright_lines %} diff --git a/.reuse/templates/fkYAML_support.jinja2 b/.reuse/templates/fkYAML_support.jinja2 index 95b3ef49..2231b73c 100644 --- a/.reuse/templates/fkYAML_support.jinja2 +++ b/.reuse/templates/fkYAML_support.jinja2 @@ -1,6 +1,6 @@ _______ __ __ __ _____ __ __ __ | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -| __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +| __| _ < \_ _/| ___ | _ | |___ version 0.3.6 |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML {% for copyright_line in copyright_lines %} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2835b7a1..f3c02234 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## [v0.3.6](https://github.com/fktn-k/fkYAML/releases/tag/v0.3.6) (2024-05-02) + +[Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.3.5...v0.3.6) + +- Fixed parse error on block sequences with child block mappings split by a newline code [\#333](https://github.com/fktn-k/fkYAML/pull/333) ([fktn-k](https://github.com/fktn-k)) +- Fix parse error on block sequences with child flow style container nodes [\#332](https://github.com/fktn-k/fkYAML/pull/332) ([fktn-k](https://github.com/fktn-k)) +- Fixed parse error on root block sequence with child block sequences [\#330](https://github.com/fktn-k/fkYAML/pull/330) ([fktn-k](https://github.com/fktn-k)) +- Allow backslashes in plain/single-quoted scalars [\#329](https://github.com/fktn-k/fkYAML/pull/329) ([fktn-k](https://github.com/fktn-k)) +- Fixed parser crashes on a sequence right after the directives end marker [\#327](https://github.com/fktn-k/fkYAML/pull/327) ([fktn-k](https://github.com/fktn-k)) + +- Refactor deserialization process [\#331](https://github.com/fktn-k/fkYAML/pull/331) ([fktn-k](https://github.com/fktn-k)) +- Fixed no such file/directory error when running Bash scripts on Windows [\#328](https://github.com/fktn-k/fkYAML/pull/328) ([fktn-k](https://github.com/fktn-k)) + ## [v0.3.5](https://github.com/fktn-k/fkYAML/releases/tag/v0.3.5) (2024-04-27) [Full Changelog](https://github.com/fktn-k/fkYAML/compare/v0.3.4...v0.3.5) diff --git a/CMakeLists.txt b/CMakeLists.txt index e73858b8..d9026f3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.8) project( fkYAML - VERSION 0.3.5 + VERSION 0.3.6 LANGUAGES CXX) ############################################################# diff --git a/Makefile b/Makefile index 5cdda56e..c4f29de2 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ EXAMPLE_SRCS = $(shell find docs/examples -type f -name '*.cpp' | sort) # target version definition TARGET_MAJOR_VERSION := 0 TARGET_MINOR_VERSION := 3 -TARGET_PATCH_VERSION := 5 +TARGET_PATCH_VERSION := 6 TARGET_VERSION_FULL := $(TARGET_MAJOR_VERSION).$(TARGET_MINOR_VERSION).$(TARGET_PATCH_VERSION) VERSION_MACRO_FILE := include/fkYAML/detail/macros/version_macros.hpp diff --git a/docs/examples/ex_basic_node_add_anchor_name.cpp b/docs/examples/ex_basic_node_add_anchor_name.cpp index 9bed815a..9f869513 100644 --- a/docs/examples/ex_basic_node_add_anchor_name.cpp +++ b/docs/examples/ex_basic_node_add_anchor_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_add_tag_name.cpp b/docs/examples/ex_basic_node_add_tag_name.cpp index 9824bf93..05f05b15 100644 --- a/docs/examples/ex_basic_node_add_tag_name.cpp +++ b/docs/examples/ex_basic_node_add_tag_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_alias_of.cpp b/docs/examples/ex_basic_node_alias_of.cpp index 196f685a..19d7b362 100644 --- a/docs/examples/ex_basic_node_alias_of.cpp +++ b/docs/examples/ex_basic_node_alias_of.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_at_basic_node.cpp b/docs/examples/ex_basic_node_at_basic_node.cpp index 2b5b6d34..f0b51d20 100644 --- a/docs/examples/ex_basic_node_at_basic_node.cpp +++ b/docs/examples/ex_basic_node_at_basic_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_at_compatible_type.cpp b/docs/examples/ex_basic_node_at_compatible_type.cpp index bef10397..3d3757dc 100644 --- a/docs/examples/ex_basic_node_at_compatible_type.cpp +++ b/docs/examples/ex_basic_node_at_compatible_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_begin.cpp b/docs/examples/ex_basic_node_begin.cpp index 9554a0c6..3f21d76e 100644 --- a/docs/examples/ex_basic_node_begin.cpp +++ b/docs/examples/ex_basic_node_begin.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_boolean_type.cpp b/docs/examples/ex_basic_node_boolean_type.cpp index dbe9e5f3..8b0d7c0e 100644 --- a/docs/examples/ex_basic_node_boolean_type.cpp +++ b/docs/examples/ex_basic_node_boolean_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_const_iterator.cpp b/docs/examples/ex_basic_node_const_iterator.cpp index e422911c..195023ad 100644 --- a/docs/examples/ex_basic_node_const_iterator.cpp +++ b/docs/examples/ex_basic_node_const_iterator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_1.cpp b/docs/examples/ex_basic_node_constructor_1.cpp index 4b0ed3eb..911a4843 100644 --- a/docs/examples/ex_basic_node_constructor_1.cpp +++ b/docs/examples/ex_basic_node_constructor_1.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_2.cpp b/docs/examples/ex_basic_node_constructor_2.cpp index ac17bac4..1d867479 100644 --- a/docs/examples/ex_basic_node_constructor_2.cpp +++ b/docs/examples/ex_basic_node_constructor_2.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_3.cpp b/docs/examples/ex_basic_node_constructor_3.cpp index 2a26c6fa..096162b5 100644 --- a/docs/examples/ex_basic_node_constructor_3.cpp +++ b/docs/examples/ex_basic_node_constructor_3.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_4.cpp b/docs/examples/ex_basic_node_constructor_4.cpp index 2a26c6fa..096162b5 100644 --- a/docs/examples/ex_basic_node_constructor_4.cpp +++ b/docs/examples/ex_basic_node_constructor_4.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_5.cpp b/docs/examples/ex_basic_node_constructor_5.cpp index 1af45a6b..e2e3ae13 100644 --- a/docs/examples/ex_basic_node_constructor_5.cpp +++ b/docs/examples/ex_basic_node_constructor_5.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_6.cpp b/docs/examples/ex_basic_node_constructor_6.cpp index 14de78a8..7d20efcc 100644 --- a/docs/examples/ex_basic_node_constructor_6.cpp +++ b/docs/examples/ex_basic_node_constructor_6.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_constructor_7.cpp b/docs/examples/ex_basic_node_constructor_7.cpp index 28727304..90524c88 100644 --- a/docs/examples/ex_basic_node_constructor_7.cpp +++ b/docs/examples/ex_basic_node_constructor_7.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_contains.cpp b/docs/examples/ex_basic_node_contains.cpp index dae0eaef..ce6cda9b 100644 --- a/docs/examples/ex_basic_node_contains.cpp +++ b/docs/examples/ex_basic_node_contains.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_copy_assignment_operator.cpp b/docs/examples/ex_basic_node_copy_assignment_operator.cpp index 5707e7a0..8a4f88a3 100644 --- a/docs/examples/ex_basic_node_copy_assignment_operator.cpp +++ b/docs/examples/ex_basic_node_copy_assignment_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_char_array.cpp b/docs/examples/ex_basic_node_deserialize_char_array.cpp index 480ee408..a0c2d4eb 100644 --- a/docs/examples/ex_basic_node_deserialize_char_array.cpp +++ b/docs/examples/ex_basic_node_deserialize_char_array.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_file_pointer.cpp b/docs/examples/ex_basic_node_deserialize_file_pointer.cpp index 93c7f9ab..b9bc1743 100644 --- a/docs/examples/ex_basic_node_deserialize_file_pointer.cpp +++ b/docs/examples/ex_basic_node_deserialize_file_pointer.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_iterators.cpp b/docs/examples/ex_basic_node_deserialize_iterators.cpp index 3b767a7c..fc6b492c 100644 --- a/docs/examples/ex_basic_node_deserialize_iterators.cpp +++ b/docs/examples/ex_basic_node_deserialize_iterators.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_deserialize_string.cpp b/docs/examples/ex_basic_node_deserialize_string.cpp index 6c0c47b7..100dd4d6 100644 --- a/docs/examples/ex_basic_node_deserialize_string.cpp +++ b/docs/examples/ex_basic_node_deserialize_string.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_empty.cpp b/docs/examples/ex_basic_node_empty.cpp index a393d278..e50097f6 100644 --- a/docs/examples/ex_basic_node_empty.cpp +++ b/docs/examples/ex_basic_node_empty.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_end.cpp b/docs/examples/ex_basic_node_end.cpp index 8124ec3c..d5d40f79 100644 --- a/docs/examples/ex_basic_node_end.cpp +++ b/docs/examples/ex_basic_node_end.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_extraction_operator.cpp b/docs/examples/ex_basic_node_extraction_operator.cpp index 1223222c..7f62dd04 100644 --- a/docs/examples/ex_basic_node_extraction_operator.cpp +++ b/docs/examples/ex_basic_node_extraction_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_float_number_type.cpp b/docs/examples/ex_basic_node_float_number_type.cpp index 41e727e3..92a7874d 100644 --- a/docs/examples/ex_basic_node_float_number_type.cpp +++ b/docs/examples/ex_basic_node_float_number_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_anchor_name.cpp b/docs/examples/ex_basic_node_get_anchor_name.cpp index a9f718c2..f26666b7 100644 --- a/docs/examples/ex_basic_node_get_anchor_name.cpp +++ b/docs/examples/ex_basic_node_get_anchor_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_tag_name.cpp b/docs/examples/ex_basic_node_get_tag_name.cpp index 18e82f75..9ebcf2de 100644 --- a/docs/examples/ex_basic_node_get_tag_name.cpp +++ b/docs/examples/ex_basic_node_get_tag_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_value.cpp b/docs/examples/ex_basic_node_get_value.cpp index 194e01a5..61e23828 100644 --- a/docs/examples/ex_basic_node_get_value.cpp +++ b/docs/examples/ex_basic_node_get_value.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_value_ref.cpp b/docs/examples/ex_basic_node_get_value_ref.cpp index 8d31065e..5c20f9ad 100644 --- a/docs/examples/ex_basic_node_get_value_ref.cpp +++ b/docs/examples/ex_basic_node_get_value_ref.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_get_yaml_version.cpp b/docs/examples/ex_basic_node_get_yaml_version.cpp index 6efdf12a..c55be144 100644 --- a/docs/examples/ex_basic_node_get_yaml_version.cpp +++ b/docs/examples/ex_basic_node_get_yaml_version.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_has_anchor_name.cpp b/docs/examples/ex_basic_node_has_anchor_name.cpp index df173213..e4a809bf 100644 --- a/docs/examples/ex_basic_node_has_anchor_name.cpp +++ b/docs/examples/ex_basic_node_has_anchor_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_has_tag_name.cpp b/docs/examples/ex_basic_node_has_tag_name.cpp index 25e54098..aedc035b 100644 --- a/docs/examples/ex_basic_node_has_tag_name.cpp +++ b/docs/examples/ex_basic_node_has_tag_name.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_insertion_operator.cpp b/docs/examples/ex_basic_node_insertion_operator.cpp index 2e48aaec..99680f97 100644 --- a/docs/examples/ex_basic_node_insertion_operator.cpp +++ b/docs/examples/ex_basic_node_insertion_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_integer_type.cpp b/docs/examples/ex_basic_node_integer_type.cpp index 10e2a763..656dea15 100644 --- a/docs/examples/ex_basic_node_integer_type.cpp +++ b/docs/examples/ex_basic_node_integer_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_alias.cpp b/docs/examples/ex_basic_node_is_alias.cpp index 0b76079b..4db9efcd 100644 --- a/docs/examples/ex_basic_node_is_alias.cpp +++ b/docs/examples/ex_basic_node_is_alias.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_anchor.cpp b/docs/examples/ex_basic_node_is_anchor.cpp index 421b0a22..4567ccd4 100644 --- a/docs/examples/ex_basic_node_is_anchor.cpp +++ b/docs/examples/ex_basic_node_is_anchor.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_boolean.cpp b/docs/examples/ex_basic_node_is_boolean.cpp index 010cdf4b..dbac84cf 100644 --- a/docs/examples/ex_basic_node_is_boolean.cpp +++ b/docs/examples/ex_basic_node_is_boolean.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_float_number.cpp b/docs/examples/ex_basic_node_is_float_number.cpp index 86ac5acb..484ade7c 100644 --- a/docs/examples/ex_basic_node_is_float_number.cpp +++ b/docs/examples/ex_basic_node_is_float_number.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_integer.cpp b/docs/examples/ex_basic_node_is_integer.cpp index 1380ad7a..1b43dd9b 100644 --- a/docs/examples/ex_basic_node_is_integer.cpp +++ b/docs/examples/ex_basic_node_is_integer.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_mapping.cpp b/docs/examples/ex_basic_node_is_mapping.cpp index 2838b9c3..4011bad6 100644 --- a/docs/examples/ex_basic_node_is_mapping.cpp +++ b/docs/examples/ex_basic_node_is_mapping.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_null.cpp b/docs/examples/ex_basic_node_is_null.cpp index 7fe459e8..8f203485 100644 --- a/docs/examples/ex_basic_node_is_null.cpp +++ b/docs/examples/ex_basic_node_is_null.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_scalar.cpp b/docs/examples/ex_basic_node_is_scalar.cpp index 1d99f041..dfe77c26 100644 --- a/docs/examples/ex_basic_node_is_scalar.cpp +++ b/docs/examples/ex_basic_node_is_scalar.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_sequence.cpp b/docs/examples/ex_basic_node_is_sequence.cpp index f997cf65..b75c48f8 100644 --- a/docs/examples/ex_basic_node_is_sequence.cpp +++ b/docs/examples/ex_basic_node_is_sequence.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_is_string.cpp b/docs/examples/ex_basic_node_is_string.cpp index ad963c84..87c84c92 100644 --- a/docs/examples/ex_basic_node_is_string.cpp +++ b/docs/examples/ex_basic_node_is_string.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_iterator.cpp b/docs/examples/ex_basic_node_iterator.cpp index 03ebe32f..f63802b0 100644 --- a/docs/examples/ex_basic_node_iterator.cpp +++ b/docs/examples/ex_basic_node_iterator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_mapping.cpp b/docs/examples/ex_basic_node_mapping.cpp index a283b22d..e72952bb 100644 --- a/docs/examples/ex_basic_node_mapping.cpp +++ b/docs/examples/ex_basic_node_mapping.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_mapping_type.cpp b/docs/examples/ex_basic_node_mapping_type.cpp index 2a2e3942..7b6868f9 100644 --- a/docs/examples/ex_basic_node_mapping_type.cpp +++ b/docs/examples/ex_basic_node_mapping_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_node.cpp b/docs/examples/ex_basic_node_node.cpp index 37fecd5a..0891be84 100644 --- a/docs/examples/ex_basic_node_node.cpp +++ b/docs/examples/ex_basic_node_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_node_t.cpp b/docs/examples/ex_basic_node_node_t.cpp index df8a0928..fad3c8d4 100644 --- a/docs/examples/ex_basic_node_node_t.cpp +++ b/docs/examples/ex_basic_node_node_t.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_eq.cpp b/docs/examples/ex_basic_node_operator_eq.cpp index cfd69165..321d3843 100644 --- a/docs/examples/ex_basic_node_operator_eq.cpp +++ b/docs/examples/ex_basic_node_operator_eq.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_ge.cpp b/docs/examples/ex_basic_node_operator_ge.cpp index 2d19a352..6fea0b6f 100644 --- a/docs/examples/ex_basic_node_operator_ge.cpp +++ b/docs/examples/ex_basic_node_operator_ge.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_gt.cpp b/docs/examples/ex_basic_node_operator_gt.cpp index 5cdc07b0..cc956506 100644 --- a/docs/examples/ex_basic_node_operator_gt.cpp +++ b/docs/examples/ex_basic_node_operator_gt.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_le.cpp b/docs/examples/ex_basic_node_operator_le.cpp index 29d8d5c7..f33e9b34 100644 --- a/docs/examples/ex_basic_node_operator_le.cpp +++ b/docs/examples/ex_basic_node_operator_le.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_lt.cpp b/docs/examples/ex_basic_node_operator_lt.cpp index f71452b4..7793f572 100644 --- a/docs/examples/ex_basic_node_operator_lt.cpp +++ b/docs/examples/ex_basic_node_operator_lt.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_operator_ne.cpp b/docs/examples/ex_basic_node_operator_ne.cpp index 39815eac..b533d960 100644 --- a/docs/examples/ex_basic_node_operator_ne.cpp +++ b/docs/examples/ex_basic_node_operator_ne.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_sequence.cpp b/docs/examples/ex_basic_node_sequence.cpp index a04f95d0..c68de4fa 100644 --- a/docs/examples/ex_basic_node_sequence.cpp +++ b/docs/examples/ex_basic_node_sequence.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_sequence_type.cpp b/docs/examples/ex_basic_node_sequence_type.cpp index 3c544954..380ab949 100644 --- a/docs/examples/ex_basic_node_sequence_type.cpp +++ b/docs/examples/ex_basic_node_sequence_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_serialize.cpp b/docs/examples/ex_basic_node_serialize.cpp index 8edee6eb..e720234a 100644 --- a/docs/examples/ex_basic_node_serialize.cpp +++ b/docs/examples/ex_basic_node_serialize.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_set_yaml_version.cpp b/docs/examples/ex_basic_node_set_yaml_version.cpp index eb192144..98929195 100644 --- a/docs/examples/ex_basic_node_set_yaml_version.cpp +++ b/docs/examples/ex_basic_node_set_yaml_version.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_size.cpp b/docs/examples/ex_basic_node_size.cpp index 63f6b5ec..a4e0a577 100644 --- a/docs/examples/ex_basic_node_size.cpp +++ b/docs/examples/ex_basic_node_size.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_string_type.cpp b/docs/examples/ex_basic_node_string_type.cpp index 942ff49d..60eb8825 100644 --- a/docs/examples/ex_basic_node_string_type.cpp +++ b/docs/examples/ex_basic_node_string_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp b/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp index a2b054ff..63861002 100644 --- a/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp +++ b/docs/examples/ex_basic_node_subscript_operator_basic_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp b/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp index a8deff69..71d4ce24 100644 --- a/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp +++ b/docs/examples/ex_basic_node_subscript_operator_compatible_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_swap_member.cpp b/docs/examples/ex_basic_node_swap_member.cpp index 873dee73..431917c8 100644 --- a/docs/examples/ex_basic_node_swap_member.cpp +++ b/docs/examples/ex_basic_node_swap_member.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_swap_std.cpp b/docs/examples/ex_basic_node_swap_std.cpp index 36df1464..f02c8fe2 100644 --- a/docs/examples/ex_basic_node_swap_std.cpp +++ b/docs/examples/ex_basic_node_swap_std.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_type.cpp b/docs/examples/ex_basic_node_type.cpp index df8a0928..fad3c8d4 100644 --- a/docs/examples/ex_basic_node_type.cpp +++ b/docs/examples/ex_basic_node_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_value_converter_type.cpp b/docs/examples/ex_basic_node_value_converter_type.cpp index 9c679fd1..07b4fbda 100644 --- a/docs/examples/ex_basic_node_value_converter_type.cpp +++ b/docs/examples/ex_basic_node_value_converter_type.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_basic_node_yaml_version_t.cpp b/docs/examples/ex_basic_node_yaml_version_t.cpp index 003c045b..c1adaf1e 100644 --- a/docs/examples/ex_basic_node_yaml_version_t.cpp +++ b/docs/examples/ex_basic_node_yaml_version_t.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_exception_constructor_msg.cpp b/docs/examples/ex_exception_constructor_msg.cpp index fabbeb81..ac528940 100644 --- a/docs/examples/ex_exception_constructor_msg.cpp +++ b/docs/examples/ex_exception_constructor_msg.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_exception_constructor_noarg.cpp b/docs/examples/ex_exception_constructor_noarg.cpp index db4beb19..4c0783cf 100644 --- a/docs/examples/ex_exception_constructor_noarg.cpp +++ b/docs/examples/ex_exception_constructor_noarg.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_exception_what.cpp b/docs/examples/ex_exception_what.cpp index 8a84d9a1..b9f98c11 100644 --- a/docs/examples/ex_exception_what.cpp +++ b/docs/examples/ex_exception_what.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_macros_versions.cpp b/docs/examples/ex_macros_versions.cpp index 8bf046a0..812740ec 100644 --- a/docs/examples/ex_macros_versions.cpp +++ b/docs/examples/ex_macros_versions.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_macros_versions.output b/docs/examples/ex_macros_versions.output index a087352f..e7a1b090 100644 --- a/docs/examples/ex_macros_versions.output +++ b/docs/examples/ex_macros_versions.output @@ -1 +1 @@ -fkYAML version 0.3.5 +fkYAML version 0.3.6 diff --git a/docs/examples/ex_node_value_converter_from_node.cpp b/docs/examples/ex_node_value_converter_from_node.cpp index 93258662..94f40269 100644 --- a/docs/examples/ex_node_value_converter_from_node.cpp +++ b/docs/examples/ex_node_value_converter_from_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_node_value_converter_to_node.cpp b/docs/examples/ex_node_value_converter_to_node.cpp index f1d83c3d..8f5452eb 100644 --- a/docs/examples/ex_node_value_converter_to_node.cpp +++ b/docs/examples/ex_node_value_converter_to_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_operator_literal_yaml.cpp b/docs/examples/ex_operator_literal_yaml.cpp index d9b6010e..00e26769 100644 --- a/docs/examples/ex_operator_literal_yaml.cpp +++ b/docs/examples/ex_operator_literal_yaml.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_at.cpp b/docs/examples/ex_ordered_map_at.cpp index 9ac83ee2..eb215b5b 100644 --- a/docs/examples/ex_ordered_map_at.cpp +++ b/docs/examples/ex_ordered_map_at.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_constructor_initializer_list.cpp b/docs/examples/ex_ordered_map_constructor_initializer_list.cpp index 56501e90..6e631c40 100644 --- a/docs/examples/ex_ordered_map_constructor_initializer_list.cpp +++ b/docs/examples/ex_ordered_map_constructor_initializer_list.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_constructor_noarg.cpp b/docs/examples/ex_ordered_map_constructor_noarg.cpp index ddad0873..629788cf 100644 --- a/docs/examples/ex_ordered_map_constructor_noarg.cpp +++ b/docs/examples/ex_ordered_map_constructor_noarg.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_emplace.cpp b/docs/examples/ex_ordered_map_emplace.cpp index 345c02df..c7f5fc05 100644 --- a/docs/examples/ex_ordered_map_emplace.cpp +++ b/docs/examples/ex_ordered_map_emplace.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_find.cpp b/docs/examples/ex_ordered_map_find.cpp index 91ac317e..2cfe10f3 100644 --- a/docs/examples/ex_ordered_map_find.cpp +++ b/docs/examples/ex_ordered_map_find.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/ex_ordered_map_subscript_operator.cpp b/docs/examples/ex_ordered_map_subscript_operator.cpp index 8603b4f9..e32f95f4 100644 --- a/docs/examples/ex_ordered_map_subscript_operator.cpp +++ b/docs/examples/ex_ordered_map_subscript_operator.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_1.cpp b/docs/examples/tutorial_1.cpp index e98c0742..32073652 100644 --- a/docs/examples/tutorial_1.cpp +++ b/docs/examples/tutorial_1.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_2.cpp b/docs/examples/tutorial_2.cpp index 525f37b1..5eb15a43 100644 --- a/docs/examples/tutorial_2.cpp +++ b/docs/examples/tutorial_2.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_3.cpp b/docs/examples/tutorial_3.cpp index c40f0f20..3000f14f 100644 --- a/docs/examples/tutorial_3.cpp +++ b/docs/examples/tutorial_3.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/examples/tutorial_4.cpp b/docs/examples/tutorial_4.cpp index 1d3923d2..c852d0b3 100644 --- a/docs/examples/tutorial_4.cpp +++ b/docs/examples/tutorial_4.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/docs/mkdocs/docs/home/releases.md b/docs/mkdocs/docs/home/releases.md index 8d431cc3..fc876a6c 100644 --- a/docs/mkdocs/docs/home/releases.md +++ b/docs/mkdocs/docs/home/releases.md @@ -1,5 +1,42 @@ # Releases +## **fkYAML version 0.3.6** + +!!! abstract "Release Packages" + + * [fkYAML.zip](https://github.com/fktn-k/fkYAML/releases/download/v0.3.6/fkYAML.zip) + * [fkYAML.tgz](https://github.com/fktn-k/fkYAML/releases/download/v0.3.6/fkYAML.tgz) + * [fkYAML_single_header.zip](https://github.com/fktn-k/fkYAML/releases/download/v0.3.6/fkYAML_single_header.zip) + * [fkYAML_single_header.tgz](https://github.com/fktn-k/fkYAML/releases/download/v0.3.6/fkYAML_single_header.tgz) + * [node.hpp](https://github.com/fktn-k/fkYAML/releases/download/v0.3.6/node.hpp) (single header) + +### Summary + +This release includes enhancements to the deserializer, improving both performance and readability. +Furthermore, it resolves several issues identified in the deserializer and improves conformance to the YAML specification. + +### What's Changed + +#### :zap: Improvements + +- Refactor deserialization process by [@fktn-k](https://github.com/fktn-k) in [\#331](https://github.com/fktn-k/fkYAML/pull/331) + +#### :bug: Bug Fixes + +- Fixed parser crashes on a sequence right after the directives end marker by [@fktn-k](https://github.com/fktn-k) in [\#327](https://github.com/fktn-k/fkYAML/pull/327) +- Allow backslashes in plain/single-quoted scalars by [@fktn-k](https://github.com/fktn-k) in [\#329](https://github.com/fktn-k/fkYAML/pull/329) +- Fixed parse error on root block sequence with child block sequences by [@fktn-k](https://github.com/fktn-k) in [\#330](https://github.com/fktn-k/fkYAML/pull/330) +- Fix parse error on block sequences with child flow style container nodes by [@fktn-k](https://github.com/fktn-k) in [\#332](https://github.com/fktn-k/fkYAML/pull/332) +- Fixed parse error on block sequences with child block mappings split by a newline code by [@fktn-k](https://github.com/fktn-k) in [\#333](https://github.com/fktn-k/fkYAML/pull/333) + +#### :people_holding_hands: Community + +- Fixed no such file/directory error when running Bash scripts on Windows by [@fktn-k](https://github.com/fktn-k) in [\#328](https://github.com/fktn-k/fkYAML/pull/328) + +**Full Changelog**: https://github.com/fktn-k/fkYAML/compare/v0.3.5...v0.3.6 + +--- + ## **fkYAML version 0.3.5** !!! abstract "Release Packages" @@ -48,7 +85,7 @@ For more information, see the latest CONTRIBUTING.md file. -**Full Changelog**: https://github.com/fktn-k/fkYAML/compare/v0.3.3...v0.3.5 +**Full Changelog**: https://github.com/fktn-k/fkYAML/compare/v0.3.4...v0.3.5 --- diff --git a/docs/mkdocs/docs/tutorials/cmake_integration.md b/docs/mkdocs/docs/tutorials/cmake_integration.md index 79a9fda4..cb41f037 100644 --- a/docs/mkdocs/docs/tutorials/cmake_integration.md +++ b/docs/mkdocs/docs/tutorials/cmake_integration.md @@ -57,7 +57,7 @@ Since CMake v3.11, [`FetchContent`](https://cmake.org/cmake/help/latest/module/F FetchContent_Declare( fkYAML GIT_REPOSITORY https://github.com/fktn-k/fkYAML.git - GIT_TAG v0.3.5 + GIT_TAG v0.3.6 ) FetchContent_MakeAvailable(fkYAML) diff --git a/fkYAML.natvis b/fkYAML.natvis index ba25d9dc..e711f0bf 100644 --- a/fkYAML.natvis +++ b/fkYAML.natvis @@ -4,26 +4,26 @@ - - - {*(m_node_value.p_sequence)} - {*(m_node_value.p_mapping)} - nullptr - {m_node_value.boolean} - {m_node_value.integer} - {m_node_value.float_val} - {*(m_node_value.p_string)} + + + {*(m_node_value.p_sequence)} + {*(m_node_value.p_mapping)} + nullptr + {m_node_value.boolean} + {m_node_value.integer} + {m_node_value.float_val} + {*(m_node_value.p_string)} - + *(m_node_value.p_sequence),view(simple) - + *(m_node_value.p_mapping),view(simple) - + {second} second diff --git a/include/fkYAML/detail/assert.hpp b/include/fkYAML/detail/assert.hpp index 87b344fb..646af2e0 100644 --- a/include/fkYAML/detail/assert.hpp +++ b/include/fkYAML/detail/assert.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/from_node.hpp b/include/fkYAML/detail/conversions/from_node.hpp index 4bdaea49..027e1f2f 100644 --- a/include/fkYAML/detail/conversions/from_node.hpp +++ b/include/fkYAML/detail/conversions/from_node.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/from_string.hpp b/include/fkYAML/detail/conversions/from_string.hpp index 93465b00..1777240f 100644 --- a/include/fkYAML/detail/conversions/from_string.hpp +++ b/include/fkYAML/detail/conversions/from_string.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/to_node.hpp b/include/fkYAML/detail/conversions/to_node.hpp index c299d4a0..6c698b31 100644 --- a/include/fkYAML/detail/conversions/to_node.hpp +++ b/include/fkYAML/detail/conversions/to_node.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/conversions/to_string.hpp b/include/fkYAML/detail/conversions/to_string.hpp index 7e70e3bc..a5be2f08 100644 --- a/include/fkYAML/detail/conversions/to_string.hpp +++ b/include/fkYAML/detail/conversions/to_string.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/directive_set.hpp b/include/fkYAML/detail/directive_set.hpp index ba695633..90756628 100644 --- a/include/fkYAML/detail/directive_set.hpp +++ b/include/fkYAML/detail/directive_set.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/encode_detector.hpp b/include/fkYAML/detail/encodings/encode_detector.hpp index bd936311..0e9895f9 100644 --- a/include/fkYAML/detail/encodings/encode_detector.hpp +++ b/include/fkYAML/detail/encodings/encode_detector.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/uri_encoding.hpp b/include/fkYAML/detail/encodings/uri_encoding.hpp index e3ce4440..173deced 100644 --- a/include/fkYAML/detail/encodings/uri_encoding.hpp +++ b/include/fkYAML/detail/encodings/uri_encoding.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/utf_encode_t.hpp b/include/fkYAML/detail/encodings/utf_encode_t.hpp index 558c2573..4390c0bb 100644 --- a/include/fkYAML/detail/encodings/utf_encode_t.hpp +++ b/include/fkYAML/detail/encodings/utf_encode_t.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/encodings/utf_encodings.hpp b/include/fkYAML/detail/encodings/utf_encodings.hpp index 922198af..e9772fcf 100644 --- a/include/fkYAML/detail/encodings/utf_encodings.hpp +++ b/include/fkYAML/detail/encodings/utf_encodings.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/deserializer.hpp b/include/fkYAML/detail/input/deserializer.hpp index 601696c5..b796872c 100644 --- a/include/fkYAML/detail/input/deserializer.hpp +++ b/include/fkYAML/detail/input/deserializer.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/input_adapter.hpp b/include/fkYAML/detail/input/input_adapter.hpp index 9cf380ca..e47e6421 100644 --- a/include/fkYAML/detail/input/input_adapter.hpp +++ b/include/fkYAML/detail/input/input_adapter.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/lexical_analyzer.hpp b/include/fkYAML/detail/input/lexical_analyzer.hpp index 9e60b5fc..7f35909f 100644 --- a/include/fkYAML/detail/input/lexical_analyzer.hpp +++ b/include/fkYAML/detail/input/lexical_analyzer.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/position_tracker.hpp b/include/fkYAML/detail/input/position_tracker.hpp index a5b69454..3512700e 100644 --- a/include/fkYAML/detail/input/position_tracker.hpp +++ b/include/fkYAML/detail/input/position_tracker.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/scalar_scanner.hpp b/include/fkYAML/detail/input/scalar_scanner.hpp index aa48db9e..b933f460 100644 --- a/include/fkYAML/detail/input/scalar_scanner.hpp +++ b/include/fkYAML/detail/input/scalar_scanner.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/tag_resolver.hpp b/include/fkYAML/detail/input/tag_resolver.hpp index 8a1d00b7..f31faf25 100644 --- a/include/fkYAML/detail/input/tag_resolver.hpp +++ b/include/fkYAML/detail/input/tag_resolver.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/input/tag_t.hpp b/include/fkYAML/detail/input/tag_t.hpp index ef43f298..47b3b58c 100644 --- a/include/fkYAML/detail/input/tag_t.hpp +++ b/include/fkYAML/detail/input/tag_t.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/iterator.hpp b/include/fkYAML/detail/iterator.hpp index 7764a62c..6ac7fed4 100644 --- a/include/fkYAML/detail/iterator.hpp +++ b/include/fkYAML/detail/iterator.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/macros/cpp_config_macros.hpp b/include/fkYAML/detail/macros/cpp_config_macros.hpp index fd31ae0b..85a39826 100644 --- a/include/fkYAML/detail/macros/cpp_config_macros.hpp +++ b/include/fkYAML/detail/macros/cpp_config_macros.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/macros/version_macros.hpp b/include/fkYAML/detail/macros/version_macros.hpp index 046ce438..df70df1a 100644 --- a/include/fkYAML/detail/macros/version_macros.hpp +++ b/include/fkYAML/detail/macros/version_macros.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -10,7 +10,7 @@ // Check version definitions if already defined. #if defined(FK_YAML_MAJOR_VERSION) && defined(FK_YAML_MINOR_VERSION) && defined(FK_YAML_PATCH_VERSION) -#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 3 || FK_YAML_PATCH_VERSION != 5 +#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 3 || FK_YAML_PATCH_VERSION != 6 #warning Already included a different version of the fkYAML library! #else // define macros to skip defining macros down below. @@ -22,7 +22,7 @@ #define FK_YAML_MAJOR_VERSION 0 #define FK_YAML_MINOR_VERSION 3 -#define FK_YAML_PATCH_VERSION 5 +#define FK_YAML_PATCH_VERSION 6 #define FK_YAML_NAMESPACE_VERSION_CONCAT_IMPL(major, minor, patch) v##major##_##minor##_##patch diff --git a/include/fkYAML/detail/meta/detect.hpp b/include/fkYAML/detail/meta/detect.hpp index c9af4525..13dde5e5 100644 --- a/include/fkYAML/detail/meta/detect.hpp +++ b/include/fkYAML/detail/meta/detect.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/input_adapter_traits.hpp b/include/fkYAML/detail/meta/input_adapter_traits.hpp index a01e0046..a0141f79 100644 --- a/include/fkYAML/detail/meta/input_adapter_traits.hpp +++ b/include/fkYAML/detail/meta/input_adapter_traits.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/node_traits.hpp b/include/fkYAML/detail/meta/node_traits.hpp index 5aba7e74..7e72097a 100644 --- a/include/fkYAML/detail/meta/node_traits.hpp +++ b/include/fkYAML/detail/meta/node_traits.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/stl_supplement.hpp b/include/fkYAML/detail/meta/stl_supplement.hpp index 8d064d33..ce99cc6a 100644 --- a/include/fkYAML/detail/meta/stl_supplement.hpp +++ b/include/fkYAML/detail/meta/stl_supplement.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/meta/type_traits.hpp b/include/fkYAML/detail/meta/type_traits.hpp index 4c8d788f..8b69e172 100644 --- a/include/fkYAML/detail/meta/type_traits.hpp +++ b/include/fkYAML/detail/meta/type_traits.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/node_property.hpp b/include/fkYAML/detail/node_property.hpp index ddbf9029..c3b21b6c 100644 --- a/include/fkYAML/detail/node_property.hpp +++ b/include/fkYAML/detail/node_property.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/node_ref_storage.hpp b/include/fkYAML/detail/node_ref_storage.hpp index 9e0892a2..3505a521 100644 --- a/include/fkYAML/detail/node_ref_storage.hpp +++ b/include/fkYAML/detail/node_ref_storage.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/output/serializer.hpp b/include/fkYAML/detail/output/serializer.hpp index 055d3100..c14969f2 100644 --- a/include/fkYAML/detail/output/serializer.hpp +++ b/include/fkYAML/detail/output/serializer.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/string_formatter.hpp b/include/fkYAML/detail/string_formatter.hpp index 101dd5be..ef943a0a 100644 --- a/include/fkYAML/detail/string_formatter.hpp +++ b/include/fkYAML/detail/string_formatter.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/lexical_token_t.hpp b/include/fkYAML/detail/types/lexical_token_t.hpp index 6d470332..73a505e3 100644 --- a/include/fkYAML/detail/types/lexical_token_t.hpp +++ b/include/fkYAML/detail/types/lexical_token_t.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/node_t.hpp b/include/fkYAML/detail/types/node_t.hpp index 4cb5f801..1efdf509 100644 --- a/include/fkYAML/detail/types/node_t.hpp +++ b/include/fkYAML/detail/types/node_t.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/detail/types/yaml_version_t.hpp b/include/fkYAML/detail/types/yaml_version_t.hpp index 211b3fcb..b561ab38 100644 --- a/include/fkYAML/detail/types/yaml_version_t.hpp +++ b/include/fkYAML/detail/types/yaml_version_t.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/exception.hpp b/include/fkYAML/exception.hpp index 1b9bb0de..efe83925 100644 --- a/include/fkYAML/exception.hpp +++ b/include/fkYAML/exception.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/node.hpp b/include/fkYAML/node.hpp index d13ea610..1530c144 100644 --- a/include/fkYAML/node.hpp +++ b/include/fkYAML/node.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/node_value_converter.hpp b/include/fkYAML/node_value_converter.hpp index abe03403..8b54a908 100644 --- a/include/fkYAML/node_value_converter.hpp +++ b/include/fkYAML/node_value_converter.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/include/fkYAML/ordered_map.hpp b/include/fkYAML/ordered_map.hpp index aa8580d1..553d375e 100644 --- a/include/fkYAML/ordered_map.hpp +++ b/include/fkYAML/ordered_map.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/single_include/fkYAML/node.hpp b/single_include/fkYAML/node.hpp index 15508fe9..e7ebfeaa 100644 --- a/single_include/fkYAML/node.hpp +++ b/single_include/fkYAML/node.hpp @@ -1,6 +1,6 @@ /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -24,7 +24,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -34,7 +34,7 @@ // Check version definitions if already defined. #if defined(FK_YAML_MAJOR_VERSION) && defined(FK_YAML_MINOR_VERSION) && defined(FK_YAML_PATCH_VERSION) -#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 3 || FK_YAML_PATCH_VERSION != 5 +#if FK_YAML_MAJOR_VERSION != 0 || FK_YAML_MINOR_VERSION != 3 || FK_YAML_PATCH_VERSION != 6 #warning Already included a different version of the fkYAML library! #else // define macros to skip defining macros down below. @@ -46,7 +46,7 @@ #define FK_YAML_MAJOR_VERSION 0 #define FK_YAML_MINOR_VERSION 3 -#define FK_YAML_PATCH_VERSION 5 +#define FK_YAML_PATCH_VERSION 6 #define FK_YAML_NAMESPACE_VERSION_CONCAT_IMPL(major, minor, patch) v##major##_##minor##_##patch @@ -74,7 +74,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -138,7 +138,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -164,7 +164,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -183,7 +183,7 @@ // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -235,7 +235,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -258,7 +258,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -284,7 +284,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -306,7 +306,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -490,7 +490,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -509,7 +509,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -735,7 +735,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -756,7 +756,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -805,7 +805,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1243,7 +1243,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1373,7 +1373,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1666,7 +1666,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1687,7 +1687,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1943,7 +1943,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -1964,7 +1964,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -2111,7 +2111,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -3689,7 +3689,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -3713,7 +3713,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -4784,7 +4784,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -4809,7 +4809,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -4828,7 +4828,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -5954,7 +5954,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6359,7 +6359,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6396,7 +6396,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6489,7 +6489,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -6509,7 +6509,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7077,7 +7077,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7095,7 +7095,7 @@ FK_YAML_DETAIL_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7385,7 +7385,7 @@ FK_YAML_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani @@ -7773,7 +7773,7 @@ FK_YAML_NAMESPACE_END // #include /// _______ __ __ __ _____ __ __ __ /// | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library -/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +/// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 /// |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML /// /// SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_add_subdirectory_test/project/main.cpp b/test/cmake_add_subdirectory_test/project/main.cpp index d66044a1..e1bc6c86 100644 --- a/test/cmake_add_subdirectory_test/project/main.cpp +++ b/test/cmake_add_subdirectory_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_fetch_content_test/project/CMakeLists.txt b/test/cmake_fetch_content_test/project/CMakeLists.txt index b3098768..139532e8 100644 --- a/test/cmake_fetch_content_test/project/CMakeLists.txt +++ b/test/cmake_fetch_content_test/project/CMakeLists.txt @@ -6,7 +6,7 @@ include(FetchContent) FetchContent_Declare( fkYAML GIT_REPOSITORY https://github.com/fktn-k/fkYAML.git - GIT_TAG v0.3.5) + GIT_TAG v0.3.6) FetchContent_MakeAvailable(fkYAML) add_executable( diff --git a/test/cmake_fetch_content_test/project/main.cpp b/test/cmake_fetch_content_test/project/main.cpp index d66044a1..e1bc6c86 100644 --- a/test/cmake_fetch_content_test/project/main.cpp +++ b/test/cmake_fetch_content_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_find_package_test/project/main.cpp b/test/cmake_find_package_test/project/main.cpp index d66044a1..e1bc6c86 100644 --- a/test/cmake_find_package_test/project/main.cpp +++ b/test/cmake_find_package_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/cmake_target_include_directories_test/project/main.cpp b/test/cmake_target_include_directories_test/project/main.cpp index d66044a1..e1bc6c86 100644 --- a/test/cmake_target_include_directories_test/project/main.cpp +++ b/test/cmake_target_include_directories_test/project/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/main.cpp b/test/unit_test/main.cpp index 7f5a8b71..c6294cdb 100644 --- a/test/unit_test/main.cpp +++ b/test/unit_test/main.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_custom_from_node.cpp b/test/unit_test/test_custom_from_node.cpp index a9a09b7b..97a65adf 100644 --- a/test/unit_test/test_custom_from_node.cpp +++ b/test/unit_test/test_custom_from_node.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_deserializer_class.cpp b/test/unit_test/test_deserializer_class.cpp index 23507877..04c69c98 100644 --- a/test/unit_test/test_deserializer_class.cpp +++ b/test/unit_test/test_deserializer_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_encode_detector.cpp b/test/unit_test/test_encode_detector.cpp index 09303e0b..6842c7af 100644 --- a/test/unit_test/test_encode_detector.cpp +++ b/test/unit_test/test_encode_detector.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_exception_class.cpp b/test/unit_test/test_exception_class.cpp index 4e418793..2f1a8a3f 100644 --- a/test/unit_test/test_exception_class.cpp +++ b/test/unit_test/test_exception_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_from_string.cpp b/test/unit_test/test_from_string.cpp index 0e63102a..176fc20a 100644 --- a/test/unit_test/test_from_string.cpp +++ b/test/unit_test/test_from_string.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_input_adapter.cpp b/test/unit_test/test_input_adapter.cpp index 392f76d0..a4655a3a 100644 --- a/test/unit_test/test_input_adapter.cpp +++ b/test/unit_test/test_input_adapter.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_iterator_class.cpp b/test/unit_test/test_iterator_class.cpp index e183a9f7..0c2538ba 100644 --- a/test/unit_test/test_iterator_class.cpp +++ b/test/unit_test/test_iterator_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_lexical_analyzer_class.cpp b/test/unit_test/test_lexical_analyzer_class.cpp index 041ea947..693233d4 100644 --- a/test/unit_test/test_lexical_analyzer_class.cpp +++ b/test/unit_test/test_lexical_analyzer_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_node_class.cpp b/test/unit_test/test_node_class.cpp index 23d26faf..51fabf96 100644 --- a/test/unit_test/test_node_class.cpp +++ b/test/unit_test/test_node_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_node_ref_storage_class.cpp b/test/unit_test/test_node_ref_storage_class.cpp index d2897ce6..affcef29 100644 --- a/test/unit_test/test_node_ref_storage_class.cpp +++ b/test/unit_test/test_node_ref_storage_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_ordered_map_class.cpp b/test/unit_test/test_ordered_map_class.cpp index 00184a3b..9f19c50b 100644 --- a/test/unit_test/test_ordered_map_class.cpp +++ b/test/unit_test/test_ordered_map_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_position_tracker_class.cpp b/test/unit_test/test_position_tracker_class.cpp index f9243405..3724d4f5 100644 --- a/test/unit_test/test_position_tracker_class.cpp +++ b/test/unit_test/test_position_tracker_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_scalar_scanner_class.cpp b/test/unit_test/test_scalar_scanner_class.cpp index 9968f8b2..fa6cef44 100644 --- a/test/unit_test/test_scalar_scanner_class.cpp +++ b/test/unit_test/test_scalar_scanner_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_serializer_class.cpp b/test/unit_test/test_serializer_class.cpp index c05905b0..1c3e0107 100644 --- a/test/unit_test/test_serializer_class.cpp +++ b/test/unit_test/test_serializer_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_string_formatter.cpp b/test/unit_test/test_string_formatter.cpp index b0d94e5d..a535626a 100644 --- a/test/unit_test/test_string_formatter.cpp +++ b/test/unit_test/test_string_formatter.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_tag_resolver_class.cpp b/test/unit_test/test_tag_resolver_class.cpp index bb787dbc..cea9763d 100644 --- a/test/unit_test/test_tag_resolver_class.cpp +++ b/test/unit_test/test_tag_resolver_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_uri_encoding_class.cpp b/test/unit_test/test_uri_encoding_class.cpp index 1513cffd..bfd62a41 100644 --- a/test/unit_test/test_uri_encoding_class.cpp +++ b/test/unit_test/test_uri_encoding_class.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/test/unit_test/test_utf_encodings.cpp b/test/unit_test/test_utf_encodings.cpp index e2ef0cd3..2f01fc09 100644 --- a/test/unit_test/test_utf_encodings.cpp +++ b/test/unit_test/test_utf_encodings.cpp @@ -1,6 +1,6 @@ // _______ __ __ __ _____ __ __ __ // | __| |_/ | \_/ |/ _ \ / \/ \| | fkYAML: A C++ header-only YAML library (supporting code) -// | __| _ < \_ _/| ___ | _ | |___ version 0.3.5 +// | __| _ < \_ _/| ___ | _ | |___ version 0.3.6 // |__| |_| \__| |_| |_| |_|___||___|______| https://github.com/fktn-k/fkYAML // // SPDX-FileCopyrightText: 2023-2024 Kensuke Fukutani diff --git a/tool/natvis_generator/params.json b/tool/natvis_generator/params.json index e2a9c041..1baac0dc 100644 --- a/tool/natvis_generator/params.json +++ b/tool/natvis_generator/params.json @@ -1 +1 @@ -{ "version": "0.3.5" } +{ "version": "0.3.6" }