-
Notifications
You must be signed in to change notification settings - Fork 322
YAML 1.2
From https://yaml.org/spec/1.2.2/ext/changes/
The next-line \x85, line-separator \u2028 and paragraph-separator \u2029 characters are no longer considered line-break characters. Within scalar values, this means that next-line characters will not be included in the white-space normalization. Using any of these outside scalar values is likely to result in errors during parsing. For a relatively robust solution, try replacing \x85 and \u2028 with \n and \u2029 with \n\n.
libyaml still considers those characters as line breaks.
% perl -wE'binmode STDOUT, "encoding(utF-8)";print "- line1\x{2028}- line2\x{2029}- line3\x{85}- line4\n";' >file.yaml
% yamlpp-load file.yaml -M YAML::PP::LibYAML
$doc0 = [
"line1",
"line2",
"line3",
"line4"
];
% yamlpp-load file.yaml -M YAML::PP
$doc0 = [
"line1\x{2028}- line2\x{2029}- line3\x{85}- line4"
];
Tag shorthands can no longer include any of the characters ,[]{}, but can include #. To work around this, either fix your tag names or use verbatim tags.
libyaml doesn't allow those
Anchors can no longer include any of the characters ,[]{}.
libyaml doesn't allow those
Inside double-quoted strings \/
is now a valid escape for the /
character.
libyaml accepts that
No space is required after the colon in flow style if the key is quoted, e.g. {"key":value}.
libyaml accepts that
The maximum key length of 1024 characters has been removed for flow mapping keys.
libyaml implements the concept of "simple keys" from YAML 1.1.
Allowing more than 1024 characters only for flow mapping keys seems to be complicated, because the information on what kind of mapping we have doesn't seem to be available when checking the key. @perlpunk
Quoted content can include practically all Unicode characters.
Documents in streams are now independent of each other, and no longer inherit preceding document directives if they do not define their own.
libyaml was implemented with that behaviour already for 1.1, diverging from the spec.
Explicit document-end marker is now always required before a directive.
At least the output is now emitted according to 1.2: https://github.com/yaml/libyaml/pull/160
libyaml allows to omit the marker
% echo '---
- a
%YAML 1.1
---
- b' | yamlpp-events -M YAML::PP::LibYAML
+STR
+DOC ---
+SEQ
=VAL :a
-SEQ
-DOC
+DOC ---
+SEQ
=VAL :b
-SEQ
-DOC
-STR