Skip to content

Commit

Permalink
wip ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed Jan 11, 2024
1 parent 7968280 commit 9de8779
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion ext/c4core
Submodule c4core updated 1 files
+4 −0 src/c4/charconv.hpp
11 changes: 1 addition & 10 deletions src/c4/yml/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
RYML_EXPORT size_t _find_last_newline_and_larger_indentation(csubstr s, size_t indentation) noexcept
{
if(indentation + 1 > s.len)
return npos;
Expand All @@ -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;
}

Expand Down Expand Up @@ -5459,7 +5453,6 @@ void Parser::_filter_block_folded_newlines_leading(FilterProcessor &C4_RESTRICT
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;
Expand Down Expand Up @@ -5516,7 +5509,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;
Expand Down Expand Up @@ -5549,7 +5541,6 @@ void Parser::_filter_block_folded_newlines(FilterProcessor &C4_RESTRICT proc, si
template<class FilterProcessor>
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))
Expand Down
11 changes: 11 additions & 0 deletions test/test_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,17 @@ TEST(FilterProcessorSrcDst, translate_esc_bulk_excess)
EXPECT_EQ(t.dst, "aaabbbcccddd^^");
}

TEST(Filter, _find_last_newline_and_larger_indentation)
{
RYML_EXPORT 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

Expand Down
5 changes: 5 additions & 0 deletions test/test_number.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#include "./test_group.hpp"
#ifdef RYML_SINGLE_HEADER
#include <ryml_all.hpp>
#else
#include <c4/charconv.hpp>
#endif

namespace c4 {
namespace yml {
Expand Down
28 changes: 13 additions & 15 deletions tools/amalgamate.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,19 @@
#include <stdarg.h>
"""

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}
Expand All @@ -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"),
Expand All @@ -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",
Expand Down

0 comments on commit 9de8779

Please sign in to comment.