YAML Framework Matrix

Test #7BMT - Node and Mapping Key Anchors [1.3]

YAML

---
top1: &node1
  &k1 key1: one
top2: &node2 # comment
  key2: two
top3:
  &k3 key3: three
top4: &node4
  &k4 key4: four
top5: &node5
  key5: five
top6: &val6
  six
top7:
  &val7 seven

Expected Events

+STR
+DOC ---
+MAP
=VAL :top1
+MAP &node1
=VAL &k1 :key1
=VAL :one
-MAP
=VAL :top2
+MAP &node2
=VAL :key2
=VAL :two
-MAP
=VAL :top3
+MAP
=VAL &k3 :key3
=VAL :three
-MAP
=VAL :top4
+MAP &node4
=VAL &k4 :key4
=VAL :four
-MAP
=VAL :top5
+MAP &node5
=VAL :key5
=VAL :five
-MAP
=VAL :top6
=VAL &val6 :six
=VAL :top7
=VAL &val7 :seven
-MAP
-DOC
-STR

Expected JSON



cpp-event

 ok

java-event

 ok

java-json

 n/a
{
  "top1": {
    "key1": "one"
  },
  "top2": {
    "key2": "two"
  },
  "top3": {
    "key3": "three"
  },
  "top4": {
    "key4": "four"
  },
  "top5": {
    "key5": "five"
  },
  "top6": "six",
  "top7": "seven"
}

js-yaml-json

 error
YAMLException: duplication of an anchor property at line 3, column 3:
      &k1 key1: one
      ^
    at generateError (/node_modules/js-yaml/lib/js-yaml/loader.js:165:10)
    at throwError (/node_modules/js-yaml/lib/js-yaml/loader.js:171:9)
    at readAnchorProperty (/node_modules/js-yaml/lib/js-yaml/loader.js:1209:5)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1298:38)
    at readBlockMapping (/node_modules/js-yaml/lib/js-yaml/loader.js:1062:11)
    at composeNode (/node_modules/js-yaml/lib/js-yaml/loader.js:1332:12)
    at readDocument (/node_modules/js-yaml/lib/js-yaml/loader.js:1492:3)
    at loadDocuments (/node_modules/js-yaml/lib/js-yaml/loader.js:1548:5)
    at Object.loadAll (/node_modules/js-yaml/lib/js-yaml/loader.js:1556:19)
    at Object.<anonymous> (/bin/js-yaml-json:6:6)
    at Object.<anonymous> (/bin/js-yaml-json:3:1)
    at Module._compile (module.js:410:26)
    at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:173:23)
    at compileScript (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:224:29)
    at compilePath (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:174:14)
    at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:98:20)
    at Object.<anonymous> (/usr/local/lib/node_modules/coffee-script/bin/coffee:7:41)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

libyaml-event

 ok

luajit-json

 n/a
{"top2":{"key2":"two"},"top7":"seven","top6":"six","top5":{"key5":"five"},"top4":{"key4":"four"},"top1":{"key1":"one"},"top3":{"key3":"three"}}

nimyaml-event

 ok

perl5-pegex-event

 error
Maximum parsing rules reached (1000)

perl5-pm-json

 error
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 5
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 736.

perl5-pm-pl

 error
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 5
   Document: 1
 at /lib/perl5/YAML/Loader.pm line 736.

perl5-pp-event

 ok

perl5-pp-json

 n/a
{
   "top1" : {
      "key1" : "one"
   },
   "top2" : {
      "key2" : "two"
   },
   "top3" : {
      "key3" : "three"
   },
   "top4" : {
      "key4" : "four"
   },
   "top5" : {
      "key5" : "five"
   },
   "top6" : "six",
   "top7" : "seven"
}

perl5-pp-pl

 n/a
{
  'top1' => {
              'key1' => 'one'
            },
  'top2' => {
              'key2' => 'two'
            },
  'top3' => {
              'key3' => 'three'
            },
  'top4' => {
              'key4' => 'four'
            },
  'top5' => {
              'key5' => 'five'
            },
  'top6' => 'six',
  'top7' => 'seven'
}

perl5-syck-json

 n/a
{"top1":{"key1":"one"},"top2":{"key2":"two"},"top3":{"key3":"three"},"top4":{"key4":"four"},"top5":{"key5":"five"},"top6":"six","top7":"seven"}

perl5-syck-pl

 n/a
{
  'top1' => {
              'key1' => 'one'
            },
  'top2' => {
              'key2' => 'two'
            },
  'top3' => {
              'key3' => 'three'
            },
  'top4' => {
              'key4' => 'four'
            },
  'top5' => {
              'key5' => 'five'
            },
  'top6' => 'six',
  'top7' => 'seven'
}

perl5-tiny-json

 error
YAML::Tiny does not support a feature in line '&node1' at /bin/perl5-tiny-json line 14.

perl5-tiny-pl

 error
YAML::Tiny does not support a feature in line '&node1' at /bin/perl5-tiny-pl line 13.

perl5-xs-json

 n/a
{"top1":{"key1":"one"},"top2":{"key2":"two"},"top3":{"key3":"three"},"top4":{"key4":"four"},"top5":{"key5":"five"},"top6":"six","top7":"seven"}

perl5-xs-pl

 n/a
{
  'top1' => {
              'key1' => 'one'
            },
  'top2' => {
              'key2' => 'two'
            },
  'top3' => {
              'key3' => 'three'
            },
  'top4' => {
              'key4' => 'four'
            },
  'top5' => {
              'key5' => 'five'
            },
  'top6' => 'six',
  'top7' => 'seven'
}

pyyaml-event

 ok

ruamel-event

 ok

ruby-json

 n/a
{"top1":{"key1":"one"},"top2":{"key2":"two"},"top3":{"key3":"three"},"top4":{"key4":"four"},"top5":{"key5":"five"},"top6":"six","top7":"seven"}