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 style parse error #41

Closed
khattori opened this issue Jul 19, 2020 · 0 comments · Fixed by #51
Closed

Block scalar style parse error #41

khattori opened this issue Jul 19, 2020 · 0 comments · Fixed by #51
Assignees
Labels
Milestone

Comments

@khattori
Copy link

Hi
I found an exception raised when parsing the block scalar style with indentation.
(yamerl 0.8.0 using from Elixir)

iex(1)> :yamerl.decode("--- |
...(1)>   foo
...(1)>   bar
...(1)>   baz
...(1)> ---
...(1)> new document
...(1)> ")
** (throw) {:yamerl_exception, [{:yamerl_parsing_error, :error, 'Invalid block scalar indentation', 5, 1, :invalid_block_scalar_indentation, {:yamerl_scalar, 1, 5, {:yamerl_tag, 1, 5, {:non_specific, '!'}}, :block, :literal, 'foo\nbar\nbaz'}, []}]}
    (yamerl 0.8.0) /home/hattori/exyaml/deps/yamerl/src/yamerl_errors.erl:59: :yamerl_errors.throw/1
    (yamerl 0.8.0) /home/hattori/exyaml/deps/yamerl/src/yamerl_constr.erl:471: :yamerl_constr.string/2
@dumbbell dumbbell self-assigned this Jan 10, 2022
@dumbbell dumbbell added the bug label Jan 13, 2022
@dumbbell dumbbell added this to the v0.9.0 milestone Jan 13, 2022
dumbbell added a commit that referenced this issue Jan 13, 2022
When a block scalar was ended by a document end marker, it was
considered an error because of the unexpected indentation (the
indentation was less than the body of the block scalar).

The problem was that this error condition was verified before checking
this was a document or directives end marker.

Simply swapping the two code blocks fixes the issue.

Fixes #41.
dumbbell added a commit that referenced this issue Jan 13, 2022
When a block scalar was ended by a document end marker, it was
considered an error because of the unexpected indentation (the
indentation was less than the body of the block scalar).

The problem was that this error condition was verified before checking
this was a document or directives end marker.

Simply swapping the two code blocks fixes the issue.

Fixes #41.
dumbbell added a commit that referenced this issue Jan 13, 2022
This brings several bug fixes, including one which is a change of
behavior:

* @slezakattack implemented key deduplication in the construction of
  mappings, both when using proplists and maps (#39, #40).
* Report a parsing error if a block collection is unfinished when the
  end of the document is reached; e.g. when a `]` or `}` character is
  missing (#43, #50).
* Fix parsing of indented block scalar when they are finished by a
  document or directives end marker (#41, #51).

@kianmeng also fixed several typos (#47).

The Rebar configuration was updated to work with recent versions. While
working on that, the CI was switched from Travis to GitHub Actions.

Thank you to all contributors for their reports & patches!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants