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

Fix handling of indicators in plain scalars to conform to YAML 1.2 #122

Merged

Conversation

robinst
Copy link
Contributor

@robinst robinst commented Feb 20, 2019

YAML 1.2 has special handling of indicators to be compatible with JSON.
The following is equivalent to {"a": "b"} (note, no space after :):

{"a":b}

But without the quoted key, a space is required. So the : here is part
of the plain scalar:

{a:b}  # == {"a:b"}

A plain scalar can also start with a : as long as it's followed by
"safe" characters:

{a: :b}  # == {"a": ":b"}

(Fixes #118)

(See #116 for failing build)

YAML 1.2 has special handling of indicators to be compatible with JSON.
The following is equivalent to `{"a": "b"}` (note, no space after `:`):

    {"a":b}

But without the quoted key, a space is required. So the `:` here is part
of the plain scalar:

    {a:b}  # == {"a:b"}

A plain scalar can also start with a `:` as long as it's followed by
"safe" characters:

    {a: :b}  # == {"a": ":b"}

(Fixes chyh1990#118)
@robinst robinst force-pushed the fix-handling-of-indicators-in-plain-scalar branch from 15cea01 to a5c17a2 Compare March 4, 2019 00:47
@robinst
Copy link
Contributor Author

robinst commented Mar 4, 2019

@chyh1990 saw that you merged the rustfmt PR :)! Rebased this one and it now has a green build too.

@chyh1990 chyh1990 merged commit 9ca411f into chyh1990:master Mar 6, 2019
@robinst robinst deleted the fix-handling-of-indicators-in-plain-scalar branch March 6, 2019 09:59
@robinst
Copy link
Contributor Author

robinst commented Mar 6, 2019

@chyh1990 Yay :). Are you planning to cut a release with this fix soon?

@chyh1990
Copy link
Owner

chyh1990 commented Mar 7, 2019

v0.4.3 has been released on Github & crates.io

robinst added a commit to trishume/syntect that referenced this pull request Mar 24, 2019
Needs a newer yaml-rust to get this fix:
chyh1990/yaml-rust#122

There are currently test failures and more syntests are failing than
before. Needs to be investigated.
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

Successfully merging this pull request may close these issues.

2 participants