Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block scalar texts are parsed incorrectly: The final line break should be part of the scalar. #4

Open
mmueller2012 opened this issue Dec 16, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@mmueller2012
Copy link

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:

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.

@g-plane g-plane added the help wanted Extra attention is needed label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants