# YAML Test Matrix

--- &test-4FJ6
  Title: Nested implicit complex keys
  Tags: [ flow, mapping, sequence ]

YAML

---
[
  [ a, [ [[b,c]]: d, e]]: 23
]

Expected Events

+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

Expected JSON



cpp-event

 ok

hs-yaml-event

 ok

java-event

 ok

js-event

 ok

libyaml-event

 ok

nimyaml-event

 ok

pyyaml-event

 ok

ruamel-event

 ok

perl5-pegex-event

 error
Error parsing Pegex document:
  msg:      Parse document failed for some reason
  line:     3
  column:   17
  context:    [ a, [ [[b,c]]: d, e]]: 23\n]\n
                            ^
  position: 22 (0 pre-lookahead)
 at /bin/perl5-pegex-event line 23.

perl5-pm-pl

 error
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 2
   Document: 2
 at /lib/perl5/YAML/Loader.pm line 88.

perl5-pp-event

 error
+STR
+DOC ---
+SEQ
+SEQ
=VAL :a
+SEQ
+SEQ
+SEQ
=VAL :b
=VAL :c
-SEQ
-SEQ
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : COLON
Where     : /lib/perl5/YAML/PP/Parser.pm line 367
YAML      : ": d, e]]: 23\n"
  at /bin/perl5-pp-event line 19.

perl5-pp-pl

 error
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : COLON
Where     : /lib/perl5/YAML/PP/Parser.pm line 367
YAML      : ": d, e]]: 23\n"
  at /lib/perl5/YAML/PP/Loader.pm line 59.

perl5-tiny-pl

 error
YAML::Tiny failed to classify line '[' at /bin/perl5-tiny-pl line 15.

pyyaml-py

 error
Traceback (most recent call last):
  File "/bin/pyyaml-py", line 36, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/lib/python2.7/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 39, in get_data
    return self.construct_document(self.get_node())
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 54, in construct_document
    for dummy in generator:
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 404, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 214, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 138, in construct_mapping
    "found unacceptable key (%s)" % exc, key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'list')
  in "<string>", line 3, column 3:
      [ a, [ [[b,c]]: d, e]]: 23
      ^

ruamel-py

 error
Traceback (most recent call last):
  File "/bin/ruamel-py", line 36, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/main.py", line 949, in load_all
    yield loader._constructor.get_data()
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 101, in get_data
    return self.construct_document(self.composer.get_node())
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 118, in construct_document
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 671, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 398, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 217, in construct_mapping
    key = self.construct_object(key_node, deep=True)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 170, in construct_object
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 665, in construct_yaml_seq
    data.extend(self.construct_sequence(node))
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 197, in construct_sequence
    return [self.construct_object(child, deep=deep) for child in node.value]
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 170, in construct_object
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 665, in construct_yaml_seq
    data.extend(self.construct_sequence(node))
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 197, in construct_sequence
    return [self.construct_object(child, deep=deep) for child in node.value]
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 170, in construct_object
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 671, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 398, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 230, in construct_mapping
    key_node.start_mark,
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'list')
  in "<byte string>", line 3, column 10:
      [ a, [ [[b,c]]: d, e]]: 23
             ^ (line: 3)

hs-yaml-json

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

java-json

 na
[
  {
    "[a, [{[[b, c]]\u003dd}, e]]": 23
  }
]

js-json

 na
[
  {
    "[\n  a,\n  [\n      ? [ [ b, c ] ]\n        : d,\n      e\n    ]\n]": 23
  }
]

js-yaml-json

 na
YAMLException: nested arrays are not supported inside keys at line 3, column 20:
      [ a, [ [[b,c]]: d, e]]: 23
                       ^
    at generateError (/node_modules/js-yaml/lib/js-yaml/loader.js:167:10)
    at throwError (/node_modules/js-yaml/lib/js-yaml/loader.js:173:9)
    at storeMappingPair (/node_modules/js-yaml/lib/js-yaml/loader.js:298:9)
    at readFlowCollection (/node_modules/js-yaml/lib/js-yaml/loader.js:753:20)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1360:11)
    at readFlowCollection (/node_modules/js-yaml/lib/js-yaml/loader.js:735:5)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1360:11)
    at readFlowCollection (/node_modules/js-yaml/lib/js-yaml/loader.js:735:5)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1360:11)
    at readBlockMapping (/node_modules/js-yaml/lib/js-yaml/loader.js:1036:16)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1359:12)
    at readDocument (/node_modules/js-yaml/lib/js-yaml/loader.js:1519:3)
    at loadDocuments (/node_modules/js-yaml/lib/js-yaml/loader.js:1575:5)
    at Object.loadAll (/node_modules/js-yaml/lib/js-yaml/loader.js:1583:19)
    at Object.<anonymous> (/bin/js-yaml-json:6:6)
    at Object.<anonymous> (/bin/js-yaml-json:3:1)
    at Module._compile (module.js:652:30)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:173:23)
    at compileScript (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
    at compilePath (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
    at Object.exports.run (/usr/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
    at Object.<anonymous> (/usr/lib/node_modules/coffee-script/bin/coffee:15:45)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

luajit-json

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

perl5-pm-json

 na
YAML Error: Expected separator '---'
   Code: YAML_PARSE_ERR_NO_SEPARATOR
   Line: 2
   Document: 2
 at /lib/perl5/YAML/Loader.pm line 88.

perl5-pp-json

 na
Line      : 3
Column    : 17
Expected  : EOL FLOWSEQ_END FLOW_COMMA WS
Got       : COLON
Where     : /lib/perl5/YAML/PP/Parser.pm line 367
YAML      : ": d, e]]: 23\n"
  at /lib/perl5/YAML/PP/Loader.pm line 59.

perl5-syck-json

 na
[
   {
      "ARRAY(0x1931850)" : 23
   }
]

perl5-syck-pl

 na
[
  {
    'ARRAY(0xb55700)' => 23
  }
]

perl5-tiny-json

 na
YAML::Tiny failed to classify line '[' at /bin/perl5-tiny-json line 12.

perl5-xs-json

 na
[
   {
      "ARRAY(0x206bcb8)" : 23
   }
]

perl5-xs-pl

 na
[
  {
    'ARRAY(0x123e5b0)' => 23
  }
]

pyyaml-json

 na
Traceback (most recent call last):
  File "/bin/pyyaml-json", line 19, in <module>
    for doc in yaml.load_all(sys.stdin.read(), Loader=yaml.FullLoader):
  File "/lib/python2.7/site-packages/yaml/__init__.py", line 130, in load_all
    yield loader.get_data()
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 39, in get_data
    return self.construct_document(self.get_node())
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 54, in construct_document
    for dummy in generator:
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 404, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 214, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/lib/python2.7/site-packages/yaml/constructor.py", line 138, in construct_mapping
    "found unacceptable key (%s)" % exc, key_node.start_mark)
yaml.constructor.ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'list')
  in "<string>", line 3, column 3:
      [ a, [ [[b,c]]: d, e]]: 23
      ^

ruamel-json

 na
Traceback (most recent call last):
  File "/bin/ruamel-json", line 19, in <module>
    for doc in ruamel.yaml.load_all(sys.stdin.read(), Loader=ruamel.yaml.Loader):
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/main.py", line 949, in load_all
    yield loader._constructor.get_data()
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 101, in get_data
    return self.construct_document(self.composer.get_node())
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 118, in construct_document
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 671, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 398, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 217, in construct_mapping
    key = self.construct_object(key_node, deep=True)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 170, in construct_object
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 665, in construct_yaml_seq
    data.extend(self.construct_sequence(node))
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 197, in construct_sequence
    return [self.construct_object(child, deep=deep) for child in node.value]
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 170, in construct_object
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 665, in construct_yaml_seq
    data.extend(self.construct_sequence(node))
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 197, in construct_sequence
    return [self.construct_object(child, deep=deep) for child in node.value]
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 170, in construct_object
    for _dummy in generator:
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 671, in construct_yaml_map
    value = self.construct_mapping(node)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 398, in construct_mapping
    return BaseConstructor.construct_mapping(self, node, deep=deep)
  File "/usr/local/lib/python2.7/dist-packages/ruamel/yaml/constructor.py", line 230, in construct_mapping
    key_node.start_mark,
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'list')
  in "<byte string>", line 3, column 10:
      [ a, [ [[b,c]]: d, e]]: 23
             ^ (line: 3)

ruby-json

 na
[{"[\"a\", [{[[\"b\", \"c\"]]=>\"d\"}, \"e\"]]":23}]