# YAML Test Matrix

--- &test-7FWL
  Title: Spec Example 6.24. Verbatim Tags
  Tags: [ mapping, spec, tag, unknown-tag ]

YAML

!<tag:yaml.org,2002:str> foo :
  !<!bar> baz

Expected Events

+STR
+DOC
+MAP
=VAL <tag:yaml.org,2002:str> :foo
=VAL <!bar> :baz
-MAP
-DOC
-STR

Expected JSON

{
"foo": "baz"
}

c-libfyaml-event

 ok

c-libyaml-event

 ok

cpp-rapidyaml-event

 ok

cpp-yamlcpp-event

 ok

dotnet-yamldotnet-event

 ok

hs-hsyaml-event

 ok

js-yaml-event

 ok

nim-nimyaml-event

 ok

perl-pp-event

 ok

perl-refparser-event

 ok

py-pyyaml-event

 ok

py-ruamel-event

 ok

rust-yamlrust-event

 ok

c-libfyaml-json

 json_ok

go-yaml-json

 json_ok

hs-hsyaml-json

 json_ok

js-yaml-json

 json_ok

lua-lyaml-json

 json_ok

perl-pp-json

 json_ok

perl-pplibyaml-json

 json_ok

perl-syck-json

 json_ok

perl-xs-json

 json_ok

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

perl-yaml-json

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

perl-yaml-perl

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

hs-reference-yeast

 na
Line  Col Char Byte Token|Content
   1    0    0    0 +DOC |
   1    0    0    0 +NODE|
   1    0    0    0 +MAP |
   1    0    0    0 +PAIR|
   1    0    0    0 +NODE|
   1    0    0    0 +PROP|
   1    0    0    0 +TAG |
   1    0    0    0 =SYNX|!
   1    1    1    1 =SYNX|<
   1    2    2    2 =META|tag:yaml.org,2002:str
   1   23   23   23 =SYNX|>
   1   24   24   24 -TAG |
   1   24   24   24 -PROP|
   1   24   24   24 =WSPC|.
   1   25   25   25 +VAL |
   1   25   25   25 =TEXT|foo
   1   28   28   28 -VAL |
   1   28   28   28 -NODE|
   1   28   28   28 =WSPC|.
   1   29   29   29 =SYNX|:
   1   30   30   30 =EOL |\x0a
   2    0   31   31 =DENT|.
   2    1   32   32 =WSPC|.
   2    2   33   33 +NODE|
   2    2   33   33 +PROP|
   2    2   33   33 +TAG |
   2    2   33   33 =SYNX|!
   2    3   34   34 =SYNX|<
   2    4   35   35 =META|!bar
   2    8   39   39 =SYNX|>
   2    9   40   40 -TAG |
   2    9   40   40 -PROP|
   2    9   40   40 =WSPC|.
   2   10   41   41 +VAL |
   2   10   41   41 =TEXT|baz
   2   13   44   44 -VAL |
   2   13   44   44 -NODE|
   2   13   44   44 =EOL |\x0a
   3    0   45   45 -PAIR|
   3    0   45   45 -MAP |
   3    0   45   45 -NODE|
   3    0   45   45 -DOC |

perl-pp-perl

 na
{
  'foo' => 'baz'
}

perl-pplibyaml-perl

 na
{
  'foo' => 'baz'
}

perl-syck-perl

 na
{
  'foo' => 'baz'
}

perl-xs-perl

 na
{
  'foo' => 'baz'
}

py-pyyaml-py

 na
{'foo': GenericScalar(tag='!bar', content='baz')}

py-ruamel-py

 na
{'foo': GenericScalar(tag='!bar', content='baz')}

dotnet-yamldotnet-json

 ni
Unhandled exception. YamlDotNet.Core.YamlException: (Line: 2, Col: 3, Idx: 33) - (Line: 2, Col: 14, Idx: 44): Encountered an unresolved tag '!bar'
   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.ValueDeserializers.NodeValueDeserializer.<>c__DisplayClass3_0.<DeserializeValue>b__0(IParser r, Type t)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.DeserializeHelper(Type tKey, Type tValue, IParser parser, Func`3 nestedObjectDeserializer, IDictionary result)
   at YamlDotNet.Serialization.NodeDeserializers.DictionaryNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object& value)
   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)

js-jsyaml-json

 ni
/node/node_modules/js-yaml/lib/loader.js:187
  throw generateError(state, message);
  ^
YAMLException: end of the stream or a document separator is expected (1:30)

 1 | !<tag:yaml.org,2002:str> foo :
----------------------------------^
 2 |   !<!bar> baz
    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 readDocument (/node/node_modules/js-yaml/lib/loader.js:1645:5)
    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)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12) {
  reason: 'end of the stream or a document separator is expected',
  mark: {
    name: null,
    buffer: '!<tag:yaml.org,2002:str> foo :\n  !<!bar> baz\n',
    position: 29,
    line: 0,
    column: 29,
    snippet: ' 1 | !<tag:yaml.org,2002:str> foo :\n' +
      '----------------------------------^\n' +
      ' 2 |   !<!bar> baz'
  }
}

Node.js v20.13.1

perl-tiny-json

 ni
YAML::Tiny failed to classify line '  !<!bar> baz' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny failed to classify line '  !<!bar> baz' at /yaml/bin/perl-tiny-perl line 15.