# YAML Test Matrix

--- &test-ZH7C
  Title: Anchors in Mapping
  Tags: [ anchor, mapping ]

YAML

&a a: b
c: &d d

Expected Events

+STR
+DOC
+MAP
=VAL &a :a
=VAL :b
=VAL :c
=VAL &d :d
-MAP
-DOC
-STR

Expected JSON

{
"a": "b",
"c": "d"
}

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

dotnet-yamldotnet-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

perl-yaml-json

 json_ok

py-pyyaml-json

 json_ok

py-ruamel-json

 json_ok

ruby-psych-json

 json_ok

js-jsyaml-json

 error
/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:5)

 1 | &a a: b
---------^
 2 | c: &d d
    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: '&a a: b\nc: &d d\n',
    position: 4,
    line: 0,
    column: 4,
    snippet: ' 1 | &a a: b\n---------^\n 2 | c: &d d'
  }
}

Node.js v20.13.1

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 +ANCH|
   1    0    0    0 =SYNX|&
   1    1    1    1 =META|a
   1    2    2    2 -ANCH|
   1    2    2    2 -PROP|
   1    2    2    2 =WSPC|.
   1    3    3    3 +VAL |
   1    3    3    3 =TEXT|a
   1    4    4    4 -VAL |
   1    4    4    4 -NODE|
   1    4    4    4 =SYNX|:
   1    5    5    5 =WSPC|.
   1    6    6    6 +NODE|
   1    6    6    6 +VAL |
   1    6    6    6 =TEXT|b
   1    7    7    7 -VAL |
   1    7    7    7 -NODE|
   1    7    7    7 =EOL |\x0a
   2    0    8    8 -PAIR|
   2    0    8    8 +PAIR|
   2    0    8    8 +NODE|
   2    0    8    8 +VAL |
   2    0    8    8 =TEXT|c
   2    1    9    9 -VAL |
   2    1    9    9 -NODE|
   2    1    9    9 =SYNX|:
   2    2   10   10 =WSPC|.
   2    3   11   11 +NODE|
   2    3   11   11 +PROP|
   2    3   11   11 +ANCH|
   2    3   11   11 =SYNX|&
   2    4   12   12 =META|d
   2    5   13   13 -ANCH|
   2    5   13   13 -PROP|
   2    5   13   13 =WSPC|.
   2    6   14   14 +VAL |
   2    6   14   14 =TEXT|d
   2    7   15   15 -VAL |
   2    7   15   15 -NODE|
   2    7   15   15 =EOL |\x0a
   3    0   16   16 -PAIR|
   3    0   16   16 -MAP |
   3    0   16   16 -NODE|
   3    0   16   16 -DOC |

perl-pp-perl

 na
{
  'a' => 'b',
  'c' => 'd'
}

perl-pplibyaml-perl

 na
{
  'a' => 'b',
  'c' => 'd'
}

perl-syck-perl

 na
{
  'a' => 'b',
  'c' => 'd'
}

perl-xs-perl

 na
{
  'a' => 'b',
  'c' => 'd'
}

perl-yaml-perl

 na
{
  'a' => 'b',
  'c' => 'd'
}

py-pyyaml-py

 na
{'a': 'b', 'c': 'd'}

py-ruamel-py

 na
{'a': 'b', 'c': 'd'}

perl-tiny-json

 ni
YAML::Tiny does not support a feature in line '&d d' at /yaml/bin/perl-tiny-json line 12.

perl-tiny-perl

 ni
YAML::Tiny does not support a feature in line '&d d' at /yaml/bin/perl-tiny-perl line 15.