From 779b5c6b3a038d53261b01b5ee04a14fcf55e686 Mon Sep 17 00:00:00 2001 From: Joao Paulo Magalhaes Date: Thu, 11 Jan 2024 18:46:05 +0000 Subject: [PATCH] wip ci fixes --- ext/c4core | 2 +- src/c4/yml/parse.cpp | 10 +--------- test/test_filter.cpp | 11 +++++++++++ test/test_number.cpp | 5 +++++ tools/amalgamate.py | 28 +++++++++++++--------------- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/ext/c4core b/ext/c4core index 0a21dfc8c..cb4d74334 160000 --- a/ext/c4core +++ b/ext/c4core @@ -1 +1 @@ -Subproject commit 0a21dfc8cdc7521e9576f117529adbb59c466f74 +Subproject commit cb4d74334c4609d08064fcce0a1ff06ff088cf4e diff --git a/src/c4/yml/parse.cpp b/src/c4/yml/parse.cpp index 4a7484138..65e3bd706 100644 --- a/src/c4/yml/parse.cpp +++ b/src/c4/yml/parse.cpp @@ -5084,7 +5084,7 @@ FilterResult Parser::filter_scalar_dquoted_in_place(substr dst, size_t cap) //----------------------------------------------------------------------------- // block filtering helpers -inline size_t _find_last_newline_and_larger_indentation(csubstr s, size_t indentation) noexcept +size_t _find_last_newline_and_larger_indentation(csubstr s, size_t indentation) noexcept { if(indentation + 1 > s.len) return npos; @@ -5099,12 +5099,6 @@ inline size_t _find_last_newline_and_larger_indentation(csubstr s, size_t indent return i; } } - //_RYML_CB_ASSERT(this->callbacks(), _find_last_newline_and_larger_indentation("ab\n\n\n", 0) == npos); - //_RYML_CB_ASSERT(this->callbacks(), _find_last_newline_and_larger_indentation("ab\n \n\n", 0) == 2); - //_RYML_CB_ASSERT(this->callbacks(), _find_last_newline_and_larger_indentation("ab\n\n \n", 0) == 3); - //_RYML_CB_ASSERT(this->callbacks(), _find_last_newline_and_larger_indentation("ab\n \n \n", 0) == 4); - //_RYML_CB_ASSERT(this->callbacks(), _find_last_newline_and_larger_indentation("ab\n \n \n", 1) == 4); - //_RYML_CB_ASSERT(this->callbacks(), _find_last_newline_and_larger_indentation("ab\n \n \n", 1) == 2); return npos; } @@ -5516,7 +5510,6 @@ void Parser::_filter_block_folded_newlines(FilterProcessor &C4_RESTRICT proc, si case '\t': { size_t first = proc.rem().first_not_of(" \t"); - //size_t first = proc.rem().first_not_of(' '); _c4dbgfbf("space. first={}", first); if(first == npos) first = proc.rem().len; @@ -5549,7 +5542,6 @@ void Parser::_filter_block_folded_newlines(FilterProcessor &C4_RESTRICT proc, si template void Parser::_filter_block_folded_indented_block(FilterProcessor &C4_RESTRICT proc, size_t indentation, size_t len, size_t curr_indentation) noexcept { - //_RYML_CB_ASSERT(this->callbacks(), proc.rem().first_not_of(' ') == curr_indentation); _RYML_CB_ASSERT(this->callbacks(), (proc.rem().first_not_of(" \t") == curr_indentation) || (proc.rem().first_not_of(" \t") == npos)); proc.copy(curr_indentation); while(proc.has_more_chars(len)) diff --git a/test/test_filter.cpp b/test/test_filter.cpp index 2d45edcd6..7d2b945e8 100644 --- a/test/test_filter.cpp +++ b/test/test_filter.cpp @@ -914,6 +914,17 @@ TEST(FilterProcessorSrcDst, translate_esc_bulk_excess) EXPECT_EQ(t.dst, "aaabbbcccddd^^"); } +TEST(Filter, _find_last_newline_and_larger_indentation) +{ + size_t _find_last_newline_and_larger_indentation(csubstr s, size_t indentation) noexcept; + EXPECT_EQ(_find_last_newline_and_larger_indentation("ab\n\n\n", 0), npos); + EXPECT_EQ(_find_last_newline_and_larger_indentation("ab\n \n\n", 0), 2u); + EXPECT_EQ(_find_last_newline_and_larger_indentation("ab\n\n \n", 0), 3u); + EXPECT_EQ(_find_last_newline_and_larger_indentation("ab\n \n \n", 0), 4u); + EXPECT_EQ(_find_last_newline_and_larger_indentation("ab\n \n \n", 1), 4u); + EXPECT_EQ(_find_last_newline_and_larger_indentation("ab\n \n \n", 1), 2u); +} + } // namespace yml } // namespace c4 diff --git a/test/test_number.cpp b/test/test_number.cpp index 44676404b..a9344becf 100644 --- a/test/test_number.cpp +++ b/test/test_number.cpp @@ -1,4 +1,9 @@ #include "./test_group.hpp" +#ifdef RYML_SINGLE_HEADER +#include +#else +#include +#endif namespace c4 { namespace yml { diff --git a/tools/amalgamate.py b/tools/amalgamate.py index ccc272e17..d17e2208f 100644 --- a/tools/amalgamate.py +++ b/tools/amalgamate.py @@ -38,7 +38,19 @@ #include """ -ryml_preamble = f""" + +def amalgamate_ryml(filename: str, + with_c4core: bool, + with_fastfloat: bool, + with_stl: bool): + c4core_amalgamated = "" + if with_c4core: + c4core_amalgamated = "src/c4/c4core_all.hpp" + am_c4core.amalgamate_c4core(f"{projdir}/{c4core_amalgamated}", + with_fastfloat=with_fastfloat, + with_stl=with_stl) + repo = "https://github.com/biojppm/rapidyaml" + ryml_preamble = f""" Rapid YAML - a library to parse and emit YAML, and do it fast. {repo} @@ -56,19 +68,6 @@ preprocessor symbol RYML_SHARED . This will take care of symbol export/import. """ - - -def amalgamate_ryml(filename: str, - with_c4core: bool, - with_fastfloat: bool, - with_stl: bool): - c4core_amalgamated = "" - if with_c4core: - c4core_amalgamated = "src/c4/c4core_all.hpp" - am_c4core.amalgamate_c4core(f"{projdir}/{c4core_amalgamated}", - with_fastfloat=with_fastfloat, - with_stl=with_stl) - repo = "https://github.com/biojppm/rapidyaml" srcfiles = [ am.cmttext(ryml_preamble), am.cmtfile("LICENSE.txt"), @@ -94,7 +93,6 @@ def amalgamate_ryml(filename: str, am.onlyif(with_stl, "src/c4/yml/std/std.hpp"), "src/c4/yml/common.cpp", "src/c4/yml/tree.cpp", - "src/c4/yml/filter.def.hpp", "src/c4/yml/parse.cpp", "src/c4/yml/node.cpp", "src/c4/yml/preprocess.hpp",