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

Not explicitly stated that content indentation level of 0 is prohibited #290

Open
terry422 opened this issue Jul 9, 2022 · 1 comment
Open

Comments

@terry422
Copy link

terry422 commented Jul 9, 2022

The following YAML document is invalid because the content line of the block scalar does not have any indentation:

|
scalar

I believe this is intended, as c-indentation-indicator omits 0. However, I could not find a clause that explicitly precludes a non-empty line with zero indentation, when the indicator is omitted and the indentation level is auto-detected.

@ingydotnet
Copy link
Member

The YAML is actually valid according to the spec, but about half the parsers we test find it invalid.

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

Here's another interesting case where all known parsers interpret different than the spec:

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

It all has to do with the (flawed imho) concept of indentation starting at -1.

A better approach might be to define indentation as a state of indented or not-indented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants