-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
The YAML spec states that the final line break is part of a block scalar unless strip -
is used as a chomping mode. The parser however treats the final line break as whitespace and assigns it to a different node.
Here is an example to reproduce the issue:
a: |
hello
world
b: |
hello
world
The parser generates the following output:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected] "a"
[email protected] ":"
[email protected] " "
[email protected]
[email protected]
[email protected]
[email protected] "|"
[email protected] "\n hello\n world"
[email protected] "\n" <-----
[email protected]
[email protected]
[email protected]
[email protected] "b"
[email protected] ":"
[email protected] " "
[email protected]
[email protected]
[email protected]
[email protected] "|"
[email protected] "\n hello\n world"
[email protected] "\n" <-----
The incorrectly parsed line breaks are marked with <-----
. They should be part of the BLOCK_SCALAR_TEXT
instead.
I tried to fix it myself, but it turned out to be quite challenging. Parsing the line break as part of BLOCK_SCALAR_TEXT
breaks the parent rules which expect the line break as a separator, e.g. the block_map
parsing function.
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed