# YAML Test Matrix

--- &test-6PBE
  Title: Zero-indented sequences in explicit mapping keys
  Tags: [ explicit-key, mapping, sequence ]

YAML

---
?
- a
- b
:
- c
- d

Expected Events

+STR
+DOC ---
+MAP
+SEQ
=VAL :a
=VAL :b
-SEQ
+SEQ
=VAL :c
=VAL :d
-SEQ
-MAP
-DOC
-STR

Expected JSON



c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

java-snakeengine-event

 ok

java-snakeyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

rust-yamlrust-event

 ok

cpp-rapidyaml-event

 error
-:5:1: (14B): ERROR: lines cannot end with ':' in plain flow (unquoted) scalars
-:5:1: :  (size=1)
       ^  (cols 1-2)

perl-syck-perl

 error
Syck parser (line 3, column -1): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-yaml-perl

 error
Use of uninitialized value $key in string at /perl5/lib/perl5/YAML/Loader.pm line 341, <> line 1.
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 360.

py-pyyaml-py

 error
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.7/site-packages/yaml/__init__.py", line 93, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<unicode string>", line 2, column 1:
    ?
    ^
found unhashable key
  in "<unicode string>", line 3, column 1:
    - a
    ^

raku-yamlish-raku

 error
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-raku line 6

c-libfyaml-json

 na
{
stdin:3:1: error: Non scalar keys are not allowed in JSON emit mode
- a
^~~
- b
~~~

dotnet-yamldotnet-json

 na
{? ["a", "b"] : ["c", "d"]}

go-yaml-json

 na
yaml: invalid map key: []interface {}{"a", "b"}

hs-hsyaml-json

 na
{"[\"a\",\"b\"]":["c","d"]}

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 =HEAD|---
   1    3    3    3 +NODE|
   1    3    3    3 =EOL |\x0a
   2    0    4    4 +MAP |
   2    0    4    4 +PAIR|
   2    0    4    4 =SYNX|?
   2    1    5    5 +NODE|
   2    1    5    5 =EOL |\x0a
   3    0    6    6 +SEQ |
   3    0    6    6 =SYNX|-
   3    1    7    7 =WSPC|.
   3    2    8    8 +NODE|
   3    2    8    8 +VAL |
   3    2    8    8 =TEXT|a
   3    3    9    9 -VAL |
   3    3    9    9 -NODE|
   3    3    9    9 =EOL |\x0a
   4    0   10   10 =SYNX|-
   4    1   11   11 =WSPC|.
   4    2   12   12 +NODE|
   4    2   12   12 +VAL |
   4    2   12   12 =TEXT|b
   4    3   13   13 -VAL |
   4    3   13   13 -NODE|
   4    3   13   13 =EOL |\x0a
   5    0   14   14 -SEQ |
   5    0   14   14 -NODE|
   5    0   14   14 =SYNX|:
   5    1   15   15 +NODE|
   5    1   15   15 =EOL |\x0a
   6    0   16   16 +SEQ |
   6    0   16   16 =SYNX|-
   6    1   17   17 =WSPC|.
   6    2   18   18 +NODE|
   6    2   18   18 +VAL |
   6    2   18   18 =TEXT|c
   6    3   19   19 -VAL |
   6    3   19   19 -NODE|
   6    3   19   19 =EOL |\x0a
   7    0   20   20 =SYNX|-
   7    1   21   21 =WSPC|.
   7    2   22   22 +NODE|
   7    2   22   22 +VAL |
   7    2   22   22 =TEXT|d
   7    3   23   23 -VAL |
   7    3   23   23 -NODE|
   7    3   23   23 =EOL |\x0a
   8    0   24   24 -SEQ |
   8    0   24   24 -NODE|
   8    0   24   24 -PAIR|
   8    0   24   24 -MAP |
   8    0   24   24 -NODE|
   8    0   24   24 -DOC |

java-snakeengine-json

 na
{
  "[a, b]": [
    "c",
    "d"
  ]
}

java-snakeyaml-json

 na
{
  "[a, b]": [
    "c",
    "d"
  ]
}

js-jsyaml-json

 na
{"a,b":["c","d"]}

js-yaml-json

 na
{
  "[ a, b ]": [
    "c",
    "d"
  ]
}
(node:895) Warning: Keys with collection values will be stringified due to JS Object restrictions: "[ a, b ]". Set mapAsMap: true to use object keys.

lua-lyaml-json

 na
luajit: /yaml/bin/lua-lyaml-json:8: Cannot serialise table: table key must be a number or string
stack traceback:
	[C]: in function 'encode'
	/yaml/bin/lua-lyaml-json:8: in main chunk
	[C]: at 0x5570bdc41f97

perl-pp-json

 na
{
   "['a','b']" : [
      "c",
      "d"
   ]
}

perl-pp-perl

 na
{
  '[\'a\',\'b\']' => [
                       'c',
                       'd'
                     ]
}

perl-pplibyaml-json

 na
{
   "['a','b']" : [
      "c",
      "d"
   ]
}

perl-pplibyaml-perl

 na
{
  '[\'a\',\'b\']' => [
                       'c',
                       'd'
                     ]
}

perl-syck-json

 na
Syck parser (line 3, column -1): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.

perl-tiny-json

 na
YAML::Tiny does not support a feature in line '?' at /yaml/bin/perl-tiny-json line 12.

perl-xs-json

 na
{
   "ARRAY(0x5651a17ed420)" : [
      "c",
      "d"
   ]
}

perl-xs-perl

 na
{
  'ARRAY(0x555e70d51a70)' => [
                               'c',
                               'd'
                             ]
}

perl-yaml-json

 na
Use of uninitialized value $key in string at /perl5/lib/perl5/YAML/Loader.pm line 341, <> line 1.
YAML Error: Invalid element in map
   Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
   Line: 3
   Document: 1
 at /perl5/lib/perl5/YAML/Loader.pm line 360.

py-pyyaml-json

 na
Traceback (most recent call last):
  File "/yaml/bin/py-pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/python/lib/python3.7/site-packages/yaml/__init__.py", line 93, in load_all
    yield loader.get_data()
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 45, in get_data
    return self.construct_document(self.get_node())
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 60, in construct_document
    for dummy in generator:
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 218, in construct_mapping
    return super().construct_mapping(node, deep=deep)
  File "/python/lib/python3.7/site-packages/yaml/constructor.py", line 142, in construct_mapping
    "found unhashable key", key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
  in "<unicode string>", line 2, column 1:
    ?
    ^
found unhashable key
  in "<unicode string>", line 3, column 1:
    - a
    ^

py-ruamel-json

 na
{
  
}

py-ruamel-py

 na
{('a', 'b'): ['c', 'd']}

raku-yamlish-json

 na
Couldn't parse YAML
  in sub load-yamls at /raku/sources/44795C7AB0F35700F4CA9C3E2CC5C924EE4C608F (YAMLish) line 959
  in block <unit> at /yaml/bin/raku-yamlish-json line 6

ruby-psych-json

 na
{"[\"a\", \"b\"]":["c","d"]}

perl-tiny-perl

 ni
YAML::Tiny does not support a feature in line '?' at /yaml/bin/perl-tiny-perl line 15.