Skip to content

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

Merged
chyh1990 merged 1 commit into
chyh1990:masterfrom
robinst:fix-handling-of-indicators-in-plain-scalar
Mar 6, 2019
Merged

Fix handling of indicators in plain scalars to conform to YAML 1.2#122
chyh1990 merged 1 commit into
chyh1990:masterfrom
robinst:fix-handling-of-indicators-in-plain-scalar

Conversation

@robinst

@robinst robinst commented Feb 20, 2019

Copy link
Copy Markdown
Contributor

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

robinst commented Mar 4, 2019

Copy link
Copy Markdown
Contributor Author

@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

robinst commented Mar 6, 2019

Copy link
Copy Markdown
Contributor Author

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

@chyh1990

chyh1990 commented Mar 7, 2019

Copy link
Copy Markdown
Owner

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