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

Example 8.18. Implicit Block Mapping Entries = fails to parse #257

Closed
asomov opened this issue Feb 18, 2016 · 2 comments
Closed

Example 8.18. Implicit Block Mapping Entries = fails to parse #257

asomov opened this issue Feb 18, 2016 · 2 comments

Comments

@asomov
Copy link

asomov commented Feb 18, 2016

The "Example 8.18. Implicit Block Mapping Entries"

plain key: in-line value
 :  # Both empty
"quoted key":
- entry

fails with an error:

bad indentation of a mapping entry at line 2, column 2:
     :  # Both empty
     ^
@dervus dervus added the bug label Apr 15, 2016
@puzrin puzrin mentioned this issue Feb 28, 2017
9 tasks
@eemeli
Copy link

eemeli commented Jan 27, 2019

This is not a parser bug, it's intended behaviour. Example 18.8 in the spec uses the ° glyph to represent empty scalars, i.e. it's not meant to have a character representation in the YAML source. This is explained in section 7.2 of the spec, Empty Nodes:

In the examples, empty scalars are sometimes displayed as the glyph “°” for clarity. Note that this glyph corresponds to a position in the characters stream rather than to an actual character.

Other parsers also fail with the same input, as they should:

import YAML from 'yaml'

const src = `
plain key: in-line value
 :  # Both empty
"quoted key":
- entry\n`

YAML.parse(src)
  // throws YAMLSemanticError:
  // Nested mappings are not allowed in compact mappings

@puzrin
Copy link
Member

puzrin commented Jan 27, 2019

Thanks for clarification!

@puzrin puzrin closed this as completed Jan 27, 2019
@puzrin puzrin added not a bug and removed bug labels Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants