--- &test-4FJ6
Title: Nested implicit complex keys
Tags: [ complex-key, flow, mapping, sequence ]
---
[
[ 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
diff
Minimal 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
Transformed Events:
+STR
+DOC ---
+SEQ
+SEQ
=VAL :a
+SEQ
+SEQ
+SEQ
=VAL :b
=VAL :c
-SEQ
-SEQ
+MAP
=VAL :
=VAL :d
-MAP
=VAL :e
-SEQ
-SEQ
+MAP
=VAL :
=VAL :23
-MAP
-SEQ
-DOC
-STR
Got Events:
+STR
+DOC ---
+SEQ
+SEQ
=VAL :a
+SEQ
+SEQ
+SEQ
=VAL :b
=VAL :c
-SEQ
-SEQ
+MAP
=VAL :
=VAL :d
-MAP
=VAL :e
-SEQ
-SEQ
+MAP
=VAL :
=VAL :23
-MAP
-SEQ
-DOC
-STR
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 : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML : ": d, e]]: 23\n"
at /yaml/bin/perl-pp-event line 46.
error
Line : 3
Column : 17
Expected : EOL FLOWSEQ_END FLOW_COMMA WS
Got : COLON
Where : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML : ": d, e]]: 23\n"
at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.
error
YAML Error: Expected separator '---'
Code: YAML_PARSE_ERR_NO_SEPARATOR
Line: 2
Document: 2
at /perl5/lib/perl5/YAML/Loader.pm line 88.
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.12/site-packages/yaml/__init__.py", line 130, in load_all
yield loader.get_data()
^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
return self.construct_document(self.get_node())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
for dummy in generator:
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
return super().construct_mapping(node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
in "<unicode string>", line 3, column 3:
[ a, [ [[b,c]]: d, e]]: 23
^
error
Traceback (most recent call last):
File "/yaml/bin/py-ruamel-py", line 38, in <module>
for doc in yaml.load_all(sys.stdin.read()):
File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
yield constructor.get_data()
^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
return self.construct_document(self.composer.get_node())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 125, in construct_document
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 633, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 429, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 231, in construct_mapping
key = self.construct_object(key_node, deep=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 188, in construct_non_recursive_object
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 628, in construct_yaml_seq
data.extend(self.construct_sequence(node))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 212, in construct_sequence
return [self.construct_object(child, deep=deep) for child in node.value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 188, in construct_non_recursive_object
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 628, in construct_yaml_seq
data.extend(self.construct_sequence(node))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 212, in construct_sequence
return [self.construct_object(child, deep=deep) for child in node.value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 188, in construct_non_recursive_object
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 633, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 429, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 246, in construct_mapping
if self.check_mapping_key(node, key_node, mapping, key, value):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 257, in check_mapping_key
if key in mapping:
^^^^^^^^^^^^^^
TypeError: unhashable type: 'list'
na
[
{
]
stdin:3:3: error: Non scalar keys are not allowed in JSON emit mode
[ a, [ [[b,c]]: d, e]]: 23
^~~~~~~~~~~~~~~~~~~~~~
na
[{? ["a", [{? [["b", "c"]] : "d"}, "e"]] : "23"}]
na
yaml: invalid map key: []interface {}{[]interface {}{"b", "c"}}
na
[{"[\"a\",[{\"[[\\\"b\\\",\\\"c\\\"]]\":\"d\"},\"e\"]]":23}]
na
Line Col Char Byte Token|Content
1 0 0 0 +DOC |
1 0 0 0 =HEAD|---
1 3 3 3 =EOL |\x0a
2 0 4 4 +NODE|
2 0 4 4 +SEQ |
2 0 4 4 =SYNX|[
2 1 5 5 =EOL |\x0a
3 0 6 6 =WSPC|..
3 2 8 8 +MAP |
3 2 8 8 +PAIR|
3 2 8 8 +NODE|
3 2 8 8 +SEQ |
3 2 8 8 =SYNX|[
3 3 9 9 =WSPC|.
3 4 10 10 +NODE|
3 4 10 10 +VAL |
3 4 10 10 =TEXT|a
3 5 11 11 -VAL |
3 5 11 11 -NODE|
3 5 11 11 =SYNX|,
3 6 12 12 =WSPC|.
3 7 13 13 +NODE|
3 7 13 13 +SEQ |
3 7 13 13 =SYNX|[
3 8 14 14 =WSPC|.
3 9 15 15 +MAP |
3 9 15 15 +PAIR|
3 9 15 15 +NODE|
3 9 15 15 +SEQ |
3 9 15 15 =SYNX|[
3 10 16 16 +NODE|
3 10 16 16 +SEQ |
3 10 16 16 =SYNX|[
3 11 17 17 +NODE|
3 11 17 17 +VAL |
3 11 17 17 =TEXT|b
3 12 18 18 -VAL |
3 12 18 18 -NODE|
3 12 18 18 =SYNX|,
3 13 19 19 +NODE|
3 13 19 19 +VAL |
3 13 19 19 =TEXT|c
3 14 20 20 -VAL |
3 14 20 20 -NODE|
3 14 20 20 =SYNX|]
3 15 21 21 -SEQ |
3 15 21 21 -NODE|
3 15 21 21 =SYNX|]
3 16 22 22 -SEQ |
3 16 22 22 -NODE|
3 16 22 22 =SYNX|:
3 17 23 23 =WSPC|.
3 18 24 24 +NODE|
3 18 24 24 +VAL |
3 18 24 24 =TEXT|d
3 19 25 25 -VAL |
3 19 25 25 -NODE|
3 19 25 25 -PAIR|
3 19 25 25 -MAP |
3 19 25 25 =SYNX|,
3 20 26 26 =WSPC|.
3 21 27 27 +NODE|
3 21 27 27 +VAL |
3 21 27 27 =TEXT|e
3 22 28 28 -VAL |
3 22 28 28 -NODE|
3 22 28 28 =SYNX|]
3 23 29 29 -SEQ |
3 23 29 29 -NODE|
3 23 29 29 =SYNX|]
3 24 30 30 -SEQ |
3 24 30 30 -NODE|
3 24 30 30 =SYNX|:
3 25 31 31 =WSPC|.
3 26 32 32 +NODE|
3 26 32 32 +VAL |
3 26 32 32 =TEXT|23
3 28 34 34 -VAL |
3 28 34 34 -NODE|
3 28 34 34 -PAIR|
3 28 34 34 -MAP |
3 28 34 34 =EOL |\x0a
4 0 35 35 =SYNX|]
4 1 36 36 -SEQ |
4 1 36 36 -NODE|
4 1 36 36 =EOL |\x0a
5 0 37 37 -DOC |
na
/node/node_modules/js-yaml/lib/loader.js:187
throw generateError(state, message);
^
YAMLException: nested arrays are not supported inside keys (3:20)
1 | ---
2 | [
3 | [ a, [ [[b,c]]: d, e]]: 23
------------------------^
4 | ]
at generateError (/node/node_modules/js-yaml/lib/loader.js:183:10)
at throwError (/node/node_modules/js-yaml/lib/loader.js:187:9)
at storeMappingPair (/node/node_modules/js-yaml/lib/loader.js:320:9)
at readFlowCollection (/node/node_modules/js-yaml/lib/loader.js:798:20)
at composeNode (/node/node_modules/js-yaml/lib/loader.js:1442:11)
at readFlowCollection (/node/node_modules/js-yaml/lib/loader.js:780:5)
at composeNode (/node/node_modules/js-yaml/lib/loader.js:1442:11)
at readFlowCollection (/node/node_modules/js-yaml/lib/loader.js:780:5)
at composeNode (/node/node_modules/js-yaml/lib/loader.js:1442:11)
at readBlockMapping (/node/node_modules/js-yaml/lib/loader.js:1104:12) {
reason: 'nested arrays are not supported inside keys',
mark: {
name: null,
buffer: '---\n[\n [ a, [ [[b,c]]: d, e]]: 23\n]\n',
position: 25,
line: 2,
column: 19,
snippet: ' 1 | ---\n' +
' 2 | [\n' +
' 3 | [ a, [ [[b,c]]: d, e]]: 23\n' +
'------------------------^\n' +
' 4 | ]'
}
}
Node.js v20.13.1
na
[
{
"[\n a,\n [\n {\n ? [ [ b, c ] ]\n : d\n },\n e\n ]\n]": 23
}
]
(node:366) Warning: Keys with collection values will be stringified due to JS Object restrictions: "[ [ b, c ] ]". Set mapAsMap: true to use object keys.
(Use `node --trace-warnings ...` to show where the warning was created)
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 0x5630f4532ed0
na
Line : 3
Column : 17
Expected : EOL FLOWSEQ_END FLOW_COMMA WS
Got : COLON
Where : /perl5/lib/perl5/YAML/PP/Parser.pm line 392
YAML : ": d, e]]: 23\n"
at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.
na
[
{
"['a',[{'[[\\'b\\',\\'c\\']]' => 'd'},'e']]" : 23
}
]
na
[
{
'[\'a\',[{\'[[\\\'b\\\',\\\'c\\\']]\' => \'d\'},\'e\']]' => 23
}
]
na
[
{
"ARRAY(0x7f1d397dcae0)" : 23
}
]
na
[
{
'ARRAY(0x7f87649c7778)' => 23
}
]
na
YAML::Tiny failed to classify line '[' at /yaml/bin/perl-tiny-json line 12.
na
[
{
"ARRAY(0x7f2257484ba8)" : 23
}
]
na
[
{
'ARRAY(0x7fc32c48d530)' => 23
}
]
na
YAML Error: Expected separator '---'
Code: YAML_PARSE_ERR_NO_SEPARATOR
Line: 2
Document: 2
at /perl5/lib/perl5/YAML/Loader.pm line 88.
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.12/site-packages/yaml/__init__.py", line 130, in load_all
yield loader.get_data()
^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 45, in get_data
return self.construct_document(self.get_node())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 60, in construct_document
for dummy in generator:
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 413, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 218, in construct_mapping
return super().construct_mapping(node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/yaml/constructor.py", line 141, in construct_mapping
raise ConstructorError("while constructing a mapping", node.start_mark,
yaml.constructor.ConstructorError: while constructing a mapping
found unhashable key
in "<unicode string>", line 3, column 3:
[ a, [ [[b,c]]: d, e]]: 23
^
na
Traceback (most recent call last):
File "/yaml/bin/py-ruamel-json", line 21, in <module>
for doc in yaml.load_all(sys.stdin.read()):
File "/python/lib/python3.12/site-packages/ruamel/yaml/main.py", line 476, in load_all
yield constructor.get_data()
^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 110, in get_data
return self.construct_document(self.composer.get_node())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 125, in construct_document
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 633, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 429, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 231, in construct_mapping
key = self.construct_object(key_node, deep=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 188, in construct_non_recursive_object
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 628, in construct_yaml_seq
data.extend(self.construct_sequence(node))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 212, in construct_sequence
return [self.construct_object(child, deep=deep) for child in node.value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 188, in construct_non_recursive_object
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 628, in construct_yaml_seq
data.extend(self.construct_sequence(node))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 212, in construct_sequence
return [self.construct_object(child, deep=deep) for child in node.value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 147, in construct_object
data = self.construct_non_recursive_object(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 188, in construct_non_recursive_object
for _dummy in generator:
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 633, in construct_yaml_map
value = self.construct_mapping(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 429, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 246, in construct_mapping
if self.check_mapping_key(node, key_node, mapping, key, value):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python/lib/python3.12/site-packages/ruamel/yaml/constructor.py", line 257, in check_mapping_key
if key in mapping:
^^^^^^^^^^^^^^
TypeError: unhashable type: 'list'
na
[{"[\"a\", [{[[\"b\", \"c\"]]=>\"d\"}, \"e\"]]":23}]
ni
YAML::Tiny failed to classify line '[' at /yaml/bin/perl-tiny-perl line 15.