Skip to content

Releases: biojppm/rapidyaml

Release 0.2.3

05 Nov 11:25
Compare
Choose a tag to compare

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

New features

  • Add support for CPU architectures aarch64, ppc64le, s390x.
  • Update c4core to 0.1.7
  • Tree and NodeRef: add document getter doc() and docref()
    Tree tree = parse(R"(---
    doc0
    ---
    doc1
    )");
    NodeRef stream = t.rootref();
    assert(stream.is_stream());
    // tree.doc(i): get the index of the i-th doc node.
    // Equivalent to tree.child(tree.root_id(), i)
    assert(tree.doc(0) == 1u);
    assert(tree.doc(1) == 2u);
    // tree.docref(i), same as above, return NodeRef
    assert(tree.docref(0).val() == "doc0");
    assert(tree.docref(1).val() == "doc1");
    // stream.doc(i), same as above, given NodeRef
    assert(stream.doc(0).val() == "doc0");
    assert(stream.doc(1).val() == "doc1");

Fixes

  • Fix compilation with C4CORE_NO_FAST_FLOAT (PR #163)

Flow maps

  • Fix parse of multiline plain scalars inside flow maps (PR #161):
    # test case UT92
    # all parsed as "matches %": 20
    - { matches
    % : 20 }
    - { matches
    %: 20 }
    - { matches
    %:
     20 }

Tags

  • Fix parsing of tags followed by comments in sequences (PR #161):
    # test case 735Y
    - !!map # Block collection
      foo : bar

Quoted scalars

  • Fix filtering of tab characters in quoted scalars (PR #161):
    ---
    # test case 5GBF
    "Empty line
     <TAB>
    as a line feed"
    # now correctly parsed as "Empty line\nas a line feed"
    ---
    # test case PRH3
    ' 1st non-empty
    
    <SPC>2nd non-empty<SPC>
    <TAB>3rd non-empty '
    # now correctly parsed as " 1st non-empty\n2nd non-empty 3rd non-empty "
  • Fix filtering of backslash characters in double-quoted scalars (PR #161):
    # test cases NP9H, Q8AD
    "folded<SPC>
    to a space,<TAB>
    <SPC>
    to a line feed, or <TAB>\
     \ <TAB>non-content"
    # now correctly parsed as "folded to a space,\nto a line feed, or \t \tnon-content"
  • Ensure filtering of multiline quoted scalars (PR #161):
    # all scalars now correctly parsed as "quoted string",
    # both for double and single quotes
    ---
    "quoted
    string"
    --- "quoted
    string"
    ---
    - "quoted
      string"
    ---
    - "quoted
    string"
    ---
    "quoted
      string": "quoted
      string"
    ---
    "quoted
    string": "quoted
    string"

Block scalars

  • Ensure no newlines are added when emitting block scalars (PR #161)
  • Fix parsing of block spec with both chomping and indentation: chomping may come before or after the indentation (PR #161):
    # the block scalar specs below now have the same effect.
    # test cases: D83L, P2AD
    - |2-
      explicit indent and chomp
    - |-2
      chomp and explicit indent
  • Fix inference of block indentation with leading blank lines (PR #161):
    # test cases: 4QFQ, 7T8X
    - >
     
      
      # child1
    # parsed as "\n\n child1"
    --- # test case DWX9
    |
     
      
      literal
       
      
      text
    
     # Comment
    # parsed as "\n\nliteral\n \n\ntext\n"
  • Fix parsing of same-indentation block scalars (PR #161):
    # test case W4TN
    # all docs have the same value: "%!PS-Adobe-2.0"
    --- |
     %!PS-Adobe-2.0
    ...
    --- >
     %!PS-Adobe-2.0
    ...
    --- |
    %!PS-Adobe-2.0
    ...
    --- >
    %!PS-Adobe-2.0
    ...
    --- |
     %!PS-Adobe-2.0
    --- >
     %!PS-Adobe-2.0
    --- |
    %!PS-Adobe-2.0
    --- >
    %!PS-Adobe-2.0
  • Folded block scalars: fix folding of newlines at the border of indented parts (PR #161):
    # test case 6VJK
    # now correctly parsed as "Sammy Sosa completed another fine season with great stats.\n\n  63 Home Runs\n  0.288 Batting Average\n\nWhat a year!\n"
    >
      Sammy Sosa completed another
      fine season with great stats.
     
        63 Home Runs
        0.288 Batting Average
     
      What a year!
    ---
    # test case MJS9
    # now correctly parsed as "foo \n\n \t bar\n\nbaz\n"
    >
      foo<SPC>
    <SPC>
      <SPC><TAB><SPC>bar
    
      baz
  • Folded block scalars: fix folding of newlines when the indented part is at the begining of the scalar (PR #161):
    # test case F6MC
    a: >2
       more indented
      regular
    # parsed as a: " more indented\nregular\n"
    b: >2
    
    
       more indented
      regular
    # parsed as b: "\n\n more indented\nregular\n"

Plain scalars

  • Fix parsing of whitespace within plain scalars (PR #161):
    ---
    # test case NB6Z
    key:
      value
      with
       	
      tabs
      tabs
       	
        foo
       	
          bar
            baz
       	
    # is now correctly parsed as "value with\ntabs tabs\nfoo\nbar baz"
    ---
    # test case 9YRD, EX5H (trailing whitespace)
    a
    b  
      c
    d
    
    e
    # is now correctly parsed as "a b c d\ne"
  • Fix parsing of unindented plain scalars at the root level scope (PR #161)
    --- # this parsed
    Bare
     scalar
     is indented
    # was correctly parsed as "Bare scalar is indented"
    --- # but this failed to parse successfully:
    Bare
    scalar
    is not indented
    # is now correctly parsed as "Bare scalar is not indented"
    --- # test case NB6Z
    value
    with
     	
    tabs
    tabs
     	
      foo
     	
        bar
          baz
      	
    # now correctly parsed as "value with\ntabs tabs\nfoo\nbar baz"
    ---
    --- # test cases EXG3, 82AN
    ---word1
    word2
    # now correctly parsed as "---word1 word2"
  • Fix parsing of comments within plain scalars
    # test case 7TMG
    --- # now correctly parsed as "word1"
    word1
    # comment
    --- # now correctly parsed as [word1, word2]
    [ word1
    # comment
    , word2]

Python API

  • Add missing node predicates in SWIG API definition (PR #166):
    • is_anchor_or_ref()
    • is_key_quoted()
    • is_val_quoted()
    • is_quoted()

Thanks

--- @mbs-c
--- @simu
--- @QuellaZhang

Release 0.2.2

26 Sep 00:14
Compare
Choose a tag to compare

Yank python package 0.2.1, was accidentally created while iterating the PyPI submission from the Github action. This release does not add any change, and is functionally the same as 0.2.1.

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);