|
in-yaml |
in-json |
test-event |
|
|
|
|
# 229Q - Spec Example 2.4. Sequence of Mappings
|
|
-
name: Mark McGwire
hr: 65
avg: 0.278
-
name: Sammy Sosa
hr: 63
avg: 0.288
|
[
{
"name": "Mark McGwire",
"hr": 65,
"avg": 0.278
},
{
"name": "Sammy Sosa",
"hr": 63,
"avg": 0.288
}
]
|
+STR
+DOC
+SEQ
+MAP
=VAL :name
=VAL :Mark McGwire
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
-MAP
+MAP
=VAL :name
=VAL :Sammy Sosa
=VAL :hr
=VAL :63
=VAL :avg
=VAL :0.288
-MAP
-SEQ
-DOC
-STR
|
# 26DV - Whitespace around colon in mappings
|
|
"top1" :
"key1" : &alias1 scalar1
'top2' :
'key2' : &alias2 scalar2
top3: &node3
*alias1 : scalar3
top4:
*alias2 : scalar4
top5 :
scalar5
top6:
&anchor6 'key6' : scalar6
|
{
"top1": {
"key1": "scalar1"
},
"top2": {
"key2": "scalar2"
},
"top3": {
"scalar1": "scalar3"
},
"top4": {
"scalar2": "scalar4"
},
"top5": "scalar5",
"top6": {
"key6": "scalar6"
}
}
|
+STR
+DOC
+MAP
=VAL "top1
+MAP
=VAL "key1
=VAL &alias1 :scalar1
-MAP
=VAL 'top2
+MAP
=VAL 'key2
=VAL &alias2 :scalar2
-MAP
=VAL :top3
+MAP &node3
=ALI *alias1
=VAL :scalar3
-MAP
=VAL :top4
+MAP
=ALI *alias2
=VAL :scalar4
-MAP
=VAL :top5
=VAL :scalar5
=VAL :top6
+MAP
=VAL &anchor6 'key6
=VAL :scalar6
-MAP
-MAP
-DOC
-STR
|
# 27NA - Spec Example 5.9. Directive Indicator
|
|
|
|
+STR
+DOC ---
=VAL :text
-DOC
-STR
|
# 2AUY - Tags in Block Sequence
|
|
- !!str a
- b
- !!int 42
- d
|
|
+STR
+DOC
+SEQ
=VAL <tag:yaml.org,2002:str> :a
=VAL :b
=VAL <tag:yaml.org,2002:int> :42
=VAL :d
-SEQ
-DOC
-STR
|
# 2EBW - Allowed characters in keys
|
|
a!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~: safe
?foo: safe question mark
:foo: safe colon
-foo: safe dash
this is#not: a comment
|
{
"a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~": "safe",
"?foo": "safe question mark",
":foo": "safe colon",
"-foo": "safe dash",
"this is#not": "a comment"
}
|
+STR
+DOC
+MAP
=VAL :a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~
=VAL :safe
=VAL :?foo
=VAL :safe question mark
=VAL ::foo
=VAL :safe colon
=VAL :-foo
=VAL :safe dash
=VAL :this is#not
=VAL :a comment
-MAP
-DOC
-STR
|
# 2G84:02 - Literal modifers
|
|
|
|
+STR
+DOC ---
=VAL |
-DOC
-STR
|
# 2G84:03 - Literal modifers
|
|
|
|
+STR
+DOC ---
=VAL |
-DOC
-STR
|
# 2JQS - Block Mapping with Missing Keys
|
|
|
|
+STR
+DOC
+MAP
=VAL :
=VAL :a
=VAL :
=VAL :b
-MAP
-DOC
-STR
|
# 2LFX - Spec Example 6.13. Reserved Directives [1.3]
|
|
%FOO bar baz # Should be ignored
# with a warning.
---
"foo"
|
|
+STR
+DOC ---
=VAL "foo
-DOC
-STR
|
# 2SXE - Anchors With Colon in Name
|
|
&a: key: &a value
foo:
*a:
|
{
"key": "value",
"foo": "key"
}
|
+STR
+DOC
+MAP
=VAL &a: :key
=VAL &a :value
=VAL :foo
=ALI *a:
-MAP
-DOC
-STR
|
# 2XXW - Spec Example 2.25. Unordered Sets
|
|
# Sets are represented as a
# Mapping where each key is
# associated with a null value
--- !!set
? Mark McGwire
? Sammy Sosa
? Ken Griff
|
{
"Mark McGwire": null,
"Sammy Sosa": null,
"Ken Griff": null
}
|
+STR
+DOC ---
+MAP <tag:yaml.org,2002:set>
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR
|
# 33X3 - Three explicit integers in a block sequence
|
|
---
- !!int 1
- !!int -2
- !!int 33
|
|
+STR
+DOC ---
+SEQ
=VAL <tag:yaml.org,2002:int> :1
=VAL <tag:yaml.org,2002:int> :-2
=VAL <tag:yaml.org,2002:int> :33
-SEQ
-DOC
-STR
|
# 35KP - Tags for Root Objects
|
|
--- !!map
? a
: b
--- !!seq
- !!str c
--- !!str
d
e
|
{
"a": "b"
}
[
"c"
]
"d e"
|
+STR
+DOC ---
+MAP <tag:yaml.org,2002:map>
=VAL :a
=VAL :b
-MAP
-DOC
+DOC ---
+SEQ <tag:yaml.org,2002:seq>
=VAL <tag:yaml.org,2002:str> :c
-SEQ
-DOC
+DOC ---
=VAL <tag:yaml.org,2002:str> :d e
-DOC
-STR
|
# 36F6 - Multiline plain scalar with empty line
|
|
|
|
+STR
+DOC ---
+MAP
=VAL :plain
=VAL :a b\nc
-MAP
-DOC
-STR
|
# 3ALJ - Block Sequence in Block Sequence
|
|
|
[
[
"s1_i1",
"s1_i2"
],
"s2"
]
|
+STR
+DOC
+SEQ
+SEQ
=VAL :s1_i1
=VAL :s1_i2
-SEQ
=VAL :s2
-SEQ
-DOC
-STR
|
# 3GZX - Spec Example 7.1. Alias Nodes
|
|
First occurrence: &anchor Foo
Second occurrence: *anchor
Override anchor: &anchor Bar
Reuse anchor: *anchor
|
{
"First occurrence": "Foo",
"Second occurrence": "Foo",
"Override anchor": "Bar",
"Reuse anchor": "Bar"
}
|
+STR
+DOC
+MAP
=VAL :First occurrence
=VAL &anchor :Foo
=VAL :Second occurrence
=ALI *anchor
=VAL :Override anchor
=VAL &anchor :Bar
=VAL :Reuse anchor
=ALI *anchor
-MAP
-DOC
-STR
|
# 3MYT - Plain Scalar looking like key, comment, anchor and tag
|
|
|
|
+STR
+DOC ---
=VAL :k:#foo &a !t s
-DOC
-STR
|
# 3R3P - Single block sequence with anchor
|
|
|
|
+STR
+DOC
+SEQ &sequence
=VAL :a
-SEQ
-DOC
-STR
|
# 3RLN:00 - Leading tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "1 leading \ttab
-DOC
-STR
|
# 3RLN:01 - Leading tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "2 leading \ttab
-DOC
-STR
|
# 3RLN:02 - Leading tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "3 leading tab
-DOC
-STR
|
# 3RLN:03 - Leading tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "4 leading \t tab
-DOC
-STR
|
# 3RLN:04 - Leading tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "5 leading \t tab
-DOC
-STR
|
# 3RLN:05 - Leading tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "6 leading tab
-DOC
-STR
|
# 3UYS - Escaped slash in double quotes
|
|
|
{
"escaped slash": "a/b"
}
|
+STR
+DOC
+MAP
=VAL :escaped slash
=VAL "a/b
-MAP
-DOC
-STR
|
# 4ABK - Flow Mapping Separate Values
|
|
{
unquoted : "separate",
http://foo.com,
omitted value:,
}
|
|
+STR
+DOC
+MAP {}
=VAL :unquoted
=VAL "separate
=VAL :http://foo.com
=VAL :
=VAL :omitted value
=VAL :
-MAP
-DOC
-STR
|
# 4CQQ - Spec Example 2.18. Multi-line Flow Scalars
|
|
plain:
This unquoted scalar
spans many lines.
quoted: "So does this
quoted scalar.\n"
|
{
"plain": "This unquoted scalar spans many lines.",
"quoted": "So does this quoted scalar.\n"
}
|
+STR
+DOC
+MAP
=VAL :plain
=VAL :This unquoted scalar spans many lines.
=VAL :quoted
=VAL "So does this quoted scalar.\n
-MAP
-DOC
-STR
|
# 4FJ6 - Nested implicit complex keys
|
|
---
[
[ a, [ [[b,c]]: d, e]]: 23
]
|
|
+STR
+DOC ---
+SEQ []
+MAP {}
+SEQ []
=VAL :a
+SEQ []
+MAP {}
+SEQ []
+SEQ []
=VAL :b
=VAL :c
-SEQ
-SEQ
=VAL :d
-MAP
=VAL :e
-SEQ
-SEQ
=VAL :23
-MAP
-SEQ
-DOC
-STR
|
# 4GC6 - Spec Example 7.7. Single Quoted Characters
|
|
|
|
+STR
+DOC
=VAL 'here's to "quotes"
-DOC
-STR
|
# 4MUZ:00 - Flow mapping colon on line after key
|
|
|
|
+STR
+DOC
+MAP {}
=VAL "foo
=VAL "bar
-MAP
-DOC
-STR
|
# 4MUZ:01 - Flow mapping colon on line after key
|
|
|
|
+STR
+DOC
+MAP {}
=VAL "foo
=VAL :bar
-MAP
-DOC
-STR
|
# 4MUZ:02 - Flow mapping colon on line after key
|
|
|
|
+STR
+DOC
+MAP {}
=VAL :foo
=VAL :bar
-MAP
-DOC
-STR
|
# 4Q9F - Folded Block Scalar [1.3]
|
|
|
|
+STR
+DOC ---
=VAL >ab cd\nef\n\ngh\n
-DOC
-STR
|
# 4QFQ - Spec Example 8.2. Block Indentation Indicator [1.3]
|
|
- |
detected
- >
# detected
- |1
explicit
- >
detected
|
[
"detected\n",
"\n\n# detected\n",
" explicit\n",
"detected\n"
]
|
+STR
+DOC
+SEQ
=VAL |detected\n
=VAL >\n\n# detected\n
=VAL | explicit\n
=VAL >detected\n
-SEQ
-DOC
-STR
|
# 4RWC - Trailing spaces after flow collection
|
|
|
|
+STR
+DOC
+SEQ []
=VAL :1
=VAL :2
=VAL :3
-SEQ
-DOC
-STR
|
# 4UYU - Colon in Double Quoted String
|
|
|
|
+STR
+DOC
=VAL "foo: bar": baz
-DOC
-STR
|
# 4V8U - Plain scalar with backslashes
|
|
---
plain\value\with\backslashes
|
"plain\\value\\with\\backslashes"
|
+STR
+DOC ---
=VAL :plain\\value\\with\\backslashes
-DOC
-STR
|
# 4WA9 - Literal scalars
|
|
|
[
{
"aaa" : "xxx\n",
"bbb" : "xxx\n"
}
]
|
+STR
+DOC
+SEQ
+MAP
=VAL :aaa
=VAL |xxx\n
=VAL :bbb
=VAL |xxx\n
-MAP
-SEQ
-DOC
-STR
|
# 4ZYM - Spec Example 6.4. Line Prefixes
|
|
plain: text
lines
quoted: "text
lines"
block: |
text
lines
|
{
"plain": "text lines",
"quoted": "text lines",
"block": "text\n \tlines\n"
}
|
+STR
+DOC
+MAP
=VAL :plain
=VAL :text lines
=VAL :quoted
=VAL "text lines
=VAL :block
=VAL |text\n \tlines\n
-MAP
-DOC
-STR
|
# 52DL - Explicit Non-Specific Tag [1.3]
|
|
|
|
+STR
+DOC ---
=VAL <!> :a
-DOC
-STR
|
# 54T7 - Flow Mapping
|
|
|
{
"foo": "you",
"bar": "far"
}
|
+STR
+DOC
+MAP {}
=VAL :foo
=VAL :you
=VAL :bar
=VAL :far
-MAP
-DOC
-STR
|
# 565N - Construct Binary
|
|
canonical: !!binary "\
R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\
OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\
+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\
AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs="
generic: !!binary |
R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
description:
The binary value above is a tiny arrow encoded as a gif image.
|
{
"canonical": "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLCAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=",
"generic": "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\nOTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\n+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\nAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=\n",
"description": "The binary value above is a tiny arrow encoded as a gif image."
}
|
+STR
+DOC
+MAP
=VAL :canonical
=VAL <tag:yaml.org,2002:binary> "R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLCAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
=VAL :generic
=VAL <tag:yaml.org,2002:binary> |R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5\nOTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+\n+f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC\nAgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=\n
=VAL :description
=VAL :The binary value above is a tiny arrow encoded as a gif image.
-MAP
-DOC
-STR
|
# 57H4 - Spec Example 8.22. Block Collection Nodes
|
|
sequence: !!seq
- entry
- !!seq
- nested
mapping: !!map
foo: bar
|
{
"sequence": [
"entry",
[
"nested"
]
],
"mapping": {
"foo": "bar"
}
}
|
+STR
+DOC
+MAP
=VAL :sequence
+SEQ <tag:yaml.org,2002:seq>
=VAL :entry
+SEQ <tag:yaml.org,2002:seq>
=VAL :nested
-SEQ
-SEQ
=VAL :mapping
+MAP <tag:yaml.org,2002:map>
=VAL :foo
=VAL :bar
-MAP
-MAP
-DOC
-STR
|
# 58MP - Flow mapping edge cases
|
|
|
|
+STR
+DOC
+MAP {}
=VAL :x
=VAL ::x
-MAP
-DOC
-STR
|
# 5BVJ - Spec Example 5.7. Block Scalar Indicators
|
|
literal: |
some
text
folded: >
some
text
|
{
"literal": "some\ntext\n",
"folded": "some text\n"
}
|
+STR
+DOC
+MAP
=VAL :literal
=VAL |some\ntext\n
=VAL :folded
=VAL >some text\n
-MAP
-DOC
-STR
|
# 5C5M - Spec Example 7.15. Flow Mappings
|
|
- { one : two , three: four , }
- {five: six,seven : eight}
|
[
{
"one": "two",
"three": "four"
},
{
"five": "six",
"seven": "eight"
}
]
|
+STR
+DOC
+SEQ
+MAP {}
=VAL :one
=VAL :two
=VAL :three
=VAL :four
-MAP
+MAP {}
=VAL :five
=VAL :six
=VAL :seven
=VAL :eight
-MAP
-SEQ
-DOC
-STR
|
# 5GBF - Spec Example 6.5. Empty Lines
|
|
Folding:
"Empty line
as a line feed"
Chomping: |
Clipped empty lines
|
{
"Folding": "Empty line\nas a line feed",
"Chomping": "Clipped empty lines\n"
}
|
+STR
+DOC
+MAP
=VAL :Folding
=VAL "Empty line\nas a line feed
=VAL :Chomping
=VAL |Clipped empty lines\n
-MAP
-DOC
-STR
|
# 5KJE - Spec Example 7.13. Flow Sequence
|
|
- [ one, two, ]
- [three ,four]
|
[
[
"one",
"two"
],
[
"three",
"four"
]
]
|
+STR
+DOC
+SEQ
+SEQ []
=VAL :one
=VAL :two
-SEQ
+SEQ []
=VAL :three
=VAL :four
-SEQ
-SEQ
-DOC
-STR
|
# 5MUD - Colon and adjacent value on next line
|
|
|
|
+STR
+DOC ---
+MAP {}
=VAL "foo
=VAL :bar
-MAP
-DOC
-STR
|
# 5NYZ - Spec Example 6.9. Separated Comment
|
|
|
|
+STR
+DOC
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR
|
# 5T43 - Colon at the beginning of adjacent flow scalar
|
|
- { "key":value }
- { "key"::value }
|
[
{
"key": "value"
},
{
"key": ":value"
}
]
|
+STR
+DOC
+SEQ
+MAP {}
=VAL "key
=VAL :value
-MAP
+MAP {}
=VAL "key
=VAL ::value
-MAP
-SEQ
-DOC
-STR
|
# 5TYM - Spec Example 6.21. Local Tag Prefix
|
|
%TAG !m! !my-
--- # Bulb here
!m!light fluorescent
...
%TAG !m! !my-
--- # Color here
!m!light green
|
|
+STR
+DOC ---
=VAL <!my-light> :fluorescent
-DOC ...
+DOC ---
=VAL <!my-light> :green
-DOC
-STR
|
# 5WE3 - Spec Example 8.17. Explicit Block Mapping Entries
|
|
? explicit key # Empty value
? |
block key
: - one # Explicit compact
- two # block value
|
{
"explicit key": null,
"block key\n": [
"one",
"two"
]
}
|
+STR
+DOC
+MAP
=VAL :explicit key
=VAL :
=VAL |block key\n
+SEQ
=VAL :one
=VAL :two
-SEQ
-MAP
-DOC
-STR
|
# 652Z - Question mark at start of flow key
|
|
|
{
"?foo" : "bar",
"bar" : 42
}
|
+STR
+DOC
+MAP {}
=VAL :?foo
=VAL :bar
=VAL :bar
=VAL :42
-MAP
-DOC
-STR
|
# 65WH - Single Entry Block Sequence
|
|
|
|
+STR
+DOC
+SEQ
=VAL :foo
-SEQ
-DOC
-STR
|
# 6BCT - Spec Example 6.3. Separation Spaces
|
|
|
[
{
"foo": "bar"
},
[
"baz",
"baz"
]
]
|
+STR
+DOC
+SEQ
+MAP
=VAL :foo
=VAL :bar
-MAP
+SEQ
=VAL :baz
=VAL :baz
-SEQ
-SEQ
-DOC
-STR
|
# 6BFJ - Mapping, key and flow sequence item anchors
|
|
---
&mapping
&key [ &item a, b, c ]: value
|
|
+STR
+DOC ---
+MAP &mapping
+SEQ [] &key
=VAL &item :a
=VAL :b
=VAL :c
-SEQ
=VAL :value
-MAP
-DOC
-STR
|
# 6CA3 - Tab indented top flow
|
|
|
|
+STR
+DOC
+SEQ []
-SEQ
-DOC
-STR
|
# 6CK3 - Spec Example 6.26. Tag Shorthands
|
|
%TAG !e! tag:example.com,2000:app/
---
- !local foo
- !!str bar
- !e!tag%21 baz
|
|
+STR
+DOC ---
+SEQ
=VAL <!local> :foo
=VAL <tag:yaml.org,2002:str> :bar
=VAL <tag:example.com,2000:app/tag!> :baz
-SEQ
-DOC
-STR
|
# 6FWR - Block Scalar Keep
|
|
|
|
+STR
+DOC ---
=VAL |ab\n\n \n
-DOC ...
-STR
|
# 6H3V - Backslashes in singlequotes
|
|
|
|
+STR
+DOC
+MAP
=VAL 'foo: bar\\
=VAL :baz'
-MAP
-DOC
-STR
|
# 6HB6 - Spec Example 6.1. Indentation Spaces
|
|
# Leading comment line spaces are
# neither content nor indentation.
Not indented:
By one space: |
By four
spaces
Flow style: [ # Leading spaces
By two, # in flow style
Also by two, # are neither
Still by two # content nor
] # indentation.
|
{
"Not indented": {
"By one space": "By four\n spaces\n",
"Flow style": [
"By two",
"Also by two",
"Still by two"
]
}
}
|
+STR
+DOC
+MAP
=VAL :Not indented
+MAP
=VAL :By one space
=VAL |By four\n spaces\n
=VAL :Flow style
+SEQ []
=VAL :By two
=VAL :Also by two
=VAL :Still by two
-SEQ
-MAP
-MAP
-DOC
-STR
|
# 6JQW - Spec Example 2.13. In literals, newlines are preserved
|
|
# ASCII Art
--- |
\//||\/||
// || ||__
|
"\\//||\\/||\n// || ||__\n"
|
+STR
+DOC ---
=VAL |\\//||\\/||\n// || ||__\n
-DOC
-STR
|
# 6JWB - Tags for Block Objects
|
|
foo: !!seq
- !!str a
- !!map
key: !!str value
|
{
"foo": [
"a",
{
"key": "value"
}
]
}
|
+STR
+DOC
+MAP
=VAL :foo
+SEQ <tag:yaml.org,2002:seq>
=VAL <tag:yaml.org,2002:str> :a
+MAP <tag:yaml.org,2002:map>
=VAL :key
=VAL <tag:yaml.org,2002:str> :value
-MAP
-SEQ
-MAP
-DOC
-STR
|
# 6KGN - Anchor for empty node
|
|
---
a: &anchor
b: *anchor
|
|
+STR
+DOC ---
+MAP
=VAL :a
=VAL &anchor :
=VAL :b
=ALI *anchor
-MAP
-DOC
-STR
|
# 6LVF - Spec Example 6.13. Reserved Directives
|
|
%FOO bar baz # Should be ignored
# with a warning.
--- "foo"
|
|
+STR
+DOC ---
=VAL "foo
-DOC
-STR
|
# 6M2F - Aliases in Explicit Block Mapping
|
|
|
|
+STR
+DOC
+MAP
=VAL &a :a
=VAL &b :b
=VAL :
=ALI *a
-MAP
-DOC
-STR
|
# 6PBE - Zero-indented sequences in explicit mapping keys
|
|
|
|
+STR
+DOC ---
+MAP
+SEQ
=VAL :a
=VAL :b
-SEQ
+SEQ
=VAL :c
=VAL :d
-SEQ
-MAP
-DOC
-STR
|
# 6SLA - Allowed characters in quoted mapping key
|
|
"foo\nbar:baz\tx \\$%^&*()x": 23
'x\ny:z\tx $%^&*()x': 24
|
{
"foo\nbar:baz\tx \\$%^&*()x": 23,
"x\\ny:z\\tx $%^&*()x": 24
}
|
+STR
+DOC
+MAP
=VAL "foo\nbar:baz\tx \\$%^&*()x
=VAL :23
=VAL 'x\\ny:z\\tx $%^&*()x
=VAL :24
-MAP
-DOC
-STR
|
# 6VJK - Spec Example 2.15. Folded newlines are preserved for "more indented" and blank lines
|
|
>
Sammy Sosa completed another
fine season with great stats.
63 Home Runs
0.288 Batting Average
What a year!
|
"Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n"
|
+STR
+DOC
=VAL >Sammy Sosa completed another fine season with great stats.\n\n 63 Home Runs\n 0.288 Batting Average\n\nWhat a year!\n
-DOC
-STR
|
# 6WLZ - Spec Example 6.18. Primary Tag Handle [1.3]
|
|
# Private
---
!foo "bar"
...
# Global
%TAG ! tag:example.com,2000:app/
---
!foo "bar"
|
|
+STR
+DOC ---
=VAL <!foo> "bar
-DOC ...
+DOC ---
=VAL <tag:example.com,2000:app/foo> "bar
-DOC
-STR
|
# 6WPF - Spec Example 6.8. Flow Folding [1.3]
|
|
|
|
+STR
+DOC ---
=VAL " foo\nbar\nbaz
-DOC
-STR
|
# 6XDY - Two document start markers
|
|
|
|
+STR
+DOC ---
=VAL :
-DOC
+DOC ---
=VAL :
-DOC
-STR
|
# 6ZKB - Spec Example 9.6. Stream
|
|
Document
---
# Empty
...
%YAML 1.2
---
matches %: 20
|
"Document"
null
{
"matches %": 20
}
|
+STR
+DOC
=VAL :Document
-DOC
+DOC ---
=VAL :
-DOC ...
+DOC ---
+MAP
=VAL :matches %
=VAL :20
-MAP
-DOC
-STR
|
# 735Y - Spec Example 8.20. Block Node Types
|
|
-
"flow in block"
- >
Block scalar
- !!map # Block collection
foo : bar
|
[
"flow in block",
"Block scalar\n",
{
"foo": "bar"
}
]
|
+STR
+DOC
+SEQ
=VAL "flow in block
=VAL >Block scalar\n
+MAP <tag:yaml.org,2002:map>
=VAL :foo
=VAL :bar
-MAP
-SEQ
-DOC
-STR
|
# 74H7 - Tags in Implicit Mapping
|
|
!!str a: b
c: !!int 42
e: !!str f
g: h
!!str 23: !!bool false
|
{
"a": "b",
"c": 42,
"e": "f",
"g": "h",
"23": false
}
|
+STR
+DOC
+MAP
=VAL <tag:yaml.org,2002:str> :a
=VAL :b
=VAL :c
=VAL <tag:yaml.org,2002:int> :42
=VAL :e
=VAL <tag:yaml.org,2002:str> :f
=VAL :g
=VAL :h
=VAL <tag:yaml.org,2002:str> :23
=VAL <tag:yaml.org,2002:bool> :false
-MAP
-DOC
-STR
|
# 753E - Block Scalar Strip [1.3]
|
|
|
|
+STR
+DOC ---
=VAL |ab
-DOC ...
-STR
|
# 7A4E - Spec Example 7.6. Double Quoted Lines
|
|
" 1st non-empty
2nd non-empty
3rd non-empty "
|
" 1st non-empty\n2nd non-empty 3rd non-empty "
|
+STR
+DOC
=VAL " 1st non-empty\n2nd non-empty 3rd non-empty
-DOC
-STR
|
# 7BMT - Node and Mapping Key Anchors [1.3]
|
|
---
top1: &node1
&k1 key1: one
top2: &node2 # comment
key2: two
top3:
&k3 key3: three
top4: &node4
&k4 key4: four
top5: &node5
key5: five
top6: &val6
six
top7:
&val7 seven
|
{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}
|
+STR
+DOC ---
+MAP
=VAL :top1
+MAP &node1
=VAL &k1 :key1
=VAL :one
-MAP
=VAL :top2
+MAP &node2
=VAL :key2
=VAL :two
-MAP
=VAL :top3
+MAP
=VAL &k3 :key3
=VAL :three
-MAP
=VAL :top4
+MAP &node4
=VAL &k4 :key4
=VAL :four
-MAP
=VAL :top5
+MAP &node5
=VAL :key5
=VAL :five
-MAP
=VAL :top6
=VAL &val6 :six
=VAL :top7
=VAL &val7 :seven
-MAP
-DOC
-STR
|
# 7BUB - Spec Example 2.10. Node for “Sammy Sosa” appears twice in this document
|
|
---
hr:
- Mark McGwire
# Following node labeled SS
- &SS Sammy Sosa
rbi:
- *SS # Subsequent occurrence
- Ken Griffey
|
{
"hr": [
"Mark McGwire",
"Sammy Sosa"
],
"rbi": [
"Sammy Sosa",
"Ken Griffey"
]
}
|
+STR
+DOC ---
+MAP
=VAL :hr
+SEQ
=VAL :Mark McGwire
=VAL &SS :Sammy Sosa
-SEQ
=VAL :rbi
+SEQ
=ALI *SS
=VAL :Ken Griffey
-SEQ
-MAP
-DOC
-STR
|
# 7FWL - Spec Example 6.24. Verbatim Tags
|
|
!<tag:yaml.org,2002:str> foo :
!<!bar> baz
|
|
+STR
+DOC
+MAP
=VAL <tag:yaml.org,2002:str> :foo
=VAL <!bar> :baz
-MAP
-DOC
-STR
|
# 7T8X - Spec Example 8.10. Folded Lines - 8.13. Final Empty Lines
|
|
>
folded
line
next
line
* bullet
* list
* lines
last
line
# Comment
|
"\nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n"
|
+STR
+DOC
=VAL >\nfolded line\nnext line\n * bullet\n\n * list\n * lines\n\nlast line\n
-DOC
-STR
|
# 7TMG - Comment in flow sequence before comma
|
|
---
[ word1
# comment
, word2]
|
|
+STR
+DOC ---
+SEQ []
=VAL :word1
=VAL :word2
-SEQ
-DOC
-STR
|
# 7W2P - Block Mapping with Missing Values
|
|
|
{
"a": null,
"b": null,
"c": null
}
|
+STR
+DOC
+MAP
=VAL :a
=VAL :
=VAL :b
=VAL :
=VAL :c
=VAL :
-MAP
-DOC
-STR
|
# 7Z25 - Bare document after document end marker
|
|
---
scalar1
...
key: value
|
"scalar1"
{
"key": "value"
}
|
+STR
+DOC ---
=VAL :scalar1
-DOC ...
+DOC
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR
|
# 7ZZ5 - Empty flow collections
|
|
---
nested sequences:
- - - []
- - - {}
key1: []
key2: {}
|
{
"nested sequences": [
[
[
[]
]
],
[
[
{}
]
]
],
"key1": [],
"key2": {}
}
|
+STR
+DOC ---
+MAP
=VAL :nested sequences
+SEQ
+SEQ
+SEQ
+SEQ []
-SEQ
-SEQ
-SEQ
+SEQ
+SEQ
+MAP {}
-MAP
-SEQ
-SEQ
-SEQ
=VAL :key1
+SEQ []
-SEQ
=VAL :key2
+MAP {}
-MAP
-MAP
-DOC
-STR
|
# 82AN - Three dashes and content without space
|
|
|
|
+STR
+DOC
=VAL :---word1 word2
-DOC
-STR
|
# 87E4 - Spec Example 7.8. Single Quoted Implicit Keys
|
|
'implicit block key' : [
'implicit flow key' : value,
]
|
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
|
+STR
+DOC
+MAP
=VAL 'implicit block key
+SEQ []
+MAP {}
=VAL 'implicit flow key
=VAL :value
-MAP
-SEQ
-MAP
-DOC
-STR
|
# 8CWC - Plain mapping key ending with colon
|
|
---
key ends with two colons::: value
|
{
"key ends with two colons::": "value"
}
|
+STR
+DOC ---
+MAP
=VAL :key ends with two colons::
=VAL :value
-MAP
-DOC
-STR
|
# 8G76 - Spec Example 6.10. Comment Lines
|
|
|
|
|
# 8KB6 - Multiline plain flow mapping key without value
|
|
---
- { single line, a: b}
- { multi
line, a: b}
|
[
{
"single line": null,
"a": "b"
},
{
"multi line": null,
"a": "b"
}
]
|
+STR
+DOC ---
+SEQ
+MAP {}
=VAL :single line
=VAL :
=VAL :a
=VAL :b
-MAP
+MAP {}
=VAL :multi line
=VAL :
=VAL :a
=VAL :b
-MAP
-SEQ
-DOC
-STR
|
# 8MK2 - Explicit Non-Specific Tag
|
|
|
|
+STR
+DOC
=VAL <!> :a
-DOC
-STR
|
# 8QBE - Block Sequence in Block Mapping
|
|
|
{
"key": [
"item1",
"item2"
]
}
|
+STR
+DOC
+MAP
=VAL :key
+SEQ
=VAL :item1
=VAL :item2
-SEQ
-MAP
-DOC
-STR
|
# 8UDB - Spec Example 7.14. Flow Sequence Entries
|
|
[
"double
quoted", 'single
quoted',
plain
text, [ nested ],
single: pair,
]
|
[
"double quoted",
"single quoted",
"plain text",
[
"nested"
],
{
"single": "pair"
}
]
|
+STR
+DOC
+SEQ []
=VAL "double quoted
=VAL 'single quoted
=VAL :plain text
+SEQ []
=VAL :nested
-SEQ
+MAP {}
=VAL :single
=VAL :pair
-MAP
-SEQ
-DOC
-STR
|
# 8XYN - Anchor with unicode character
|
|
|
|
+STR
+DOC ---
+SEQ
=VAL &😁 :unicode anchor
-SEQ
-DOC
-STR
|
# 93JH - Block Mappings in Block Sequence
|
|
- key: value
key2: value2
-
key3: value3
|
[
{
"key": "value",
"key2": "value2"
},
{
"key3": "value3"
}
]
|
+STR
+DOC
+SEQ
+MAP
=VAL :key
=VAL :value
=VAL :key2
=VAL :value2
-MAP
+MAP
=VAL :key3
=VAL :value3
-MAP
-SEQ
-DOC
-STR
|
# 93WF - Spec Example 6.6. Line Folding [1.3]
|
|
|
|
+STR
+DOC ---
=VAL >trimmed\n\n\nas space
-DOC
-STR
|
# 96L6 - Spec Example 2.14. In the folded scalars, newlines become spaces
|
|
--- >
Mark McGwire's
year was crippled
by a knee injury.
|
"Mark McGwire's year was crippled by a knee injury.\n"
|
+STR
+DOC ---
=VAL >Mark McGwire's year was crippled by a knee injury.\n
-DOC
-STR
|
# 96NN:00 - Leading tab content in literals
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL |\tbar
-MAP
-DOC
-STR
|
# 96NN:01 - Leading tab content in literals
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL |\tbar
-MAP
-DOC
-STR
|
# 98YD - Spec Example 5.5. Comment Indicator
|
|
|
|
|
# 9BXH - Multiline doublequoted flow mapping key without value
|
|
---
- { "single line", a: b}
- { "multi
line", a: b}
|
[
{
"single line": null,
"a": "b"
},
{
"multi line": null,
"a": "b"
}
]
|
+STR
+DOC ---
+SEQ
+MAP {}
=VAL "single line
=VAL :
=VAL :a
=VAL :b
-MAP
+MAP {}
=VAL "multi line
=VAL :
=VAL :a
=VAL :b
-MAP
-SEQ
-DOC
-STR
|
# 9DXL - Spec Example 9.6. Stream [1.3]
|
|
Mapping: Document
---
# Empty
...
%YAML 1.2
---
matches %: 20
|
{
"Mapping": "Document"
}
null
{
"matches %": 20
}
|
+STR
+DOC
+MAP
=VAL :Mapping
=VAL :Document
-MAP
-DOC
+DOC ---
=VAL :
-DOC ...
+DOC ---
+MAP
=VAL :matches %
=VAL :20
-MAP
-DOC
-STR
|
# 9FMG - Multi-level Mapping Indent
|
|
|
{
"a": {
"b": {
"c": "d"
},
"e": {
"f": "g"
}
},
"h": "i"
}
|
+STR
+DOC
+MAP
=VAL :a
+MAP
=VAL :b
+MAP
=VAL :c
=VAL :d
-MAP
=VAL :e
+MAP
=VAL :f
=VAL :g
-MAP
-MAP
=VAL :h
=VAL :i
-MAP
-DOC
-STR
|
# 9J7A - Simple Mapping Indent
|
|
|
{
"foo": {
"bar": "baz"
}
}
|
+STR
+DOC
+MAP
=VAL :foo
+MAP
=VAL :bar
=VAL :baz
-MAP
-MAP
-DOC
-STR
|
# 9KAX - Various combinations of tags and anchors
|
|
---
&a1
!!str
scalar1
---
!!str
&a2
scalar2
---
&a3
!!str scalar3
---
&a4 !!map
&a5 !!str key5: value4
---
a6: 1
&anchor6 b6: 2
---
!!map
&a8 !!str key8: value7
---
!!map
!!str &a10 key10: value9
---
!!str &a11
value11
|
"scalar1"
"scalar2"
"scalar3"
{
"key5": "value4"
}
{
"a6": 1,
"b6": 2
}
{
"key8": "value7"
}
{
"key10": "value9"
}
"value11"
|
+STR
+DOC ---
=VAL &a1 <tag:yaml.org,2002:str> :scalar1
-DOC
+DOC ---
=VAL &a2 <tag:yaml.org,2002:str> :scalar2
-DOC
+DOC ---
=VAL &a3 <tag:yaml.org,2002:str> :scalar3
-DOC
+DOC ---
+MAP &a4 <tag:yaml.org,2002:map>
=VAL &a5 <tag:yaml.org,2002:str> :key5
=VAL :value4
-MAP
-DOC
+DOC ---
+MAP
=VAL :a6
=VAL :1
=VAL &anchor6 :b6
=VAL :2
-MAP
-DOC
+DOC ---
+MAP <tag:yaml.org,2002:map>
=VAL &a8 <tag:yaml.org,2002:str> :key8
=VAL :value7
-MAP
-DOC
+DOC ---
+MAP <tag:yaml.org,2002:map>
=VAL &a10 <tag:yaml.org,2002:str> :key10
=VAL :value9
-MAP
-DOC
+DOC ---
=VAL &a11 <tag:yaml.org,2002:str> :value11
-DOC
-STR
|
# 9MMW - Single Pair Implicit Entries
|
|
- [ YAML : separate ]
- [ "JSON like":adjacent ]
- [ {JSON: like}:adjacent ]
|
|
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :YAML
=VAL :separate
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL "JSON like
=VAL :adjacent
-MAP
-SEQ
+SEQ []
+MAP {}
+MAP {}
=VAL :JSON
=VAL :like
-MAP
=VAL :adjacent
-MAP
-SEQ
-SEQ
-DOC
-STR
|
# 9MQT:00 - Scalar doc with '...' in content
|
|
|
|
+STR
+DOC ---
=VAL "a ...x b
-DOC
-STR
|
# 9SA2 - Multiline double quoted flow mapping key
|
|
---
- { "single line": value}
- { "multi
line": value}
|
[
{
"single line": "value"
},
{
"multi line": "value"
}
]
|
+STR
+DOC ---
+SEQ
+MAP {}
=VAL "single line
=VAL :value
-MAP
+MAP {}
=VAL "multi line
=VAL :value
-MAP
-SEQ
-DOC
-STR
|
# 9SHH - Spec Example 5.8. Quoted Scalar Indicators
|
|
single: 'text'
double: "text"
|
{
"single": "text",
"double": "text"
}
|
+STR
+DOC
+MAP
=VAL :single
=VAL 'text
=VAL :double
=VAL "text
-MAP
-DOC
-STR
|
# 9TFX - Spec Example 7.6. Double Quoted Lines [1.3]
|
|
---
" 1st non-empty
2nd non-empty
3rd non-empty "
|
" 1st non-empty\n2nd non-empty 3rd non-empty "
|
+STR
+DOC ---
=VAL " 1st non-empty\n2nd non-empty 3rd non-empty
-DOC
-STR
|
# 9U5K - Spec Example 2.12. Compact Nested Mapping
|
|
---
# Products purchased
- item : Super Hoop
quantity: 1
- item : Basketball
quantity: 4
- item : Big Shoes
quantity: 1
|
[
{
"item": "Super Hoop",
"quantity": 1
},
{
"item": "Basketball",
"quantity": 4
},
{
"item": "Big Shoes",
"quantity": 1
}
]
|
+STR
+DOC ---
+SEQ
+MAP
=VAL :item
=VAL :Super Hoop
=VAL :quantity
=VAL :1
-MAP
+MAP
=VAL :item
=VAL :Basketball
=VAL :quantity
=VAL :4
-MAP
+MAP
=VAL :item
=VAL :Big Shoes
=VAL :quantity
=VAL :1
-MAP
-SEQ
-DOC
-STR
|
# 9WXW - Spec Example 6.18. Primary Tag Handle
|
|
# Private
!foo "bar"
...
# Global
%TAG ! tag:example.com,2000:app/
---
!foo "bar"
|
|
+STR
+DOC
=VAL <!foo> "bar
-DOC ...
+DOC ---
=VAL <tag:example.com,2000:app/foo> "bar
-DOC
-STR
|
# 9YRD - Multiline Scalar at Top Level
|
|
|
|
+STR
+DOC
=VAL :a b c d\ne
-DOC
-STR
|
# A2M4 - Spec Example 6.2. Indentation Indicators
|
Tags:
explicit-key, indent, libyaml-err, sequence, spec, upto-1.2, whitespace
Source
Test Results
|
|
{
"a": [
"b",
[
"c",
"d"
]
]
}
|
+STR
+DOC
+MAP
=VAL :a
+SEQ
=VAL :b
+SEQ
=VAL :c
=VAL :d
-SEQ
-SEQ
-MAP
-DOC
-STR
|
# A6F9 - Spec Example 8.4. Chomping Final Line Break
|
|
strip: |-
text
clip: |
text
keep: |+
text
|
{
"strip": "text",
"clip": "text\n",
"keep": "text\n"
}
|
+STR
+DOC
+MAP
=VAL :strip
=VAL |text
=VAL :clip
=VAL |text\n
=VAL :keep
=VAL |text\n
-MAP
-DOC
-STR
|
# A984 - Multiline Scalar in Mapping
|
|
|
{
"a": "b c",
"d": "e f"
}
|
+STR
+DOC
+MAP
=VAL :a
=VAL :b c
=VAL :d
=VAL :e f
-MAP
-DOC
-STR
|
# AB8U - Sequence entry that looks like two with wrong indentation
|
|
- single multiline
- sequence entry
|
[
"single multiline - sequence entry"
]
|
+STR
+DOC
+SEQ
=VAL :single multiline - sequence entry
-SEQ
-DOC
-STR
|
# AVM7 - Empty Stream
|
|
|
|
|
# AZ63 - Sequence With Same Indentation as Parent Mapping
|
|
|
{
"one": [
2,
3
],
"four": 5
}
|
+STR
+DOC
+MAP
=VAL :one
+SEQ
=VAL :2
=VAL :3
-SEQ
=VAL :four
=VAL :5
-MAP
-DOC
-STR
|
# AZW3 - Lookahead test cases
|
|
- bla"keks: foo
- bla]keks: foo
|
[
{
"bla\"keks": "foo"
},
{
"bla]keks": "foo"
}
]
|
+STR
+DOC
+SEQ
+MAP
=VAL :bla"keks
=VAL :foo
-MAP
+MAP
=VAL :bla]keks
=VAL :foo
-MAP
-SEQ
-DOC
-STR
|
# B3HG - Spec Example 8.9. Folded Scalar [1.3]
|
|
|
|
+STR
+DOC ---
=VAL >folded text\n
-DOC
-STR
|
# BEC7 - Spec Example 6.14. “YAML” directive
|
|
%YAML 1.3 # Attempt parsing
# with a warning
---
"foo"
|
|
+STR
+DOC ---
=VAL "foo
-DOC
-STR
|
# BU8L - Node Anchor and Tag on Seperate Lines
|
|
|
|
+STR
+DOC
+MAP
=VAL :key
+MAP &anchor <tag:yaml.org,2002:map>
=VAL :a
=VAL :b
-MAP
-MAP
-DOC
-STR
|
# C2DT - Spec Example 7.18. Flow Mapping Adjacent Values
|
|
{
"adjacent":value,
"readable": value,
"empty":
}
|
{
"adjacent": "value",
"readable": "value",
"empty": null
}
|
+STR
+DOC
+MAP {}
=VAL "adjacent
=VAL :value
=VAL "readable
=VAL :value
=VAL "empty
=VAL :
-MAP
-DOC
-STR
|
# C4HZ - Spec Example 2.24. Global Tags
|
|
%TAG ! tag:clarkevans.com,2002:
--- !shape
# Use the ! handle for presenting
# tag:clarkevans.com,2002:circle
- !circle
center: &ORIGIN {x: 73, y: 129}
radius: 7
- !line
start: *ORIGIN
finish: { x: 89, y: 102 }
- !label
start: *ORIGIN
color: 0xFFEEBB
text: Pretty vector drawing.
|
[
{
"center": {
"x": 73,
"y": 129
},
"radius": 7
},
{
"start": {
"x": 73,
"y": 129
},
"finish": {
"x": 89,
"y": 102
}
},
{
"start": {
"x": 73,
"y": 129
},
"color": 16772795,
"text": "Pretty vector drawing."
}
]
|
+STR
+DOC ---
+SEQ <tag:clarkevans.com,2002:shape>
+MAP <tag:clarkevans.com,2002:circle>
=VAL :center
+MAP {} &ORIGIN
=VAL :x
=VAL :73
=VAL :y
=VAL :129
-MAP
=VAL :radius
=VAL :7
-MAP
+MAP <tag:clarkevans.com,2002:line>
=VAL :start
=ALI *ORIGIN
=VAL :finish
+MAP {}
=VAL :x
=VAL :89
=VAL :y
=VAL :102
-MAP
-MAP
+MAP <tag:clarkevans.com,2002:label>
=VAL :start
=ALI *ORIGIN
=VAL :color
=VAL :0xFFEEBB
=VAL :text
=VAL :Pretty vector drawing.
-MAP
-SEQ
-DOC
-STR
|
# CC74 - Spec Example 6.20. Tag Handles
|
|
%TAG !e! tag:example.com,2000:app/
---
!e!foo "bar"
|
|
+STR
+DOC ---
=VAL <tag:example.com,2000:app/foo> "bar
-DOC
-STR
|
# CFD4 - Empty implicit key in single pair flow sequences
|
|
- [ : empty key ]
- [: another empty key]
|
|
+STR
+DOC
+SEQ
+SEQ []
+MAP {}
=VAL :
=VAL :empty key
-MAP
-SEQ
+SEQ []
+MAP {}
=VAL :
=VAL :another empty key
-MAP
-SEQ
-SEQ
-DOC
-STR
|
# CN3R - Various location of anchors in flow sequence
|
|
&flowseq [
a: b,
&c c: d,
{ &e e: f },
&g { g: h }
]
|
[
{
"a": "b"
},
{
"c": "d"
},
{
"e": "f"
},
{
"g": "h"
}
]
|
+STR
+DOC
+SEQ [] &flowseq
+MAP {}
=VAL :a
=VAL :b
-MAP
+MAP {}
=VAL &c :c
=VAL :d
-MAP
+MAP {}
=VAL &e :e
=VAL :f
-MAP
+MAP {} &g
=VAL :g
=VAL :h
-MAP
-SEQ
-DOC
-STR
|
# CPZ3 - Doublequoted scalar starting with a tab
|
|
|
|
+STR
+DOC ---
+MAP
=VAL :tab
=VAL "\tstring
-MAP
-DOC
-STR
|
# CT4Q - Spec Example 7.20. Single Pair Explicit Entry
|
|
|
|
+STR
+DOC
+SEQ []
+MAP {}
=VAL :foo bar
=VAL :baz
-MAP
-SEQ
-DOC
-STR
|
# CUP7 - Spec Example 5.6. Node Property Indicators
|
|
anchored: !local &anchor value
alias: *anchor
|
{
"anchored": "value",
"alias": "value"
}
|
+STR
+DOC
+MAP
=VAL :anchored
=VAL &anchor <!local> :value
=VAL :alias
=ALI *anchor
-MAP
-DOC
-STR
|
# D83L - Block scalar indicator order
|
|
- |2-
explicit indent and chomp
- |-2
chomp and explicit indent
|
[
"explicit indent and chomp",
"chomp and explicit indent"
]
|
+STR
+DOC
+SEQ
=VAL |explicit indent and chomp
=VAL |chomp and explicit indent
-SEQ
-DOC
-STR
|
# D88J - Flow Sequence in Block Mapping
|
|
|
|
+STR
+DOC
+MAP
=VAL :a
+SEQ []
=VAL :b
=VAL :c
-SEQ
-MAP
-DOC
-STR
|
# D9TU - Single Pair Block Mapping
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL :bar
-MAP
-DOC
-STR
|
# DBG4 - Spec Example 7.10. Plain Characters
|
|
# Outside flow collection:
- ::vector
- ": - ()"
- Up, up, and away!
- -123
- http://example.com/foo#bar
# Inside flow collection:
- [ ::vector,
": - ()",
"Up, up and away!",
-123,
http://example.com/foo#bar ]
|
[
"::vector",
": - ()",
"Up, up, and away!",
-123,
"http://example.com/foo#bar",
[
"::vector",
": - ()",
"Up, up and away!",
-123,
"http://example.com/foo#bar"
]
]
|
+STR
+DOC
+SEQ
=VAL :::vector
=VAL ": - ()
=VAL :Up, up, and away!
=VAL :-123
=VAL :http://example.com/foo#bar
+SEQ []
=VAL :::vector
=VAL ": - ()
=VAL "Up, up and away!
=VAL :-123
=VAL :http://example.com/foo#bar
-SEQ
-SEQ
-DOC
-STR
|
# DC7X - Various trailing tabs
|
|
|
{
"a": "b",
"seq": [
"a"
],
"c": "d"
}
|
+STR
+DOC
+MAP
=VAL :a
=VAL :b
=VAL :seq
+SEQ
=VAL :a
-SEQ
=VAL :c
=VAL :d
-MAP
-DOC
-STR
|
# DE56:00 - Trailing tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "1 trailing\t tab
-DOC
-STR
|
# DE56:01 - Trailing tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "2 trailing\t tab
-DOC
-STR
|
# DE56:02 - Trailing tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "3 trailing\t tab
-DOC
-STR
|
# DE56:03 - Trailing tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "4 trailing\t tab
-DOC
-STR
|
# DE56:04 - Trailing tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "5 trailing tab
-DOC
-STR
|
# DE56:05 - Trailing tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "6 trailing tab
-DOC
-STR
|
# DFF7 - Spec Example 7.16. Flow Mapping Entries
|
|
{
? explicit: entry,
implicit: entry,
?
}
|
|
+STR
+DOC
+MAP {}
=VAL :explicit
=VAL :entry
=VAL :implicit
=VAL :entry
=VAL :
=VAL :
-MAP
-DOC
-STR
|
# DHP8 - Flow Sequence
|
|
|
|
+STR
+DOC
+SEQ []
=VAL :foo
=VAL :bar
=VAL :42
-SEQ
-DOC
-STR
|
# DK3J - Zero indented block scalar with line that looks like a comment
|
|
--- >
line1
# no comment
line3
|
"line1 # no comment line3\n"
|
+STR
+DOC ---
=VAL >line1 # no comment line3\n
-DOC
-STR
|
# DK95:00 - Tabs that look like indentation
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL :bar
-MAP
-DOC
-STR
|
# DK95:02 - Tabs that look like indentation
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL "bar baz
-MAP
-DOC
-STR
|
# DK95:03 - Tabs that look like indentation
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL :1
-MAP
-DOC
-STR
|
# DK95:04 - Tabs that look like indentation
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL :1
=VAL :bar
=VAL :2
-MAP
-DOC
-STR
|
# DK95:05 - Tabs that look like indentation
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL :1
=VAL :bar
=VAL :2
-MAP
-DOC
-STR
|
# DK95:07 - Tabs that look like indentation
|
|
|
|
+STR
+DOC ---
=VAL :
-DOC
-STR
|
# DK95:08 - Tabs that look like indentation
|
|
|
{
"foo" : "bar baz \t \t "
}
|
+STR
+DOC
+MAP
=VAL :foo
=VAL "bar baz \t \t
-MAP
-DOC
-STR
|
# DWX9 - Spec Example 8.8. Literal Content
|
|
|
"\n\nliteral\n \n\ntext\n"
|
+STR
+DOC
=VAL |\n\nliteral\n \n\ntext\n
-DOC
-STR
|
# E76Z - Aliases in Implicit Block Mapping
|
|
|
|
+STR
+DOC
+MAP
=VAL &a :a
=VAL &b :b
=ALI *b
=ALI *a
-MAP
-DOC
-STR
|
# EHF6 - Tags for Flow Objects
|
|
!!map {
k: !!seq
[ a, !!str b]
}
|
|
+STR
+DOC
+MAP {} <tag:yaml.org,2002:map>
=VAL :k
+SEQ [] <tag:yaml.org,2002:seq>
=VAL :a
=VAL <tag:yaml.org,2002:str> :b
-SEQ
-MAP
-DOC
-STR
|
# EX5H - Multiline Scalar at Top Level [1.3]
|
|
|
|
+STR
+DOC ---
=VAL :a b c d\ne
-DOC
-STR
|
# EXG3 - Three dashes and content without space [1.3]
|
|
|
|
+STR
+DOC ---
=VAL :---word1 word2
-DOC
-STR
|
# F2C7 - Anchors and Tags
|
|
- &a !!str a
- !!int 2
- !!int &c 4
- &d d
|
|
+STR
+DOC
+SEQ
=VAL &a <tag:yaml.org,2002:str> :a
=VAL <tag:yaml.org,2002:int> :2
=VAL &c <tag:yaml.org,2002:int> :4
=VAL &d :d
-SEQ
-DOC
-STR
|
# F3CP - Nested flow collections on one line
|
|
---
{ a: [b, c, { d: [e, f] } ] }
|
{
"a": [
"b",
"c",
{
"d": [
"e",
"f"
]
}
]
}
|
+STR
+DOC ---
+MAP {}
=VAL :a
+SEQ []
=VAL :b
=VAL :c
+MAP {}
=VAL :d
+SEQ []
=VAL :e
=VAL :f
-SEQ
-MAP
-SEQ
-MAP
-DOC
-STR
|
# F6MC - More indented lines at the beginning of folded block scalars
|
|
---
a: >2
more indented
regular
b: >2
more indented
regular
|
{
"a": " more indented\nregular\n",
"b": "\n\n more indented\nregular\n"
}
|
+STR
+DOC ---
+MAP
=VAL :a
=VAL > more indented\nregular\n
=VAL :b
=VAL >\n\n more indented\nregular\n
-MAP
-DOC
-STR
|
# F8F9 - Spec Example 8.5. Chomping Trailing Lines
|
|
# Strip
# Comments:
strip: |-
# text
# Clip
# comments:
clip: |
# text
# Keep
# comments:
keep: |+
# text
# Trail
# comments.
|
{
"strip": "# text",
"clip": "# text\n",
"keep": "# text\n\n"
}
|
+STR
+DOC
+MAP
=VAL :strip
=VAL |# text
=VAL :clip
=VAL |# text\n
=VAL :keep
=VAL |# text\n\n
-MAP
-DOC
-STR
|
# FBC9 - Allowed characters in plain scalars
|
|
safe: a!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~
!"#$%&'()*+,-./09:;<=>?@AZ[\]^_`az{|}~
safe question mark: ?foo
safe colon: :foo
safe dash: -foo
|
{
"safe": "a!\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~ !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~",
"safe question mark": "?foo",
"safe colon": ":foo",
"safe dash": "-foo"
}
|
+STR
+DOC
+MAP
=VAL :safe
=VAL :a!"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~ !"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~
=VAL :safe question mark
=VAL :?foo
=VAL :safe colon
=VAL ::foo
=VAL :safe dash
=VAL :-foo
-MAP
-DOC
-STR
|
# FH7J - Tags on Empty Scalars
|
|
- !!str
-
!!null : a
b: !!str
- !!str : !!null
|
|
+STR
+DOC
+SEQ
=VAL <tag:yaml.org,2002:str> :
+MAP
=VAL <tag:yaml.org,2002:null> :
=VAL :a
=VAL :b
=VAL <tag:yaml.org,2002:str> :
-MAP
+MAP
=VAL <tag:yaml.org,2002:str> :
=VAL <tag:yaml.org,2002:null> :
-MAP
-SEQ
-DOC
-STR
|
# FP8R - Zero indented block scalar
|
|
|
|
+STR
+DOC ---
=VAL >line1 line2 line3\n
-DOC
-STR
|
# FQ7F - Spec Example 2.1. Sequence of Scalars
|
|
- Mark McGwire
- Sammy Sosa
- Ken Griffey
|
[
"Mark McGwire",
"Sammy Sosa",
"Ken Griffey"
]
|
+STR
+DOC
+SEQ
=VAL :Mark McGwire
=VAL :Sammy Sosa
=VAL :Ken Griffey
-SEQ
-DOC
-STR
|
# FRK4 - Spec Example 7.3. Completely Empty Flow Nodes
|
|
|
|
+STR
+DOC
+MAP {}
=VAL :foo
=VAL :
=VAL :
=VAL :bar
-MAP
-DOC
-STR
|
# FTA2 - Single block sequence with anchor and explicit document start
|
|
|
|
+STR
+DOC ---
+SEQ &sequence
=VAL :a
-SEQ
-DOC
-STR
|
# FUP4 - Flow Sequence in Flow Sequence
|
|
|
|
+STR
+DOC
+SEQ []
=VAL :a
+SEQ []
=VAL :b
=VAL :c
-SEQ
-SEQ
-DOC
-STR
|
# G4RS - Spec Example 2.17. Quoted Scalars
|
|
unicode: "Sosa did fine.\u263A"
control: "\b1998\t1999\t2000\n"
hex esc: "\x0d\x0a is \r\n"
single: '"Howdy!" he cried.'
quoted: ' # Not a ''comment''.'
tie-fighter: '|\-*-/|'
|
{
"unicode": "Sosa did fine.☺",
"control": "\b1998\t1999\t2000\n",
"hex esc": "\r\n is \r\n",
"single": "\"Howdy!\" he cried.",
"quoted": " # Not a 'comment'.",
"tie-fighter": "|\\-*-/|"
}
|
+STR
+DOC
+MAP
=VAL :unicode
=VAL "Sosa did fine.☺
=VAL :control
=VAL "\b1998\t1999\t2000\n
=VAL :hex esc
=VAL "\r\n is \r\n
=VAL :single
=VAL '"Howdy!" he cried.
=VAL :quoted
=VAL ' # Not a 'comment'.
=VAL :tie-fighter
=VAL '|\\-*-/|
-MAP
-DOC
-STR
|
# G992 - Spec Example 8.9. Folded Scalar
|
|
|
|
+STR
+DOC
=VAL >folded text\n
-DOC
-STR
|
# GH63 - Mixed Block Mapping (explicit to implicit)
|
|
|
{
"a": 1.3,
"fifteen": "d"
}
|
+STR
+DOC
+MAP
=VAL :a
=VAL :1.3
=VAL :fifteen
=VAL :d
-MAP
-DOC
-STR
|
# H2RW - Blank lines
|
|
foo: 1
bar: 2
text: |
a
b
c
d
|
{
"foo": 1,
"bar": 2,
"text": "a\n \nb\n\nc\n\nd\n"
}
|
+STR
+DOC
+MAP
=VAL :foo
=VAL :1
=VAL :bar
=VAL :2
=VAL :text
=VAL |a\n \nb\n\nc\n\nd\n
-MAP
-DOC
-STR
|
# H3Z8 - Literal unicode
|
|
---
wanted: love ♥ and peace ☮
|
{
"wanted": "love ♥ and peace ☮"
}
|
+STR
+DOC ---
+MAP
=VAL :wanted
=VAL :love ♥ and peace ☮
-MAP
-DOC
-STR
|
# HM87:00 - Scalars in flow start with syntax char
|
|
|
|
+STR
+DOC
+SEQ []
=VAL ::x
-SEQ
-DOC
-STR
|
# HM87:01 - Scalars in flow start with syntax char
|
|
|
|
+STR
+DOC
+SEQ []
=VAL :?x
-SEQ
-DOC
-STR
|
# HMK4 - Spec Example 2.16. Indentation determines scope
|
|
name: Mark McGwire
accomplishment: >
Mark set a major league
home run record in 1998.
stats: |
65 Home Runs
0.278 Batting Average
|
{
"name": "Mark McGwire",
"accomplishment": "Mark set a major league home run record in 1998.\n",
"stats": "65 Home Runs\n0.278 Batting Average\n"
}
|
+STR
+DOC
+MAP
=VAL :name
=VAL :Mark McGwire
=VAL :accomplishment
=VAL >Mark set a major league home run record in 1998.\n
=VAL :stats
=VAL |65 Home Runs\n0.278 Batting Average\n
-MAP
-DOC
-STR
|
# HMQ5 - Spec Example 6.23. Node Properties
|
|
!!str &a1 "foo":
!!str bar
&a2 baz : *a1
|
{
"foo": "bar",
"baz": "foo"
}
|
+STR
+DOC
+MAP
=VAL &a1 <tag:yaml.org,2002:str> "foo
=VAL <tag:yaml.org,2002:str> :bar
=VAL &a2 :baz
=ALI *a1
-MAP
-DOC
-STR
|
# HS5T - Spec Example 7.12. Plain Lines
|
|
1st non-empty
2nd non-empty
3rd non-empty
|
"1st non-empty\n2nd non-empty 3rd non-empty"
|
+STR
+DOC
=VAL :1st non-empty\n2nd non-empty 3rd non-empty
-DOC
-STR
|
# HWV9 - Document-end marker
|
|
|
|
|
# J3BT - Spec Example 5.12. Tabs and Spaces
|
|
# Tabs and spaces
quoted: "Quoted "
block: |
void main() {
printf("Hello, world!\n");
}
|
{
"quoted": "Quoted \t",
"block": "void main() {\n\tprintf(\"Hello, world!\\n\");\n}\n"
}
|
+STR
+DOC
+MAP
=VAL :quoted
=VAL "Quoted \t
=VAL :block
=VAL |void main() {\n\tprintf("Hello, world!\\n");\n}\n
-MAP
-DOC
-STR
|
# J5UC - Multiple Pair Block Mapping
|
|
foo: blue
bar: arrr
baz: jazz
|
{
"foo": "blue",
"bar": "arrr",
"baz": "jazz"
}
|
+STR
+DOC
+MAP
=VAL :foo
=VAL :blue
=VAL :bar
=VAL :arrr
=VAL :baz
=VAL :jazz
-MAP
-DOC
-STR
|
# J7PZ - Spec Example 2.26. Ordered Mappings
|
|
# The !!omap tag is one of the optional types
# introduced for YAML 1.1. In 1.2, it is not
# part of the standard tags and should not be
# enabled by default.
# Ordered maps are represented as
# A sequence of mappings, with
# each mapping having one key
--- !!omap
- Mark McGwire: 65
- Sammy Sosa: 63
- Ken Griffy: 58
|
[
{
"Mark McGwire": 65
},
{
"Sammy Sosa": 63
},
{
"Ken Griffy": 58
}
]
|
+STR
+DOC ---
+SEQ <tag:yaml.org,2002:omap>
+MAP
=VAL :Mark McGwire
=VAL :65
-MAP
+MAP
=VAL :Sammy Sosa
=VAL :63
-MAP
+MAP
=VAL :Ken Griffy
=VAL :58
-MAP
-SEQ
-DOC
-STR
|
# J7VC - Empty Lines Between Mapping Elements
|
|
|
|
+STR
+DOC
+MAP
=VAL :one
=VAL :2
=VAL :three
=VAL :4
-MAP
-DOC
-STR
|
# J9HZ - Spec Example 2.9. Single Document with Two Comments
|
|
---
hr: # 1998 hr ranking
- Mark McGwire
- Sammy Sosa
rbi:
# 1998 rbi ranking
- Sammy Sosa
- Ken Griffey
|
{
"hr": [
"Mark McGwire",
"Sammy Sosa"
],
"rbi": [
"Sammy Sosa",
"Ken Griffey"
]
}
|
+STR
+DOC ---
+MAP
=VAL :hr
+SEQ
=VAL :Mark McGwire
=VAL :Sammy Sosa
-SEQ
=VAL :rbi
+SEQ
=VAL :Sammy Sosa
=VAL :Ken Griffey
-SEQ
-MAP
-DOC
-STR
|
# JEF9:00 - Trailing whitespace in streams
|
|
|
|
+STR
+DOC
+SEQ
=VAL |\n\n
-SEQ
-DOC
-STR
|
# JEF9:01 - Trailing whitespace in streams
|
|
|
|
+STR
+DOC
+SEQ
=VAL |\n
-SEQ
-DOC
-STR
|
# JEF9:02 - Trailing whitespace in streams
|
|
|
|
+STR
+DOC
+SEQ
=VAL |\n
-SEQ
-DOC
-STR
|
# JHB9 - Spec Example 2.7. Two Documents in a Stream
|
|
# Ranking of 1998 home runs
---
- Mark McGwire
- Sammy Sosa
- Ken Griffey
# Team ranking
---
- Chicago Cubs
- St Louis Cardinals
|
[
"Mark McGwire",
"Sammy Sosa",
"Ken Griffey"
]
[
"Chicago Cubs",
"St Louis Cardinals"
]
|
+STR
+DOC ---
+SEQ
=VAL :Mark McGwire
=VAL :Sammy Sosa
=VAL :Ken Griffey
-SEQ
-DOC
+DOC ---
+SEQ
=VAL :Chicago Cubs
=VAL :St Louis Cardinals
-SEQ
-DOC
-STR
|
# JQ4R - Spec Example 8.14. Block Sequence
|
|
block sequence:
- one
- two : three
|
{
"block sequence": [
"one",
{
"two": "three"
}
]
}
|
+STR
+DOC
+MAP
=VAL :block sequence
+SEQ
=VAL :one
+MAP
=VAL :two
=VAL :three
-MAP
-SEQ
-MAP
-DOC
-STR
|
# JR7V - Question marks in scalars
|
|
- a?string
- another ? string
- key: value?
- [a?string]
- [another ? string]
- {key: value? }
- {key: value?}
- {key?: value }
|
[
"a?string",
"another ? string",
{
"key": "value?"
},
[
"a?string"
],
[
"another ? string"
],
{
"key": "value?"
},
{
"key": "value?"
},
{
"key?": "value"
}
]
|
+STR
+DOC
+SEQ
=VAL :a?string
=VAL :another ? string
+MAP
=VAL :key
=VAL :value?
-MAP
+SEQ []
=VAL :a?string
-SEQ
+SEQ []
=VAL :another ? string
-SEQ
+MAP {}
=VAL :key
=VAL :value?
-MAP
+MAP {}
=VAL :key
=VAL :value?
-MAP
+MAP {}
=VAL :key?
=VAL :value
-MAP
-SEQ
-DOC
-STR
|
# JS2J - Spec Example 6.29. Node Anchors
|
|
First occurrence: &anchor Value
Second occurrence: *anchor
|
{
"First occurrence": "Value",
"Second occurrence": "Value"
}
|
+STR
+DOC
+MAP
=VAL :First occurrence
=VAL &anchor :Value
=VAL :Second occurrence
=ALI *anchor
-MAP
-DOC
-STR
|
# JTV5 - Block Mapping with Multiline Scalars
|
|
|
{
"a true": "null d",
"e 42": null
}
|
+STR
+DOC
+MAP
=VAL :a true
=VAL :null d
=VAL :e 42
=VAL :
-MAP
-DOC
-STR
|
# K3WX - Colon and adjacent value after comment on next line
|
|
---
{ "foo" # comment
:bar }
|
|
+STR
+DOC ---
+MAP {}
=VAL "foo
=VAL :bar
-MAP
-DOC
-STR
|
# K4SU - Multiple Entry Block Sequence
|
|
|
|
+STR
+DOC
+SEQ
=VAL :foo
=VAL :bar
=VAL :42
-SEQ
-DOC
-STR
|
# K527 - Spec Example 6.6. Line Folding
|
|
|
|
+STR
+DOC
=VAL >trimmed\n\n\nas space
-DOC
-STR
|
# K54U - Tab after document header
|
|
|
|
+STR
+DOC ---
=VAL :scalar
-DOC
-STR
|
# K858 - Spec Example 8.6. Empty Scalar Chomping
|
|
strip: >-
clip: >
keep: |+
|
{
"strip": "",
"clip": "",
"keep": "\n"
}
|
+STR
+DOC
+MAP
=VAL :strip
=VAL >
=VAL :clip
=VAL >
=VAL :keep
=VAL |\n
-MAP
-DOC
-STR
|
# KH5V:00 - Inline tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "1 inline\ttab
-DOC
-STR
|
# KH5V:01 - Inline tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "2 inline\ttab
-DOC
-STR
|
# KH5V:02 - Inline tabs in double quoted
|
|
|
|
+STR
+DOC
=VAL "3 inline\ttab
-DOC
-STR
|
# KK5P - Various combinations of explicit block mappings
|
|
complex1:
? - a
complex2:
? - a
: b
complex3:
? - a
: >
b
complex4:
? >
a
:
complex5:
? - a
: - b
|
|
+STR
+DOC
+MAP
=VAL :complex1
+MAP
+SEQ
=VAL :a
-SEQ
=VAL :
-MAP
=VAL :complex2
+MAP
+SEQ
=VAL :a
-SEQ
=VAL :b
-MAP
=VAL :complex3
+MAP
+SEQ
=VAL :a
-SEQ
=VAL >b\n
-MAP
=VAL :complex4
+MAP
=VAL >a\n
=VAL :
-MAP
=VAL :complex5
+MAP
+SEQ
=VAL :a
-SEQ
+SEQ
=VAL :b
-SEQ
-MAP
-MAP
-DOC
-STR
|
# KMK3 - Block Submapping
|
|
|
{
"foo": {
"bar": 1
},
"baz": 2
}
|
+STR
+DOC
+MAP
=VAL :foo
+MAP
=VAL :bar
=VAL :1
-MAP
=VAL :baz
=VAL :2
-MAP
-DOC
-STR
|
# KSS4 - Scalars on --- line
|
|
--- "quoted
string"
--- &node foo
|
|
+STR
+DOC ---
=VAL "quoted string
-DOC
+DOC ---
=VAL &node :foo
-DOC
-STR
|
# L24T:00 - Trailing line of spaces
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL |x\n \n
-MAP
-DOC
-STR
|
# L24T:01 - Trailing line of spaces
|
|
|
|
+STR
+DOC
+MAP
=VAL :foo
=VAL |x\n \n
-MAP
-DOC
-STR
|
# L383 - Two scalar docs with trailing comments
|
|
--- foo # comment
--- foo # comment
|
|
+STR
+DOC ---
=VAL :foo
-DOC
+DOC ---
=VAL :foo
-DOC
-STR
|
# L94M - Tags in Explicit Mapping
|
|
? !!str a
: !!int 47
? c
: !!str d
|
|
+STR
+DOC
+MAP
=VAL <tag:yaml.org,2002:str> :a
=VAL <tag:yaml.org,2002:int> :47
=VAL :c
=VAL <tag:yaml.org,2002:str> :d
-MAP
-DOC
-STR
|
# L9U5 - Spec Example 7.11. Plain Implicit Keys
|
|
implicit block key : [
implicit flow key : value,
]
|
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
|
+STR
+DOC
+MAP
=VAL :implicit block key
+SEQ []
+MAP {}
=VAL :implicit flow key
=VAL :value
-MAP
-SEQ
-MAP
-DOC
-STR
|
# LE5A - Spec Example 7.24. Flow Nodes
|
|
- !!str "a"
- 'b'
- &anchor "c"
- *anchor
- !!str
|
[
"a",
"b",
"c",
"c",
""
]
|
+STR
+DOC
+SEQ
=VAL <tag:yaml.org,2002:str> "a
=VAL 'b
=VAL &anchor "c
=ALI *anchor
=VAL <tag:yaml.org,2002:str> :
-SEQ
-DOC
-STR
|
# LP6E - Whitespace After Scalars in Flow
|
|
- [a, b , c ]
- { "a" : b
, c : 'd' ,
e : "f"
}
- [ ]
|
[
[
"a",
"b",
"c"
],
{
"a": "b",
"c": "d",
"e": "f"
},
[]
]
|
+STR
+DOC
+SEQ
+SEQ []
=VAL :a
=VAL :b
=VAL :c
-SEQ
+MAP {}
=VAL "a
=VAL :b
=VAL :c
=VAL 'd
=VAL :e
=VAL "f
-MAP
+SEQ []
-SEQ
-SEQ
-DOC
-STR
|
# LQZ7 - Spec Example 7.4. Double Quoted Implicit Keys
|
|
"implicit block key" : [
"implicit flow key" : value,
]
|
{
"implicit block key": [
{
"implicit flow key": "value"
}
]
}
|
+STR
+DOC
+MAP
=VAL "implicit block key
+SEQ []
+MAP {}
=VAL "implicit flow key
=VAL :value
-MAP
-SEQ
-MAP
-DOC
-STR
|
# LX3P - Implicit Flow Mapping Key on one line
|
|
|
|
+STR
+DOC
+MAP
+SEQ []
=VAL :flow
-SEQ
=VAL :block
-MAP
-DOC
-STR
|
# M29M - Literal Block Scalar
|
|
|
{
"a": "ab\n\ncd\nef\n"
}
|
+STR
+DOC
+MAP
=VAL :a
=VAL |ab\n\ncd\nef\n
-MAP
-DOC ...
-STR
|
# M2N8:00 - Question mark edge cases
|
|
|
|
+STR
+DOC
+SEQ
+MAP
+MAP
=VAL :
=VAL :x
-MAP
=VAL :
-MAP
-SEQ
-DOC
-STR
|
# M2N8:01 - Question mark edge cases
|
|
|
|
+STR
+DOC
+MAP
+MAP
+SEQ []
-SEQ
=VAL :x
-MAP
=VAL :
-MAP
-DOC
-STR
|
# M5C3 - Spec Example 8.21. Block Scalar Nodes
|
|
literal: |2
value
folded:
!foo
>1
value
|
{
"literal": "value\n",
"folded": "value\n"
}
|
+STR
+DOC
+MAP
=VAL :literal
=VAL |value\n
=VAL :folded
=VAL <!foo> >value\n
-MAP
-DOC
-STR
|
# M5DY - Spec Example 2.11. Mapping between Sequences
|
|
? - Detroit Tigers
- Chicago cubs
:
- 2001-07-23
? [ New York Yankees,
Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
2001-08-14 ]
|
|
+STR
+DOC
+MAP
+SEQ
=VAL :Detroit Tigers
=VAL :Chicago cubs
-SEQ
+SEQ
=VAL :2001-07-23
-SEQ
+SEQ []
=VAL :New York Yankees
=VAL :Atlanta Braves
-SEQ
+SEQ []
=VAL :2001-07-02
=VAL :2001-08-12
=VAL :2001-08-14
-SEQ
-MAP
-DOC
-STR
|
# M6YH - Block sequence indentation
|
|
|
[
"x\n",
{
"foo" : "bar"
},
[
42
]
]
|
+STR
+DOC
+SEQ
=VAL |x\n
+MAP
=VAL :foo
=VAL :bar
-MAP
+SEQ
=VAL :42
-SEQ
-SEQ
-DOC
-STR
|
# M7A3 - Spec Example 9.3. Bare Documents
|
|
Bare
document
...
# No document
...
|
%!PS-Adobe-2.0 # Not the first line
|
"Bare document"
"%!PS-Adobe-2.0 # Not the first line\n"
|
+STR
+DOC
=VAL :Bare document
-DOC ...
+DOC
=VAL |%!PS-Adobe-2.0 # Not the first line\n
-DOC
-STR
|
# M7NX - Nested flow collections
|
|
---
{
a: [
b, c, {
d: [e, f]
}
]
}
|
{
"a": [
"b",
"c",
{
"d": [
"e",
"f"
]
}
]
}
|
+STR
+DOC ---
+MAP {}
=VAL :a
+SEQ []
=VAL :b
=VAL :c
+MAP {}
=VAL :d
+SEQ []
=VAL :e
=VAL :f
-SEQ
-MAP
-SEQ
-MAP
-DOC
-STR
|
# M9B4 - Spec Example 8.7. Literal Scalar
|
|
|
|
+STR
+DOC
=VAL |literal\n\ttext\n
-DOC
-STR
|
# MJS9 - Spec Example 6.7. Block Folding
|
|
|
"foo \n\n\t bar\n\nbaz\n"
|
+STR
+DOC
=VAL >foo \n\n\t bar\n\nbaz\n
-DOC
-STR
|
# MUS6:02 - Directive variants
|
|
|
|
+STR
+DOC ---
=VAL :
-DOC
-STR
|
# MUS6:03 - Directive variants
|
|
|
|
+STR
+DOC ---
=VAL :
-DOC
-STR
|
# MUS6:04 - Directive variants
|
|
|
|
+STR
+DOC ---
=VAL :
-DOC
-STR
|
# MUS6:05 - Directive variants
|
|
|
|
+STR
+DOC ---
=VAL :
-DOC
-STR
|
# MUS6:06 - Directive variants
|
|
|
|
+STR
+DOC ---
=VAL :
-DOC
-STR
|
# MXS3 - Flow Mapping in Block Sequence
|
|
|
|
+STR
+DOC
+SEQ
+MAP {}
=VAL :a
=VAL :b
-MAP
-SEQ
-DOC
-STR
|
# MYW6 - Block Scalar Strip
|
|
|
|
+STR
+DOC
=VAL |ab
-DOC ...
-STR
|
# MZX3 - Non-Specific Tags on Scalars
|
|
- plain
- "double quoted"
- 'single quoted'
- >
block
- plain again
|
[
"plain",
"double quoted",
"single quoted",
"block\n",
"plain again"
]
|
+STR
+DOC
+SEQ
=VAL :plain
=VAL "double quoted
=VAL 'single quoted
=VAL >block\n
=VAL :plain again
-SEQ
-DOC
-STR
|
# NAT4 - Various empty or newline only quoted strings
|
|
---
a: '
'
b: '
'
c: "
"
d: "
"
e: '
'
f: "
"
g: '
'
h: "
"
|
{
"a": " ",
"b": " ",
"c": " ",
"d": " ",
"e": "\n",
"f": "\n",
"g": "\n\n",
"h": "\n\n"
}
|
+STR
+DOC ---
+MAP
=VAL :a
=VAL '
=VAL :b
=VAL '
=VAL :c
=VAL "
=VAL :d
=VAL "
=VAL :e
=VAL '\n
=VAL :f
=VAL "\n
=VAL :g
=VAL '\n\n
=VAL :h
=VAL "\n\n
-MAP
-DOC
-STR
|
# NB6Z - Multiline plain value with tabs on empty lines
|
|
|
{
"key": "value with\ntabs"
}
|
+STR
+DOC
+MAP
=VAL :key
=VAL :value with\ntabs
-MAP
-DOC
-STR
|
# NHX8 - Empty Lines at End of Document
|
|
|
|
+STR
+DOC
+MAP
=VAL :
=VAL :
-MAP
-DOC
-STR
|
# NJ66 - Multiline plain flow mapping key
|
|
---
- { single line: value}
- { multi
line: value}
|
[
{
"single line": "value"
},
{
"multi line": "value"
}
]
|
+STR
+DOC ---
+SEQ
+MAP {}
=VAL :single line
=VAL :value
-MAP
+MAP {}
=VAL :multi line
=VAL :value
-MAP
-SEQ
-DOC
-STR
|
# NKF9 - Empty keys in block and flow mapping
|
|
---
key: value
: empty key
---
{
key: value, : empty key
}
---
# empty key and value
:
---
# empty key and value
{ : }
|
|
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
=VAL :
=VAL :empty key
-MAP
-DOC
+DOC ---
+MAP {}
=VAL :key
=VAL :value
=VAL :
=VAL :empty key
-MAP
-DOC
+DOC ---
+MAP
=VAL :
=VAL :
-MAP
-DOC
+DOC ---
+MAP {}
=VAL :
=VAL :
-MAP
-DOC
-STR
|
# NP9H - Spec Example 7.5. Double Quoted Line Breaks
|
|
"folded
to a space,
to a line feed, or \
\ non-content"
|
"folded to a space,\nto a line feed, or \t \tnon-content"
|
+STR
+DOC
=VAL "folded to a space,\nto a line feed, or \t \tnon-content
-DOC
-STR
|
# P2AD - Spec Example 8.1. Block Scalar Header
|
|
- | # Empty header↓
literal
- >1 # Indentation indicator↓
folded
- |+ # Chomping indicator↓
keep
- >1- # Both indicators↓
strip
|
[
"literal\n",
" folded\n",
"keep\n\n",
" strip"
]
|
+STR
+DOC
+SEQ
=VAL |literal\n
=VAL > folded\n
=VAL |keep\n\n
=VAL > strip
-SEQ
-DOC
-STR
|
# P76L - Spec Example 6.19. Secondary Tag Handle
|
|
%TAG !! tag:example.com,2000:app/
---
!!int 1 - 3 # Interval, not integer
|
|
+STR
+DOC ---
=VAL <tag:example.com,2000:app/int> :1 - 3
-DOC
-STR
|
# P94K - Spec Example 6.11. Multi-Line Comments
|
|
key: # Comment
# lines
value
|
|
+STR
+DOC
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR
|
# PBJ2 - Spec Example 2.3. Mapping Scalars to Sequences
|
|
american:
- Boston Red Sox
- Detroit Tigers
- New York Yankees
national:
- New York Mets
- Chicago Cubs
- Atlanta Braves
|
{
"american": [
"Boston Red Sox",
"Detroit Tigers",
"New York Yankees"
],
"national": [
"New York Mets",
"Chicago Cubs",
"Atlanta Braves"
]
}
|
+STR
+DOC
+MAP
=VAL :american
+SEQ
=VAL :Boston Red Sox
=VAL :Detroit Tigers
=VAL :New York Yankees
-SEQ
=VAL :national
+SEQ
=VAL :New York Mets
=VAL :Chicago Cubs
=VAL :Atlanta Braves
-SEQ
-MAP
-DOC
-STR
|
# PRH3 - Spec Example 7.9. Single Quoted Lines
|
|
' 1st non-empty
2nd non-empty
3rd non-empty '
|
" 1st non-empty\n2nd non-empty 3rd non-empty "
|
+STR
+DOC
=VAL ' 1st non-empty\n2nd non-empty 3rd non-empty
-DOC
-STR
|
# PUW8 - Document start on last line
|
|
|
|
+STR
+DOC ---
+MAP
=VAL :a
=VAL :b
-MAP
-DOC
+DOC ---
=VAL :
-DOC
-STR
|
# PW8X - Anchors on Empty Scalars
|
|
- &a
- a
-
&a : a
b: &b
-
&c : &a
-
? &d
-
? &e
: &a
|
|
+STR
+DOC
+SEQ
=VAL &a :
=VAL :a
+MAP
=VAL &a :
=VAL :a
=VAL :b
=VAL &b :
-MAP
+MAP
=VAL &c :
=VAL &a :
-MAP
+MAP
=VAL &d :
=VAL :
-MAP
+MAP
=VAL &e :
=VAL &a :
-MAP
-SEQ
-DOC
-STR
|
# Q5MG - Tab at beginning of line followed by a flow mapping
|
|
|
|
+STR
+DOC
+MAP {}
-MAP
-DOC
-STR
|
# Q88A - Spec Example 7.23. Flow Content
|
|
- [ a, b ]
- { a: b }
- "a"
- 'b'
- c
|
[
[
"a",
"b"
],
{
"a": "b"
},
"a",
"b",
"c"
]
|
+STR
+DOC
+SEQ
+SEQ []
=VAL :a
=VAL :b
-SEQ
+MAP {}
=VAL :a
=VAL :b
-MAP
=VAL "a
=VAL 'b
=VAL :c
-SEQ
-DOC
-STR
|
# Q8AD - Spec Example 7.5. Double Quoted Line Breaks [1.3]
|
|
---
"folded
to a space,
to a line feed, or \
\ non-content"
|
"folded to a space,\nto a line feed, or \t \tnon-content"
|
+STR
+DOC ---
=VAL "folded to a space,\nto a line feed, or \t \tnon-content
-DOC
-STR
|
# Q9WF - Spec Example 6.12. Separation Spaces
|
|
{ first: Sammy, last: Sosa }:
# Statistics:
hr: # Home runs
65
avg: # Average
0.278
|
|
+STR
+DOC
+MAP
+MAP {}
=VAL :first
=VAL :Sammy
=VAL :last
=VAL :Sosa
-MAP
+MAP
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
-MAP
-MAP
-DOC
-STR
|
# QF4Y - Spec Example 7.19. Single Pair Flow Mappings
|
|
|
|
+STR
+DOC
+SEQ []
+MAP {}
=VAL :foo
=VAL :bar
-MAP
-SEQ
-DOC
-STR
|
# QT73 - Comment and document-end marker
|
|
|
|
|
# R4YG - Spec Example 8.2. Block Indentation Indicator
|
Tags:
folded, libyaml-err, literal, scalar, spec, upto-1.2, whitespace
Source
Test Results
|
- |
detected
- >
# detected
- |1
explicit
- >
detected
|
[
"detected\n",
"\n\n# detected\n",
" explicit\n",
"\t\ndetected\n"
]
|
+STR
+DOC
+SEQ
=VAL |detected\n
=VAL >\n\n# detected\n
=VAL | explicit\n
=VAL >\t\ndetected\n
-SEQ
-DOC
-STR
|
# R52L - Nested flow mapping sequence and mappings
|
|
---
{ top1: [item1, {key2: value2}, item3], top2: value2 }
|
{
"top1": [
"item1",
{
"key2": "value2"
},
"item3"
],
"top2": "value2"
}
|
+STR
+DOC ---
+MAP {}
=VAL :top1
+SEQ []
=VAL :item1
+MAP {}
=VAL :key2
=VAL :value2
-MAP
=VAL :item3
-SEQ
=VAL :top2
=VAL :value2
-MAP
-DOC
-STR
|
# RLU9 - Sequence Indent
|
|
|
{
"foo": [
42
],
"bar": [
44
]
}
|
+STR
+DOC
+MAP
=VAL :foo
+SEQ
=VAL :42
-SEQ
=VAL :bar
+SEQ
=VAL :44
-SEQ
-MAP
-DOC
-STR
|
# RR7F - Mixed Block Mapping (implicit to explicit)
|
|
|
|
+STR
+DOC
+MAP
=VAL :a
=VAL :4.2
=VAL :d
=VAL :23
-MAP
-DOC
-STR
|
# RTP8 - Spec Example 9.2. Document Markers
|
|
%YAML 1.2
---
Document
... # Suffix
|
|
+STR
+DOC ---
=VAL :Document
-DOC ...
-STR
|
# RZP5 - Various Trailing Comments [1.3]
|
|
a: "double
quotes" # lala
b: plain
value # lala
c : #lala
d
? # lala
- seq1
: # lala
- #lala
seq2
e: &node # lala
- x: y
block: > # lala
abcde
|
|
+STR
+DOC
+MAP
=VAL :a
=VAL "double quotes
=VAL :b
=VAL :plain value
=VAL :c
=VAL :d
+SEQ
=VAL :seq1
-SEQ
+SEQ
=VAL :seq2
-SEQ
=VAL :e
+SEQ &node
+MAP
=VAL :x
=VAL :y
-MAP
-SEQ
=VAL :block
=VAL >abcde\n
-MAP
-DOC
-STR
|
# RZT7 - Spec Example 2.28. Log File
|
|
---
Time: 2001-11-23 15:01:42 -5
User: ed
Warning:
This is an error message
for the log file
---
Time: 2001-11-23 15:02:31 -5
User: ed
Warning:
A slightly different error
message.
---
Date: 2001-11-23 15:03:17 -5
User: ed
Fatal:
Unknown variable "bar"
Stack:
- file: TopClass.py
line: 23
code: |
x = MoreObject("345\n")
- file: MoreClass.py
line: 58
code: |-
foo = bar
|
{
"Time": "2001-11-23 15:01:42 -5",
"User": "ed",
"Warning": "This is an error message for the log file"
}
{
"Time": "2001-11-23 15:02:31 -5",
"User": "ed",
"Warning": "A slightly different error message."
}
{
"Date": "2001-11-23 15:03:17 -5",
"User": "ed",
"Fatal": "Unknown variable \"bar\"",
"Stack": [
{
"file": "TopClass.py",
"line": 23,
"code": "x = MoreObject(\"345\\n\")\n"
},
{
"file": "MoreClass.py",
"line": 58,
"code": "foo = bar"
}
]
}
|
+STR
+DOC ---
+MAP
=VAL :Time
=VAL :2001-11-23 15:01:42 -5
=VAL :User
=VAL :ed
=VAL :Warning
=VAL :This is an error message for the log file
-MAP
-DOC
+DOC ---
+MAP
=VAL :Time
=VAL :2001-11-23 15:02:31 -5
=VAL :User
=VAL :ed
=VAL :Warning
=VAL :A slightly different error message.
-MAP
-DOC
+DOC ---
+MAP
=VAL :Date
=VAL :2001-11-23 15:03:17 -5
=VAL :User
=VAL :ed
=VAL :Fatal
=VAL :Unknown variable "bar"
=VAL :Stack
+SEQ
+MAP
=VAL :file
=VAL :TopClass.py
=VAL :line
=VAL :23
=VAL :code
=VAL |x = MoreObject("345\\n")\n
-MAP
+MAP
=VAL :file
=VAL :MoreClass.py
=VAL :line
=VAL :58
=VAL :code
=VAL |foo = bar
-MAP
-SEQ
-MAP
-DOC
-STR
|
# S3PD - Spec Example 8.18. Implicit Block Mapping Entries
|
|
plain key: in-line value
: # Both empty
"quoted key":
- entry
|
|
+STR
+DOC
+MAP
=VAL :plain key
=VAL :in-line value
=VAL :
=VAL :
=VAL "quoted key
+SEQ
=VAL :entry
-SEQ
-MAP
-DOC
-STR
|
# S4JQ - Spec Example 6.28. Non-Specific Tags
|
|
# Assuming conventional resolution:
- "12"
- 12
- ! 12
|
|
+STR
+DOC
+SEQ
=VAL "12
=VAL :12
=VAL <!> :12
-SEQ
-DOC
-STR
|
# S4T7 - Document with footer
|
|
|
|
+STR
+DOC
+MAP
=VAL :aaa
=VAL :bbb
-MAP
-DOC ...
-STR
|
# S7BG - Colon followed by comma
|
|
|
|
+STR
+DOC ---
+SEQ
=VAL ::,
-SEQ
-DOC
-STR
|
# S9E8 - Spec Example 5.3. Block Structure Indicators
|
|
sequence:
- one
- two
mapping:
? sky
: blue
sea : green
|
{
"sequence": [
"one",
"two"
],
"mapping": {
"sky": "blue",
"sea": "green"
}
}
|
+STR
+DOC
+MAP
=VAL :sequence
+SEQ
=VAL :one
=VAL :two
-SEQ
=VAL :mapping
+MAP
=VAL :sky
=VAL :blue
=VAL :sea
=VAL :green
-MAP
-MAP
-DOC
-STR
|
# SBG9 - Flow Sequence in Flow Mapping
|
|
|
|
+STR
+DOC
+MAP {}
=VAL :a
+SEQ []
=VAL :b
=VAL :c
-SEQ
+SEQ []
=VAL :d
=VAL :e
-SEQ
=VAL :f
-MAP
-DOC
-STR
|
# SKE5 - Anchor before zero indented sequence
|
|
|
|
+STR
+DOC ---
+MAP
=VAL :seq
+SEQ &anchor
=VAL :a
=VAL :b
-SEQ
-MAP
-DOC
-STR
|
# SM9W:00 - Single character streams
|
|
|
|
+STR
+DOC
+SEQ
=VAL :
-SEQ
-DOC
-STR
|
# SM9W:01 - Single character streams
|
|
|
|
+STR
+DOC
+MAP
=VAL :
=VAL :
-MAP
-DOC
-STR
|
# SSW6 - Spec Example 7.7. Single Quoted Characters [1.3]
|
|
---
'here''s to "quotes"'
|
|
+STR
+DOC ---
=VAL 'here's to "quotes"
-DOC
-STR
|
# SYW4 - Spec Example 2.2. Mapping Scalars to Scalars
|
|
hr: 65 # Home runs
avg: 0.278 # Batting average
rbi: 147 # Runs Batted In
|
{
"hr": 65,
"avg": 0.278,
"rbi": 147
}
|
+STR
+DOC
+MAP
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
=VAL :rbi
=VAL :147
-MAP
-DOC
-STR
|
# T26H - Spec Example 8.8. Literal Content [1.3]
|
|
--- |
literal
text
# Comment
|
"\n\nliteral\n \n\ntext\n"
|
+STR
+DOC ---
=VAL |\n\nliteral\n \n\ntext\n
-DOC
-STR
|
# T4YY - Spec Example 7.9. Single Quoted Lines [1.3]
|
|
---
' 1st non-empty
2nd non-empty
3rd non-empty '
|
" 1st non-empty\n2nd non-empty 3rd non-empty "
|
+STR
+DOC ---
=VAL ' 1st non-empty\n2nd non-empty 3rd non-empty
-DOC
-STR
|
# T5N4 - Spec Example 8.7. Literal Scalar [1.3]
|
|
|
|
+STR
+DOC ---
=VAL |literal\n\ttext\n
-DOC
-STR
|
# TE2A - Spec Example 8.16. Block Mappings
|
|
block mapping:
key: value
|
{
"block mapping": {
"key": "value"
}
}
|
+STR
+DOC
+MAP
=VAL :block mapping
+MAP
=VAL :key
=VAL :value
-MAP
-MAP
-DOC
-STR
|
# TL85 - Spec Example 6.8. Flow Folding
|
|
|
|
+STR
+DOC
=VAL " foo\nbar\nbaz
-DOC
-STR
|
# TS54 - Folded Block Scalar
|
|
|
|
+STR
+DOC
=VAL >ab cd\nef\n\ngh\n
-DOC
-STR
|
# U3C3 - Spec Example 6.16. “TAG” directive
|
|
%TAG !yaml! tag:yaml.org,2002:
---
!yaml!str "foo"
|
|
+STR
+DOC ---
=VAL <tag:yaml.org,2002:str> "foo
-DOC
-STR
|
# U3XV - Node and Mapping Key Anchors
|
|
---
top1: &node1
&k1 key1: one
top2: &node2 # comment
key2: two
top3:
&k3 key3: three
top4:
&node4
&k4 key4: four
top5:
&node5
key5: five
top6: &val6
six
top7:
&val7 seven
|
{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}
|
+STR
+DOC ---
+MAP
=VAL :top1
+MAP &node1
=VAL &k1 :key1
=VAL :one
-MAP
=VAL :top2
+MAP &node2
=VAL :key2
=VAL :two
-MAP
=VAL :top3
+MAP
=VAL &k3 :key3
=VAL :three
-MAP
=VAL :top4
+MAP &node4
=VAL &k4 :key4
=VAL :four
-MAP
=VAL :top5
+MAP &node5
=VAL :key5
=VAL :five
-MAP
=VAL :top6
=VAL &val6 :six
=VAL :top7
=VAL &val7 :seven
-MAP
-DOC
-STR
|
# U9NS - Spec Example 2.8. Play by Play Feed from a Game
|
|
---
time: 20:03:20
player: Sammy Sosa
action: strike (miss)
...
---
time: 20:03:47
player: Sammy Sosa
action: grand slam
...
|
{
"time": "20:03:20",
"player": "Sammy Sosa",
"action": "strike (miss)"
}
{
"time": "20:03:47",
"player": "Sammy Sosa",
"action": "grand slam"
}
|
+STR
+DOC ---
+MAP
=VAL :time
=VAL :20:03:20
=VAL :player
=VAL :Sammy Sosa
=VAL :action
=VAL :strike (miss)
-MAP
-DOC ...
+DOC ---
+MAP
=VAL :time
=VAL :20:03:47
=VAL :player
=VAL :Sammy Sosa
=VAL :action
=VAL :grand slam
-MAP
-DOC ...
-STR
|
# UDM2 - Plain URL in flow mapping
|
|
- { url: http://example.org }
|
[
{
"url": "http://example.org"
}
]
|
+STR
+DOC
+SEQ
+MAP {}
=VAL :url
=VAL :http://example.org
-MAP
-SEQ
-DOC
-STR
|
# UDR7 - Spec Example 5.4. Flow Collection Indicators
|
|
sequence: [ one, two, ]
mapping: { sky: blue, sea: green }
|
{
"sequence": [
"one",
"two"
],
"mapping": {
"sky": "blue",
"sea": "green"
}
}
|
+STR
+DOC
+MAP
=VAL :sequence
+SEQ []
=VAL :one
=VAL :two
-SEQ
=VAL :mapping
+MAP {}
=VAL :sky
=VAL :blue
=VAL :sea
=VAL :green
-MAP
-MAP
-DOC
-STR
|
# UGM3 - Spec Example 2.27. Invoice
|
|
--- !<tag:clarkevans.com,2002:invoice>
invoice: 34843
date : 2001-01-23
bill-to: &id001
given : Chris
family : Dumars
address:
lines: |
458 Walkman Dr.
Suite #292
city : Royal Oak
state : MI
postal : 48046
ship-to: *id001
product:
- sku : BL394D
quantity : 4
description : Basketball
price : 450.00
- sku : BL4438H
quantity : 1
description : Super Hoop
price : 2392.00
tax : 251.42
total: 4443.52
comments:
Late afternoon is best.
Backup contact is Nancy
Billsmer @ 338-4338.
|
{
"invoice": 34843,
"date": "2001-01-23",
"bill-to": {
"given": "Chris",
"family": "Dumars",
"address": {
"lines": "458 Walkman Dr.\nSuite #292\n",
"city": "Royal Oak",
"state": "MI",
"postal": 48046
}
},
"ship-to": {
"given": "Chris",
"family": "Dumars",
"address": {
"lines": "458 Walkman Dr.\nSuite #292\n",
"city": "Royal Oak",
"state": "MI",
"postal": 48046
}
},
"product": [
{
"sku": "BL394D",
"quantity": 4,
"description": "Basketball",
"price": 450
},
{
"sku": "BL4438H",
"quantity": 1,
"description": "Super Hoop",
"price": 2392
}
],
"tax": 251.42,
"total": 4443.52,
"comments": "Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338."
}
|
+STR
+DOC ---
+MAP <tag:clarkevans.com,2002:invoice>
=VAL :invoice
=VAL :34843
=VAL :date
=VAL :2001-01-23
=VAL :bill-to
+MAP &id001
=VAL :given
=VAL :Chris
=VAL :family
=VAL :Dumars
=VAL :address
+MAP
=VAL :lines
=VAL |458 Walkman Dr.\nSuite #292\n
=VAL :city
=VAL :Royal Oak
=VAL :state
=VAL :MI
=VAL :postal
=VAL :48046
-MAP
-MAP
=VAL :ship-to
=ALI *id001
=VAL :product
+SEQ
+MAP
=VAL :sku
=VAL :BL394D
=VAL :quantity
=VAL :4
=VAL :description
=VAL :Basketball
=VAL :price
=VAL :450.00
-MAP
+MAP
=VAL :sku
=VAL :BL4438H
=VAL :quantity
=VAL :1
=VAL :description
=VAL :Super Hoop
=VAL :price
=VAL :2392.00
-MAP
-SEQ
=VAL :tax
=VAL :251.42
=VAL :total
=VAL :4443.52
=VAL :comments
=VAL :Late afternoon is best. Backup contact is Nancy Billsmer @ 338-4338.
-MAP
-DOC
-STR
|
# UKK6:00 - Syntax character edge cases
|
|
|
|
+STR
+DOC
+SEQ
+MAP
=VAL :
=VAL :
-MAP
-SEQ
-DOC
-STR
|
# UKK6:01 - Syntax character edge cases
|
|
|
|
+STR
+DOC
+MAP
=VAL ::
=VAL :
-MAP
-DOC
-STR
|
# UKK6:02 - Syntax character edge cases
|
|
|
|
+STR
+DOC
=VAL <!> :
-DOC
-STR
|
# UT92 - Spec Example 9.4. Explicit Documents
|
|
---
{ matches
% : 20 }
...
---
# Empty
...
|
|
+STR
+DOC ---
+MAP {}
=VAL :matches %
=VAL :20
-MAP
-DOC ...
+DOC ---
=VAL :
-DOC ...
-STR
|
# UV7Q - Legal tab after indentation
|
|
|
|
+STR
+DOC
+MAP
=VAL :x
+SEQ
=VAL :x x
-SEQ
-MAP
-DOC
-STR
|
# V55R - Aliases in Block Sequence
|
|
|
|
+STR
+DOC
+SEQ
=VAL &a :a
=VAL &b :b
=ALI *a
=ALI *b
-SEQ
-DOC
-STR
|
# V9D5 - Spec Example 8.19. Compact Block Mappings
|
|
- sun: yellow
- ? earth: blue
: moon: white
|
|
+STR
+DOC
+SEQ
+MAP
=VAL :sun
=VAL :yellow
-MAP
+MAP
+MAP
=VAL :earth
=VAL :blue
-MAP
+MAP
=VAL :moon
=VAL :white
-MAP
-MAP
-SEQ
-DOC
-STR
|
# VJP3:01 - Flow collections over many lines
|
|
|
|
+STR
+DOC
+MAP
=VAL :k
+MAP {}
=VAL :k
=VAL :v
-MAP
-MAP
-DOC
-STR
|
# W42U - Spec Example 8.15. Block Sequence Entry Types
|
|
- # Empty
- |
block node
- - one # Compact
- two # sequence
- one: two # Compact mapping
|
[
null,
"block node\n",
[
"one",
"two"
],
{
"one": "two"
}
]
|
+STR
+DOC
+SEQ
=VAL :
=VAL |block node\n
+SEQ
=VAL :one
=VAL :two
-SEQ
+MAP
=VAL :one
=VAL :two
-MAP
-SEQ
-DOC
-STR
|
# W4TN - Spec Example 9.5. Directives Documents
|
|
%YAML 1.2
--- |
%!PS-Adobe-2.0
...
%YAML 1.2
---
# Empty
...
|
|
+STR
+DOC ---
=VAL |%!PS-Adobe-2.0\n
-DOC ...
+DOC ---
=VAL :
-DOC ...
-STR
|
# W5VH - Allowed characters in alias
|
|
a: &:@*!$"<foo>: scalar a
b: *:@*!$"<foo>:
|
{
"a": "scalar a",
"b": "scalar a"
}
|
+STR
+DOC
+MAP
=VAL :a
=VAL &:@*!$"<foo>: :scalar a
=VAL :b
=ALI *:@*!$"<foo>:
-MAP
-DOC
-STR
|
# WZ62 - Spec Example 7.2. Empty Content
|
|
{
foo : !!str,
!!str : bar,
}
|
|
+STR
+DOC
+MAP {}
=VAL :foo
=VAL <tag:yaml.org,2002:str> :
=VAL <tag:yaml.org,2002:str> :
=VAL :bar
-MAP
-DOC
-STR
|
# X38W - Aliases in Flow Objects
|
|
{ &a [a, &b b]: *b, *a : [c, *b, d]}
|
|
+STR
+DOC
+MAP {}
+SEQ [] &a
=VAL :a
=VAL &b :b
-SEQ
=ALI *b
=ALI *a
+SEQ []
=VAL :c
=ALI *b
=VAL :d
-SEQ
-MAP
-DOC
-STR
|
# X8DW - Explicit key and value seperated by comment
|
|
---
? key
# comment
: value
|
|
+STR
+DOC ---
+MAP
=VAL :key
=VAL :value
-MAP
-DOC
-STR
|
# XLQ9 - Multiline scalar that looks like a YAML directive
|
|
|
|
+STR
+DOC ---
=VAL :scalar %YAML 1.2
-DOC
-STR
|
# XV9V - Spec Example 6.5. Empty Lines [1.3]
|
|
Folding:
"Empty line
as a line feed"
Chomping: |
Clipped empty lines
|
{
"Folding": "Empty line\nas a line feed",
"Chomping": "Clipped empty lines\n"
}
|
+STR
+DOC
+MAP
=VAL :Folding
=VAL "Empty line\nas a line feed
=VAL :Chomping
=VAL |Clipped empty lines\n
-MAP
-DOC
-STR
|
# XW4D - Various Trailing Comments
|
|
a: "double
quotes" # lala
b: plain
value # lala
c : #lala
d
? # lala
- seq1
: # lala
- #lala
seq2
e:
&node # lala
- x: y
block: > # lala
abcde
|
|
+STR
+DOC
+MAP
=VAL :a
=VAL "double quotes
=VAL :b
=VAL :plain value
=VAL :c
=VAL :d
+SEQ
=VAL :seq1
-SEQ
+SEQ
=VAL :seq2
-SEQ
=VAL :e
+SEQ &node
+MAP
=VAL :x
=VAL :y
-MAP
-SEQ
=VAL :block
=VAL >abcde\n
-MAP
-DOC
-STR
|
# Y2GN - Anchor with colon in the middle
|
|
|
|
+STR
+DOC ---
+MAP
=VAL :key
=VAL &an:chor :value
-MAP
-DOC
-STR
|
# Y79Y:001 - Tabs in various contexts
|
|
|
{
"foo": "\t\n",
"bar": 1
}
|
+STR
+DOC
+MAP
=VAL :foo
=VAL |\t\n
=VAL :bar
=VAL :1
-MAP
-DOC
-STR
|
# Y79Y:002 - Tabs in various contexts
|
|
|
|
+STR
+DOC
+SEQ
+SEQ []
=VAL :foo
-SEQ
-SEQ
-DOC
-STR
|
# Y79Y:010 - Tabs in various contexts
|
|
|
|
+STR
+DOC
+SEQ
=VAL :-1
-SEQ
-DOC
-STR
|
# YD5X - Spec Example 2.5. Sequence of Sequences
|
|
- [name , hr, avg ]
- [Mark McGwire, 65, 0.278]
- [Sammy Sosa , 63, 0.288]
|
[
[
"name",
"hr",
"avg"
],
[
"Mark McGwire",
65,
0.278
],
[
"Sammy Sosa",
63,
0.288
]
]
|
+STR
+DOC
+SEQ
+SEQ []
=VAL :name
=VAL :hr
=VAL :avg
-SEQ
+SEQ []
=VAL :Mark McGwire
=VAL :65
=VAL :0.278
-SEQ
+SEQ []
=VAL :Sammy Sosa
=VAL :63
=VAL :0.288
-SEQ
-SEQ
-DOC
-STR
|
# Z67P - Spec Example 8.21. Block Scalar Nodes [1.3]
|
|
literal: |2
value
folded: !foo >1
value
|
{
"literal": "value\n",
"folded": "value\n"
}
|
+STR
+DOC
+MAP
=VAL :literal
=VAL |value\n
=VAL :folded
=VAL <!foo> >value\n
-MAP
-DOC
-STR
|
# Z9M4 - Spec Example 6.22. Global Tag Prefix
|
|
%TAG !e! tag:example.com,2000:app/
---
- !e!foo "bar"
|
|
+STR
+DOC ---
+SEQ
=VAL <tag:example.com,2000:app/foo> "bar
-SEQ
-DOC
-STR
|
# ZF4X - Spec Example 2.6. Mapping of Mappings
|
|
Mark McGwire: {hr: 65, avg: 0.278}
Sammy Sosa: {
hr: 63,
avg: 0.288
}
|
{
"Mark McGwire": {
"hr": 65,
"avg": 0.278
},
"Sammy Sosa": {
"hr": 63,
"avg": 0.288
}
}
|
+STR
+DOC
+MAP
=VAL :Mark McGwire
+MAP {}
=VAL :hr
=VAL :65
=VAL :avg
=VAL :0.278
-MAP
=VAL :Sammy Sosa
+MAP {}
=VAL :hr
=VAL :63
=VAL :avg
=VAL :0.288
-MAP
-MAP
-DOC
-STR
|
# ZH7C - Anchors in Mapping
|
|
|
|
+STR
+DOC
+MAP
=VAL &a :a
=VAL :b
=VAL :c
=VAL &d :d
-MAP
-DOC
-STR
|
# ZK9H - Nested top level flow mapping
|
|
|
{
"key": [
[
[
"value"
]
]
]
}
|
+STR
+DOC
+MAP {}
=VAL :key
+SEQ []
+SEQ []
+SEQ []
=VAL :value
-SEQ
-SEQ
-SEQ
-MAP
-DOC
-STR
|
# ZWK4 - Key with anchor after missing explicit mapping value
|
|
---
a: 1
? b
&anchor c: 3
|
{
"a": 1,
"b": null,
"c": 3
}
|
+STR
+DOC ---
+MAP
=VAL :a
=VAL :1
=VAL :b
=VAL :
=VAL &anchor :c
=VAL :3
-MAP
-DOC
-STR
|