Skip to content

Releases: biojppm/rapidyaml

Release 0.2.1

25 Sep 22:02
Compare
Choose a tag to compare

This release is focused on bug fixes and compliance with the YAML test suite.

Breaking changes

  • Fix parsing behavior of root-level scalars: now these are parsed into a DOCVAL, not SEQ->VAL (5ba0d56, from PR #144). Eg,
    ---
    this is a scalar
    --- # previously this was parsed as
    - this is a scalar
  • Cleanup type predicate API (PR #155):
    • ensure all type predicates from Tree and NodeRef forward to the corresponding predicate in NodeType
    • remove all type predicates and methods from NodeData; use the equivalent call from Tree or NodeRef. For example, for is_map():
      Tree t = parse("{foo: bar}");
      size_t map_id = t.root_id();
      NodeRef map = t.rootref();
      t.get(map_id)->is_map(); // compile error: no longer exists
      assert(t.is_map(map_id)); // OK
      assert(map.is_map()); // OK
    • Further cleanup to the type predicate API will be done in the future, especially around the .has_*() vs corresponding .is_*() naming scheme.

New features & improvements

  • Tree::lookup_path_or_modify(): add overload to graft existing branches (PR #141)
  • Callbacks: improve test coverage (PR #141)
  • YAML test suite (PR #144, PR #145): big progress towards compliance with the suite. There are still a number of existing problems, which are the subject of ongoing work. See the list of current known failures in the test suite file.
  • Python wheels and source package are now uploaded to PyPI as part of the release process.

Fixes

Anchors and references

  • Fix resolving of nodes with keyref+valref (PR #144): {&a a: &b b, *b: *a}
  • Fix parsing of implicit scalars when tags are present (PR #145):
    - &a  # test case PW8X
    - a
    - &a : a
      b: &b
    - &c : &a
    - ? &d
    - ? &e
      : &a
  • Fix #151: scalars beginning with * or & or << are now correctly quoted when emitting (PR #156).
  • Also from PR #156, map inheritance nodes like <<: *anchor or <<: [*anchor1, *anchor2] now have a KEYREF flag in their type (until a call to Tree::resolve()):
    Tree tree = parse("{map: &anchor {foo: bar}, copy: {<<: *anchor}}");
    assert(tree["copy"]["<<"].is_key_ref()); // previously this did not hold
    assert(tree["copy"]["<<"].is_val_ref()); // ... but this did

Tags

  • Fix parsing of tag dense maps and seqs (PR #144):
    --- !!map {
      k: !!seq [ a, !!str b],
      j: !!seq
         [ a, !!str b]
    --- !!seq [
      !!map { !!str k: v},
      !!map { !!str ? k: v}
    ]
    --- !!map
    !!str foo: !!map  # there was a parse error with the multiple tags
      !!int 1: !!float 20.0
      !!int 3: !!float 40.0
    --- !!seq
    - !!map
      !!str k1: v1
      !!str k2: v2
      !!str k3: v3

Whitespace

  • Fix parsing of double-quoted scalars with tabs (PR #145):
    "This has a\ttab"
    # is now correctly parsed as "This has a<TAB>tab"
  • Fix filtering of leading and trailing whitespace within double-quoted scalars (PR #145):
    # test case 4ZYM, 7A4E, TL85
    "
    <SPC><SPC>foo<SPC>
    <SPC> 
    <SPC><TAB><SPC>bar
    <SPC><SPC>baz
    "
    # is now correctly parsed as " foo\nbar\nbaz "
  • Fix parsing of tabs within YAML tokens (PR #145):
    ---<TAB>scalar   # test case K54U
    ---<TAB>{}       # test case Q5MG
    ---              # test case DC7X
    a: b<TAB>
    seq:<TAB>
     - a<TAB>
    c: d<TAB>#X
  • Fix parsing of flow-style maps with ommitted values without any space (PR #145):
    # test case 4ABK
    - {foo: , bar: , baz: }  # this was parsed correctly as {foo: ~, bar: ~, baz: ~}
    - {foo:, bar:, baz:}     # ... but this was parsed as {'foo:': , 'bar:': ~, 'baz:': ~}

Scalars

  • Unescape forward slashes in double quoted string (PR #145):
    --- escaped slash: "a\/b"   # test case 3UYS
    # is now parsed as:
    --- escaped slash: "a/b"
  • Fix filtering of indented regions in folded scalars (PR #145):
    # test case 7T8X
    - >
      
      folded
      line
      
      next
      line
        * bullet
      
        * list
        * lines
      
      last
      line
    is now correctly parsed as \nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n.
  • Fix parsing of special characters within plain scalars (PR #145):
    # test case 3MYT
    k:#foo
      &a !t s
      !t s
    # now correctly parsed as "k:#foo &a !t s !t s"
  • Fix parsing of comments after complex keys (PR #145):
    # test case X8DW
    ? key
    # comment 
    : value
    # now correctly parsed as {key: value}
  • Fix parsing of consecutive complex keys within maps (PR #145)
    # test case 7W2P, ZWK4
    ? a
    ? b
    c:
    ? d
    e:
    # now correctly parsed as {a: ~, b: ~, c: ~, d: ~, e: ~}
  • Fix #152: parse error with folded scalars that are the last in a container (PR #157):
    exec:
      command:
        # before the fix, this folded scalar failed to parse
        - |
          exec pg_isready -U "dog" -d "dbname=dog" -h 127.0.0.1 -p 5432
      parses: no
  • Fix: documents consisting of a quoted scalar now retain the VALQUO flag (PR #156)
    Tree tree = parse("'this is a quoted scalar'");
    assert(tree.rootref().is_doc());
    assert(tree.rootref().is_val());
    assert(tree.rootref().is_val_quoted());

Document structure

  • Empty docs are now parsed as a docval with a null node:
    ---   # test cases 6XDY, 6ZKB, 9BXL, PUW8
    ---
    ---
    is now parsed as
    --- ~
    --- ~
    --- ~
  • Prevent creation of DOC nodes from stream-level comments or tags (PR #145):
    !foo "bar"
    ...
    # Global
    %TAG ! tag:example.com,2000:app/
    ---
    !foo "bar"
    was parsed as
    ---
    !foo "bar"
    ---
    # notice the empty doc in here
    ---
    !foo "bar"
    and it is now correctly parsed as
    ---
    !foo "bar"
    ---
    !foo "bar"
    (other than the known limitation that ryml does not do tag lookup).

General

  • Fix #147: serialize/deserialize special float values .nan, .inf, -.inf (PR #149)
  • Fix #142: preprocess_json(): ensure quoted ranges are skipped when slurping containers
  • Ensure error macros expand to a single statement (PR #141)
  • Update c4core to 0.1.4

Special thanks

Release 0.2.0

09 Jul 20:26
Compare
Choose a tag to compare

New features & improvements

Fixes

  • Fix #139: substr and csubstr not found in ryml namespace
  • Fix #131: resolve references to map keys
  • Fix #129: quoted strings starting with * parsed as references
  • Fix #128: segfault on nonexistent anchor
  • Fix #124: parse failure in comments with trailing colon
  • Fix #121: preserve quotes when emitting scalars
  • Fix #103: ambiguous parsing of null/empty scalars
  • Fix #90: CMAKE_CXX_STANDARD ignored
  • Fix #40: quadratic complexity from use of sscanf(%f)
  • Fix emitting json to streams (dc6af83)
  • Set the global memory resource when setting global callbacks (511cba0)
  • Fix python packaging (PR #102)

Special thanks

Release 0.1.0

03 Nov 01:20
Compare
Choose a tag to compare

This is the first ryml release. Future releases will have a more organized changelog; for now, only recent major changes are listed.

Please be aware that there are still some anticipated breaking changes in the API before releasing the 1.0 major version. These are highlighted in the repo ROADMAP.

  • 2020/October
    • MR#89:
      • fix python API generation in windows
      • use github actions for testing and releasing
    • MR#88: fix MacOS compilation and installs. This is a fix from c4core.
    • MR#88: fix boolean handling. This is a fix from c4core. true and false are now parsed correctly into bool variables:
      auto tree = parse("{foo: true, bar: false}");
      Emitting bool variables still defaults to 0/1, like the default behaviour in the STL. To explicitly request true/false use c4::fmt::boolalpha():
      node << var;                     // "1"    or "0"
      node << c4::fmt::boolalpha(var); // "true" or "false"
  • 2020/September
    • [Breaking change] MR#85 null values in YAML are now parsed to null strings instead of YAML null token "~":
      auto tree = parse("{foo: , bar: ''}");
      // previous:
      assert(tree["foo"].val() == "~");
      assert(tree["bar"].val() == "");
      // now:
      assert(tree["foo"].val() == nullptr); // notice that this is now null
      assert(tree["bar"].val() == "");
    • MR#85 Commas after tags are now allowed:
      {foo: !!str, bar: ''}  # now the comma does not cause an error
    • MR#81: Always compile with extra pedantic warnings.
  • 2020/May
    • [Breaking change] the error callback now receives a source location object:
    // previous
    using pfn_error = void (*)(const char* msg, size_t msg_len, void *user_data);
    // now:
    using pfn_error = void (*)(const char* msg, size_t msg_len, Location location, void *user_data);