--- &test-V9D5
Title: Spec Example 8.19. Compact Block Mappings
Tags: [ complex-key, explicit-key, mapping, spec ]
- 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
diff
Minimal Events:
+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
Transformed Events:
+STR
+DOC
+SEQ
+MAP
=VAL :sun
=VAL :yellow
-MAP
+MAP
=VAL :earth
=VAL :blue
=VAL :
=VAL :moon: white
-MAP
-SEQ
-DOC
-STR
Got Events:
+STR
+DOC
+SEQ
+MAP
=VAL :sun
=VAL :yellow
-MAP
+MAP
=VAL :earth
=VAL :blue
=VAL :
=VAL :moon: white
-MAP
-SEQ
-DOC
-STR
error
Syck parser (line 3, column 9): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.
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 3:
- ? earth: blue
^
found unhashable key
in "<unicode string>", line 2, column 5:
- ? earth: blue
^
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 237, in construct_mapping
raise ConstructorError(
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
in "<unicode string>", line 2, column 3:
- ? earth: blue
^ (line: 2)
found unhashable key
in "<unicode string>", line 2, column 5:
- ? earth: blue
^ (line: 2)
na
[
{
"sun": "yellow"
},
{
]
stdin:2:5: error: Non scalar keys are not allowed in JSON emit mode
- ? earth: blue
^~~~~~~~~~~
: moon: white
~~
na
[{"sun": "yellow"}, {? {"earth": "blue"} : {"moon": "white"}}]
na
yaml: invalid map key: map[interface {}]interface {}{"earth":"blue"}
na
[{"sun":"yellow"},{"{\"earth\":\"blue\"}":{"moon":"white"}}]
na
Line Col Char Byte Token|Content
1 0 0 0 +DOC |
1 0 0 0 +NODE|
1 0 0 0 +SEQ |
1 0 0 0 =SYNX|-
1 1 1 1 =DENT|.
1 2 2 2 +NODE|
1 2 2 2 +MAP |
1 2 2 2 +PAIR|
1 2 2 2 +NODE|
1 2 2 2 +VAL |
1 2 2 2 =TEXT|sun
1 5 5 5 -VAL |
1 5 5 5 -NODE|
1 5 5 5 =SYNX|:
1 6 6 6 =WSPC|.
1 7 7 7 +NODE|
1 7 7 7 +VAL |
1 7 7 7 =TEXT|yellow
1 13 13 13 -VAL |
1 13 13 13 -NODE|
1 13 13 13 =EOL |\x0a
2 0 14 14 -PAIR|
2 0 14 14 -MAP |
2 0 14 14 -NODE|
2 0 14 14 =SYNX|-
2 1 15 15 =DENT|.
2 2 16 16 +NODE|
2 2 16 16 +MAP |
2 2 16 16 +PAIR|
2 2 16 16 =SYNX|?
2 3 17 17 =DENT|.
2 4 18 18 +NODE|
2 4 18 18 +MAP |
2 4 18 18 +PAIR|
2 4 18 18 +NODE|
2 4 18 18 +VAL |
2 4 18 18 =TEXT|earth
2 9 23 23 -VAL |
2 9 23 23 -NODE|
2 9 23 23 =SYNX|:
2 10 24 24 =WSPC|.
2 11 25 25 +NODE|
2 11 25 25 +VAL |
2 11 25 25 =TEXT|blue
2 15 29 29 -VAL |
2 15 29 29 -NODE|
2 15 29 29 =EOL |\x0a
3 0 30 30 -PAIR|
3 0 30 30 -MAP |
3 0 30 30 -NODE|
3 0 30 30 =DENT|..
3 2 32 32 =SYNX|:
3 3 33 33 =DENT|.
3 4 34 34 +NODE|
3 4 34 34 +MAP |
3 4 34 34 +PAIR|
3 4 34 34 +NODE|
3 4 34 34 +VAL |
3 4 34 34 =TEXT|moon
3 8 38 38 -VAL |
3 8 38 38 -NODE|
3 8 38 38 =SYNX|:
3 9 39 39 =WSPC|.
3 10 40 40 +NODE|
3 10 40 40 +VAL |
3 10 40 40 =TEXT|white
3 15 45 45 -VAL |
3 15 45 45 -NODE|
3 15 45 45 =EOL |\x0a
4 0 46 46 -PAIR|
4 0 46 46 -MAP |
4 0 46 46 -NODE|
4 0 46 46 -PAIR|
4 0 46 46 -MAP |
4 0 46 46 -NODE|
4 0 46 46 -SEQ |
4 0 46 46 -NODE|
4 0 46 46 -DOC |
na
[{"sun":"yellow"},{"[object Object]":{"moon":"white"}}]
na
[
{
"sun": "yellow"
},
{
"{ earth: blue }": {
"moon": "white"
}
}
]
(node:3937) Warning: Keys with collection values will be stringified due to JS Object restrictions: "{ earth: blue }". 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 0x5651d572ded0
na
[
{
"sun" : "yellow"
},
{
"{earth => 'blue'}" : {
"moon" : "white"
}
}
]
na
[
{
'sun' => 'yellow'
},
{
'{earth => \'blue\'}' => {
'moon' => 'white'
}
}
]
na
[
{
"sun" : "yellow"
},
{
"{earth => 'blue'}" : {
"moon" : "white"
}
}
]
na
[
{
'sun' => 'yellow'
},
{
'{earth => \'blue\'}' => {
'moon' => 'white'
}
}
]
na
Syck parser (line 3, column 9): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.
na
YAML::Tiny found illegal characters in plain scalar: '? earth: blue' at /yaml/bin/perl-tiny-json line 12.
na
[
{
"sun" : "yellow"
},
{
"HASH(0x7fc766d3a870)" : {
"moon" : "white"
}
}
]
na
[
{
'sun' => 'yellow'
},
{
'HASH(0x7f7507d25698)' => {
'moon' => 'white'
}
}
]
na
[
{
"sun" : "yellow"
},
{
"earth: blue" : "moon: white"
}
]
na
[
{
'sun' => 'yellow'
},
{
'earth: blue' => 'moon: white'
}
]
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 3:
- ? earth: blue
^
found unhashable key
in "<unicode string>", line 2, column 5:
- ? earth: blue
^
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 237, in construct_mapping
raise ConstructorError(
ruamel.yaml.constructor.ConstructorError: while constructing a mapping
in "<unicode string>", line 2, column 3:
- ? earth: blue
^ (line: 2)
found unhashable key
in "<unicode string>", line 2, column 5:
- ? earth: blue
^ (line: 2)
na
[{"sun":"yellow"},{"{\"earth\"=>\"blue\"}":{"moon":"white"}}]
ni
YAML::Tiny found illegal characters in plain scalar: '? earth: blue' at /yaml/bin/perl-tiny-perl line 15.