--- &test-6BFJ
Title: Mapping, key and flow sequence item anchors
Tags: [ anchor, complex-key, flow, mapping, sequence ]
---
&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
error
-:3:6: (18B): ERROR: triple-pending anchor
-:3:6: &key [ &item a, b, c ]: value (size=29)
^~~~~~~~~~~~~~~~~~~~~~~~ (cols 6-30)
error
+STR
+DOC ---
+SEQ [] &key
Line : 3
Column : 16
Message : A node can only have one anchor
Where : /perl5/lib/perl5/YAML/PP/Parser.pm line 704
YAML : " b, c ]: value\n"
at /yaml/bin/perl-pp-event line 46.
error
Line : 3
Column : 16
Message : A node can only have one anchor
Where : /perl5/lib/perl5/YAML/PP/Parser.pm line 704
YAML : " b, c ]: value\n"
at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.
error
Syck parser (line 3, column 6): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.
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
in "<unicode string>", line 2, column 1:
&mapping
^
found unhashable key
in "<unicode string>", line 3, column 1:
&key [ &item a, b, c ]: value
^
na
{
stdin:3:6: error: Non scalar keys are not allowed in JSON emit mode
&key [ &item a, b, c ]: value
^~~~~~~~~~~~~~~~~
na
{? ["a", "b", "c"] : "value"}
na
yaml: invalid map key: []interface {}{"a", "b", "c"}
na
{"[\"a\",\"b\",\"c\"]":"value"}
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 +PROP|
2 0 4 4 +ANCH|
2 0 4 4 =SYNX|&
2 1 5 5 =META|mapping
2 8 12 12 -ANCH|
2 8 12 12 -PROP|
2 8 12 12 =EOL |\x0a
3 0 13 13 +MAP |
3 0 13 13 +PAIR|
3 0 13 13 +NODE|
3 0 13 13 +PROP|
3 0 13 13 +ANCH|
3 0 13 13 =SYNX|&
3 1 14 14 =META|key
3 4 17 17 -ANCH|
3 4 17 17 -PROP|
3 4 17 17 =WSPC|.
3 5 18 18 +SEQ |
3 5 18 18 =SYNX|[
3 6 19 19 =WSPC|.
3 7 20 20 +NODE|
3 7 20 20 +PROP|
3 7 20 20 +ANCH|
3 7 20 20 =SYNX|&
3 8 21 21 =META|item
3 12 25 25 -ANCH|
3 12 25 25 -PROP|
3 12 25 25 =WSPC|.
3 13 26 26 +VAL |
3 13 26 26 =TEXT|a
3 14 27 27 -VAL |
3 14 27 27 -NODE|
3 14 27 27 =SYNX|,
3 15 28 28 =WSPC|.
3 16 29 29 +NODE|
3 16 29 29 +VAL |
3 16 29 29 =TEXT|b
3 17 30 30 -VAL |
3 17 30 30 -NODE|
3 17 30 30 =SYNX|,
3 18 31 31 =WSPC|.
3 19 32 32 +NODE|
3 19 32 32 +VAL |
3 19 32 32 =TEXT|c
3 20 33 33 -VAL |
3 20 33 33 -NODE|
3 20 33 33 =WSPC|.
3 21 34 34 =SYNX|]
3 22 35 35 -SEQ |
3 22 35 35 -NODE|
3 22 35 35 =SYNX|:
3 23 36 36 =WSPC|.
3 24 37 37 +NODE|
3 24 37 37 +VAL |
3 24 37 37 =TEXT|value
3 29 42 42 -VAL |
3 29 42 42 -NODE|
3 29 42 42 =EOL |\x0a
4 0 43 43 -PAIR|
4 0 43 43 -MAP |
4 0 43 43 -NODE|
4 0 43 43 -DOC |
na
/node/node_modules/js-yaml/lib/loader.js:187
throw generateError(state, message);
^
YAMLException: duplication of an anchor property (3:1)
1 | ---
2 | &mapping
3 | &key [ &item a, b, c ]: value
-----^
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 readAnchorProperty (/node/node_modules/js-yaml/lib/loader.js:1317:5)
at composeNode (/node/node_modules/js-yaml/lib/loader.js:1407:38)
at readDocument (/node/node_modules/js-yaml/lib/loader.js:1625:3)
at loadDocuments (/node/node_modules/js-yaml/lib/loader.js:1688:5)
at Object.loadAll (/node/node_modules/js-yaml/lib/loader.js:1701:19)
at Object.<anonymous> (/yaml/bin/js-jsyaml-json:7:13)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) {
reason: 'duplication of an anchor property',
mark: {
name: null,
buffer: '---\n&mapping\n&key [ &item a, b, c ]: value\n',
position: 13,
line: 2,
column: 0,
snippet: ' 1 | ---\n 2 | &mapping\n 3 | &key [ &item a, b, c ]: value\n-----^'
}
}
Node.js v20.13.1
na
{
"[ &item a, b, c ]": "value"
}
(node:765) Warning: Keys with collection values will be stringified due to JS Object restrictions: "[ &item a, 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 0x55be17d4aed0
na
Line : 3
Column : 16
Message : A node can only have one anchor
Where : /perl5/lib/perl5/YAML/PP/Parser.pm line 704
YAML : " b, c ]: value\n"
at /perl5/lib/perl5/YAML/PP/Loader.pm line 94.
na
{
"['a','b','c']" : "value"
}
na
{
'[\'a\',\'b\',\'c\']' => 'value'
}
na
Syck parser (line 3, column 6): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.
na
YAML::Tiny failed to classify line '&mapping' at /yaml/bin/perl-tiny-json line 12.
na
{
"ARRAY(0x7f09d2f5f8e0)" : "value"
}
na
{
'ARRAY(0x7f4f426e9608)' => 'value'
}
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
in "<unicode string>", line 2, column 1:
&mapping
^
found unhashable key
in "<unicode string>", line 3, column 1:
&key [ &item a, b, c ]: value
^
na
{('a', 'b', 'c'): 'value'}
na
{"[\"a\", \"b\", \"c\"]":"value"}
ni
YAML::Tiny failed to classify line '&mapping' at /yaml/bin/perl-tiny-perl line 15.