Skip to content

Lists with unindented items and trailing empty values parse incorrectly #274

@andrewts129

Description

@andrewts129

Thanks for the library, it's very impressive! I'm trying to create a Ruby gem that wraps it to provide a high performance alternative to the libyaml-based standard library and I'm running into an edge case where rapidyaml seems to incorrectly parse lists that have unindented items with an empty value in the last spot, such as:

---
foo:
- bar
-
baz: qux

libyaml parses this as:

+STR
+DOC ---
+MAP
=VAL :foo
+SEQ
=VAL :bar
=VAL :
-SEQ
=VAL :baz
=VAL :qux
-MAP
-DOC
-STR

While rapidyaml produces:

+STR
+DOC ---
+MAP
=VAL :foo
+SEQ
=VAL :bar
+MAP
=VAL :baz
=VAL :qux
-MAP
-SEQ
-MAP
-DOC
-STR

https://play.yaml.io/main/parser?input=LS0tCmZvbzoKLSBiYXIKLQpiYXo6IHF1eA==

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions