--- &test-2XXW
Title: Spec Example 2.25. Unordered Sets
Tags: [ explicit-key, mapping, spec, unknown-tag ]
# Sets are represented as a
# Mapping where each key is
# associated with a null value
--- !!set
? Mark McGwire
? Sammy Sosa
? Ken Griff
+STR
+DOC ---
+MAP <tag:yaml.org,2002:set>
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR
{
"Ken Griff": null,
"Mark McGwire": null,
"Sammy Sosa": null
}
diff
Minimal Events:
+STR
+DOC
+MAP <tag:yaml.org,2002:set>
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR
Transformed Events:
+STR
+DOC
+MAP
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR
Got Events:
+STR
+DOC
+MAP
=VAL :Mark McGwire
=VAL :
=VAL :Sammy Sosa
=VAL :
=VAL :Ken Griff
=VAL :
-MAP
-DOC
-STR
json_diff
{
"Ken Griff": {},
"Mark McGwire": {},
"Sammy Sosa": {}
}
error
Syck parser (line 6, column 2): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.
error
Syck parser (line 6, column 2): syntax error at /perl5/lib/perl5/x86_64-linux-thread-multi/YAML/Syck.pm line 60, <> line 1.
error
YAML Error: Invalid element in map
Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
Line: 6
Document: 1
at /perl5/lib/perl5/YAML/Loader.pm line 360.
error
YAML Error: Invalid element in map
Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT
Line: 6
Document: 1
at /perl5/lib/perl5/YAML/Loader.pm line 360.
error
Error json.dumps: <class 'TypeError'>
Traceback (most recent call last):
File "/yaml/bin/py-pyyaml-json", line 21, in <module>
print(json.dumps(doc, sort_keys=True, skipkeys=True, indent=2))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/json/__init__.py", line 238, in dumps
**kw).encode(obj)
^^^^^^^^^^^
File "/usr/lib/python3.12/json/encoder.py", line 202, in encode
chunks = list(chunks)
^^^^^^^^^^^^
File "/usr/lib/python3.12/json/encoder.py", line 439, in _iterencode
o = _default(o)
^^^^^^^^^^^
File "/usr/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable
error
Error json.dumps: <class 'TypeError'>
Traceback (most recent call last):
File "/yaml/bin/py-ruamel-json", line 23, in <module>
print(json.dumps(doc, sort_keys=True, skipkeys=True, indent=2))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/json/__init__.py", line 238, in dumps
**kw).encode(obj)
^^^^^^^^^^^
File "/usr/lib/python3.12/json/encoder.py", line 202, in encode
chunks = list(chunks)
^^^^^^^^^^^^
File "/usr/lib/python3.12/json/encoder.py", line 439, in _iterencode
o = _default(o)
^^^^^^^^^^^
File "/usr/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type set is not JSON serializable
na
Line Col Char Byte Token|Content
1 0 0 0 +COMM|
1 0 0 0 =SYNX|#
1 1 1 1 =META|.Sets.are.represented.as.a
1 27 27 27 -COMM|
1 27 27 27 =EOL |\x0a
2 0 28 28 +COMM|
2 0 28 28 =SYNX|#
2 1 29 29 =META|.Mapping.where.each.key.is
2 27 55 55 -COMM|
2 27 55 55 =EOL |\x0a
3 0 56 56 +COMM|
3 0 56 56 =SYNX|#
3 1 57 57 =META|.associated.with.a.null.value
3 30 86 86 -COMM|
3 30 86 86 =EOL |\x0a
4 0 87 87 +DOC |
4 0 87 87 =HEAD|---
4 3 90 90 +NODE|
4 3 90 90 =WSPC|.
4 4 91 91 +PROP|
4 4 91 91 +TAG |
4 4 91 91 +HAND|
4 4 91 91 =SYNX|!
4 5 92 92 =SYNX|!
4 6 93 93 -HAND|
4 6 93 93 =META|set
4 9 96 96 -TAG |
4 9 96 96 -PROP|
4 9 96 96 =EOL |\x0a
5 0 97 97 +MAP |
5 0 97 97 +PAIR|
5 0 97 97 =SYNX|?
5 1 98 98 =WSPC|.
5 2 99 99 +NODE|
5 2 99 99 +VAL |
5 2 99 99 =TEXT|Mark.McGwire
5 14 111 111 -VAL |
5 14 111 111 -NODE|
5 14 111 111 =EOL |\x0a
6 0 112 112 +NODE|
6 0 112 112 +VAL |
6 0 112 112 -VAL |
6 0 112 112 -NODE|
6 0 112 112 -PAIR|
6 0 112 112 +PAIR|
6 0 112 112 =SYNX|?
6 1 113 113 =WSPC|.
6 2 114 114 +NODE|
6 2 114 114 +VAL |
6 2 114 114 =TEXT|Sammy.Sosa
6 12 124 124 -VAL |
6 12 124 124 -NODE|
6 12 124 124 =EOL |\x0a
7 0 125 125 +NODE|
7 0 125 125 +VAL |
7 0 125 125 -VAL |
7 0 125 125 -NODE|
7 0 125 125 -PAIR|
7 0 125 125 +PAIR|
7 0 125 125 =SYNX|?
7 1 126 126 =WSPC|.
7 2 127 127 +NODE|
7 2 127 127 +VAL |
7 2 127 127 =TEXT|Ken.Griff
7 11 136 136 -VAL |
7 11 136 136 -NODE|
7 11 136 136 =EOL |\x0a
8 0 137 137 +NODE|
8 0 137 137 +VAL |
8 0 137 137 -VAL |
8 0 137 137 -NODE|
8 0 137 137 -PAIR|
8 0 137 137 -MAP |
8 0 137 137 -NODE|
8 0 137 137 -DOC |
na
{
'Ken Griff' => undef,
'Mark McGwire' => undef,
'Sammy Sosa' => undef
}
na
{
'Ken Griff' => undef,
'Mark McGwire' => undef,
'Sammy Sosa' => undef
}
na
{'Sammy Sosa', 'Mark McGwire', 'Ken Griff'}
na
{'Sammy Sosa', 'Ken Griff', 'Mark McGwire'}
ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 4, Col: 5, Idx: 91) - (Line: 5, Col: 1, Idx: 97): Encountered an unresolved tag 'tag:yaml.org,2002:set'
at YamlDotNet.Serialization.NodeTypeResolvers.PreventUnknownTagsNodeTypeResolver.YamlDotNet.Serialization.INodeTypeResolver.Resolve(NodeEvent nodeEvent, Type& currentType)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.GetTypeFromEvent(NodeEvent nodeEvent, Type currentType)
at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input, Type type)
at YamlDotNet.Serialization.Deserializer.Deserialize(TextReader input)
at Program.Main(String[] commandLineArguments)
Aborted (core dumped)
ni
YAML::Tiny does not support a feature in line '!!set' at /yaml/bin/perl-tiny-json line 12.
ni
YAML::Tiny does not support a feature in line '!!set' at /yaml/bin/perl-tiny-perl line 15.
ni
YAML::XS::Load Error: The problem:
bad tag found for hash: 'tag:yaml.org,2002:set'
was found at document: 1
ni
YAML::XS::Load Error: The problem:
bad tag found for hash: 'tag:yaml.org,2002:set'
was found at document: 1