Skip to content

Commit

Permalink
fromYAML: update rapidyaml to v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Otterbein committed Dec 19, 2022
1 parent 6edb3f5 commit 84c3451
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 66 deletions.
3 changes: 0 additions & 3 deletions src/libexpr/tests/compose-yaml-test-suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ for f in "$1"/src/*.yaml; do
testname="$(basename ${f} .yaml)"
[[ "${testname}" = "2SXE" ]] && echo " /** This test case is ignored because the YAML string is parsed incorrectly by ryml, but it's a rather artificial case, which isn't valid YAML 1.3 either."
echo " TEST_F(${testclass}, T_${testname}) {"
if [ "${testname}" = "Y79Y" ]; then
echo " GTEST_SKIP(); // issue in ryml"
fi
if [ "${testname}" = "565N" ]; then
echo " ASSERT_THROW(${testmethod}(T_${testname}),EvalError); // nix has no binary data type"
else
Expand Down
1 change: 0 additions & 1 deletion src/libexpr/tests/yaml-test-suite.hh
Original file line number Diff line number Diff line change
Expand Up @@ -13182,7 +13182,6 @@ namespace nix {
}

TEST_F(FromYAMLTest, T_Y79Y) {
GTEST_SKIP(); // issue in ryml
ASSERT_EQ(execYAMLTest(T_Y79Y),"OK");
}

Expand Down
5 changes: 4 additions & 1 deletion src/libexpr/tests/yaml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ namespace nix {
int ctr = -1;
for (auto testCase : testCases.listItems()) {
Value *json = nullptr;
bool fail = false;
ctr++;
std::string_view yamlRaw;
for (auto attr = testCase->attrs->begin(); attr != testCase->attrs->end(); attr++) {
Expand All @@ -106,9 +107,11 @@ namespace nix {
json = attr->value;
} else if (name == "yaml") {
yamlRaw = state.forceStringNoCtx(*attr->value);
} else if (name == "fail") {
fail = state.forceBool(*attr->value, noPos);
}
}
bool fail = !json;
fail |= !json;
bool emptyJSON = false;
std::string_view jsonStr;
Value jsonVal;
Expand Down
2 changes: 1 addition & 1 deletion src/rapidyaml/NOTES.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The header filer "ryml_all.hpp" is generated by the included script tools/amalgamate.py from https://github.com/biojppm/rapidyaml/commit/74c80318daf52e2d6f1d314ed99d55c1bd69d0cf
The header filer "ryml_all.hpp" is generated by the included script tools/amalgamate.py from https://github.com/biojppm/rapidyaml/tree/b35ccb150282760cf5c2d316895cb86bd161ac89 (v0.5.0)
16 changes: 13 additions & 3 deletions src/rapidyaml/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
[![test](https://github.com/biojppm/rapidyaml/workflows/test/badge.svg?branch=master)](https://github.com/biojppm/rapidyaml/actions)
<!-- [![Coveralls](https://coveralls.io/repos/github/biojppm/rapidyaml/badge.svg?branch=master)](https://coveralls.io/github/biojppm/rapidyaml) -->
[![Codecov](https://codecov.io/gh/biojppm/rapidyaml/branch/master/graph/badge.svg?branch=master)](https://codecov.io/gh/biojppm/rapidyaml)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/biojppm/rapidyaml.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/biojppm/rapidyaml/alerts/)
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/biojppm/rapidyaml.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/biojppm/rapidyaml/context:cpp)


Or ryml, for short. ryml is a C++ library to parse and emit YAML,
Expand Down Expand Up @@ -1001,7 +999,8 @@ See also [the roadmap](./ROADMAP.md) for a list of future work.

### Known limitations

ryml deliberately makes no effort to follow the standard in the following situations:
ryml deliberately makes no effort to follow the standard in the
following situations:

* Containers are not accepted as mapping keys: keys must be scalars.
* Tab characters after `:` and `-` are not accepted tokens, unless
Expand All @@ -1010,6 +1009,17 @@ ryml deliberately makes no effort to follow the standard in the following situat
into the parser's hot code and in some cases costs as much as 10%
in parsing time.
* Anchor names must not end with a terminating colon: eg `&anchor: key: val`.
* Non-unique map keys are allowed. Enforcing key uniqueness in the
parser or in the tree would cause log-linear parsing complexity (for
root children on a mostly flat tree), and would increase code size
through added structural, logical and cyclomatic complexity. So
enforcing uniqueness in the parser would hurt users who may not care
about it (they may not care either because non-uniqueness is OK for
their use case, or because it is impossible to occur). On the other
hand, any user who requires uniqueness can easily enforce it by
doing a post-parse walk through the tree. So choosing to not enforce
key uniqueness adheres to the spirit of "don't pay for what you
don't use".
* `%YAML` directives have no effect and are ignored.
* `%TAG` directives are limited to a default maximum of 4 instances
per `Tree`. To increase this maximum, define the preprocessor symbol
Expand Down
Loading

0 comments on commit 84c3451

Please sign in to comment.