--- &test-7BMT
Title: Node and Mapping Key Anchors [1.3]
Tags: [ 1.3-mod, anchor, comment, mapping ]
---
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
+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
{
"top1": {
"key1": "one"
},
"top2": {
"key2": "two"
},
"top3": {
"key3": "three"
},
"top4": {
"key4": "four"
},
"top5": {
"key5": "five"
},
"top6": "six",
"top7": "seven"
}
error
/node/node_modules/js-yaml/lib/loader.js:187
throw generateError(state, message);
^
YAMLException: duplication of an anchor property (3:3)
1 | ---
2 | top1: &node1
3 | &k1 key1: one
-------^
4 | top2: &node2 # comment
5 | key2: two
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 readAnchorProperty (/node/node_modules/js-yaml/lib/loader.js:1317:5)
at composeNode (/node/node_modules/js-yaml/lib/loader.js:1407:38)
at readBlockMapping (/node/node_modules/js-yaml/lib/loader.js:1164:11)
at composeNode (/node/node_modules/js-yaml/lib/loader.js:1441:12)
at readDocument (/node/node_modules/js-yaml/lib/loader.js:1625:3)
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) {
reason: 'duplication of an anchor property',
mark: {
name: null,
buffer: '---\n' +
'top1: &node1\n' +
' &k1 key1: one\n' +
'top2: &node2 # comment\n' +
' key2: two\n' +
'top3:\n' +
' &k3 key3: three\n' +
'top4: &node4\n' +
' &k4 key4: four\n' +
'top5: &node5\n' +
' key5: five\n' +
'top6: &val6\n' +
' six\n' +
'top7:\n' +
' &val7 seven\n',
position: 19,
line: 2,
column: 2,
snippet: ' 1 | ---\n' +
' 2 | top1: &node1\n' +
' 3 | &k1 key1: one\n' +
'-------^\n' +
' 4 | top2: &node2 # comment\n' +
' 5 | key2: two'
}
}
Node.js v20.13.1
error
YAML Error: Inconsistent indentation level
Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
Line: 5
Document: 1
at /perl5/lib/perl5/YAML/Loader.pm line 804.
error
YAML Error: Inconsistent indentation level
Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
Line: 5
Document: 1
at /perl5/lib/perl5/YAML/Loader.pm line 804.
na
Line Col Char Byte Token|Content
1 0 0 0 +DOC |
1 0 0 0 =HEAD|---
1 3 3 3 +NODE|
1 3 3 3 =EOL |\x0a
2 0 4 4 +MAP |
2 0 4 4 +PAIR|
2 0 4 4 +NODE|
2 0 4 4 +VAL |
2 0 4 4 =TEXT|top1
2 4 8 8 -VAL |
2 4 8 8 -NODE|
2 4 8 8 =SYNX|:
2 5 9 9 +NODE|
2 5 9 9 =WSPC|.
2 6 10 10 +PROP|
2 6 10 10 +ANCH|
2 6 10 10 =SYNX|&
2 7 11 11 =META|node1
2 12 16 16 -ANCH|
2 12 16 16 -PROP|
2 12 16 16 =EOL |\x0a
3 0 17 17 +MAP |
3 0 17 17 =DENT|..
3 2 19 19 +PAIR|
3 2 19 19 +NODE|
3 2 19 19 +PROP|
3 2 19 19 +ANCH|
3 2 19 19 =SYNX|&
3 3 20 20 =META|k1
3 5 22 22 -ANCH|
3 5 22 22 -PROP|
3 5 22 22 =WSPC|.
3 6 23 23 +VAL |
3 6 23 23 =TEXT|key1
3 10 27 27 -VAL |
3 10 27 27 -NODE|
3 10 27 27 =SYNX|:
3 11 28 28 =WSPC|.
3 12 29 29 +NODE|
3 12 29 29 +VAL |
3 12 29 29 =TEXT|one
3 15 32 32 -VAL |
3 15 32 32 -NODE|
3 15 32 32 =EOL |\x0a
4 0 33 33 -PAIR|
4 0 33 33 -MAP |
4 0 33 33 -NODE|
4 0 33 33 -PAIR|
4 0 33 33 +PAIR|
4 0 33 33 +NODE|
4 0 33 33 +VAL |
4 0 33 33 =TEXT|top2
4 4 37 37 -VAL |
4 4 37 37 -NODE|
4 4 37 37 =SYNX|:
4 5 38 38 +NODE|
4 5 38 38 =WSPC|.
4 6 39 39 +PROP|
4 6 39 39 +ANCH|
4 6 39 39 =SYNX|&
4 7 40 40 =META|node2
4 12 45 45 -ANCH|
4 12 45 45 -PROP|
4 12 45 45 =WSPC|.
4 13 46 46 +COMM|
4 13 46 46 =SYNX|#
4 14 47 47 =META|.comment
4 22 55 55 -COMM|
4 22 55 55 =EOL |\x0a
5 0 56 56 +MAP |
5 0 56 56 =DENT|..
5 2 58 58 +PAIR|
5 2 58 58 +NODE|
5 2 58 58 +VAL |
5 2 58 58 =TEXT|key2
5 6 62 62 -VAL |
5 6 62 62 -NODE|
5 6 62 62 =SYNX|:
5 7 63 63 =WSPC|.
5 8 64 64 +NODE|
5 8 64 64 +VAL |
5 8 64 64 =TEXT|two
5 11 67 67 -VAL |
5 11 67 67 -NODE|
5 11 67 67 =EOL |\x0a
6 0 68 68 -PAIR|
6 0 68 68 -MAP |
6 0 68 68 -NODE|
6 0 68 68 -PAIR|
6 0 68 68 +PAIR|
6 0 68 68 +NODE|
6 0 68 68 +VAL |
6 0 68 68 =TEXT|top3
6 4 72 72 -VAL |
6 4 72 72 -NODE|
6 4 72 72 =SYNX|:
6 5 73 73 +NODE|
6 5 73 73 =EOL |\x0a
7 0 74 74 +MAP |
7 0 74 74 =DENT|..
7 2 76 76 +PAIR|
7 2 76 76 +NODE|
7 2 76 76 +PROP|
7 2 76 76 +ANCH|
7 2 76 76 =SYNX|&
7 3 77 77 =META|k3
7 5 79 79 -ANCH|
7 5 79 79 -PROP|
7 5 79 79 =WSPC|.
7 6 80 80 +VAL |
7 6 80 80 =TEXT|key3
7 10 84 84 -VAL |
7 10 84 84 -NODE|
7 10 84 84 =SYNX|:
7 11 85 85 =WSPC|.
7 12 86 86 +NODE|
7 12 86 86 +VAL |
7 12 86 86 =TEXT|three
7 17 91 91 -VAL |
7 17 91 91 -NODE|
7 17 91 91 =EOL |\x0a
8 0 92 92 -PAIR|
8 0 92 92 -MAP |
8 0 92 92 -NODE|
8 0 92 92 -PAIR|
8 0 92 92 +PAIR|
8 0 92 92 +NODE|
8 0 92 92 +VAL |
8 0 92 92 =TEXT|top4
8 4 96 96 -VAL |
8 4 96 96 -NODE|
8 4 96 96 =SYNX|:
8 5 97 97 +NODE|
8 5 97 97 =WSPC|.
8 6 98 98 +PROP|
8 6 98 98 +ANCH|
8 6 98 98 =SYNX|&
8 7 99 99 =META|node4
8 12 104 104 -ANCH|
8 12 104 104 -PROP|
8 12 104 104 =EOL |\x0a
9 0 105 105 +MAP |
9 0 105 105 =DENT|..
9 2 107 107 +PAIR|
9 2 107 107 +NODE|
9 2 107 107 +PROP|
9 2 107 107 +ANCH|
9 2 107 107 =SYNX|&
9 3 108 108 =META|k4
9 5 110 110 -ANCH|
9 5 110 110 -PROP|
9 5 110 110 =WSPC|.
9 6 111 111 +VAL |
9 6 111 111 =TEXT|key4
9 10 115 115 -VAL |
9 10 115 115 -NODE|
9 10 115 115 =SYNX|:
9 11 116 116 =WSPC|.
9 12 117 117 +NODE|
9 12 117 117 +VAL |
9 12 117 117 =TEXT|four
9 16 121 121 -VAL |
9 16 121 121 -NODE|
9 16 121 121 =EOL |\x0a
10 0 122 122 -PAIR|
10 0 122 122 -MAP |
10 0 122 122 -NODE|
10 0 122 122 -PAIR|
10 0 122 122 +PAIR|
10 0 122 122 +NODE|
10 0 122 122 +VAL |
10 0 122 122 =TEXT|top5
10 4 126 126 -VAL |
10 4 126 126 -NODE|
10 4 126 126 =SYNX|:
10 5 127 127 +NODE|
10 5 127 127 =WSPC|.
10 6 128 128 +PROP|
10 6 128 128 +ANCH|
10 6 128 128 =SYNX|&
10 7 129 129 =META|node5
10 12 134 134 -ANCH|
10 12 134 134 -PROP|
10 12 134 134 =EOL |\x0a
11 0 135 135 +MAP |
11 0 135 135 =DENT|..
11 2 137 137 +PAIR|
11 2 137 137 +NODE|
11 2 137 137 +VAL |
11 2 137 137 =TEXT|key5
11 6 141 141 -VAL |
11 6 141 141 -NODE|
11 6 141 141 =SYNX|:
11 7 142 142 =WSPC|.
11 8 143 143 +NODE|
11 8 143 143 +VAL |
11 8 143 143 =TEXT|five
11 12 147 147 -VAL |
11 12 147 147 -NODE|
11 12 147 147 =EOL |\x0a
----- 8< -----
na
{
'top1' => {
'key1' => 'one'
},
'top2' => {
'key2' => 'two'
},
'top3' => {
'key3' => 'three'
},
'top4' => {
'key4' => 'four'
},
'top5' => {
'key5' => 'five'
},
'top6' => 'six',
'top7' => 'seven'
}
na
{
'top1' => {
'key1' => 'one'
},
'top2' => {
'key2' => 'two'
},
'top3' => {
'key3' => 'three'
},
'top4' => {
'key4' => 'four'
},
'top5' => {
'key5' => 'five'
},
'top6' => 'six',
'top7' => 'seven'
}
na
{
'top1' => {
'key1' => 'one'
},
'top2' => {
'key2' => 'two'
},
'top3' => {
'key3' => 'three'
},
'top4' => {
'key4' => 'four'
},
'top5' => {
'key5' => 'five'
},
'top6' => 'six',
'top7' => 'seven'
}
na
{
'top1' => {
'key1' => 'one'
},
'top2' => {
'key2' => 'two'
},
'top3' => {
'key3' => 'three'
},
'top4' => {
'key4' => 'four'
},
'top5' => {
'key5' => 'five'
},
'top6' => 'six',
'top7' => 'seven'
}
na
{'top1': {'key1': 'one'},
'top2': {'key2': 'two'},
'top3': {'key3': 'three'},
'top4': {'key4': 'four'},
'top5': {'key5': 'five'},
'top6': 'six',
'top7': 'seven'}
na
{'top1': {'key1': 'one'},
'top2': {'key2': 'two'},
'top3': {'key3': 'three'},
'top4': {'key4': 'four'},
'top5': {'key5': 'five'},
'top6': 'six',
'top7': 'seven'}
ni
YAML::Tiny does not support a feature in line '&node1' at /yaml/bin/perl-tiny-json line 12.
ni
YAML::Tiny does not support a feature in line '&node1' at /yaml/bin/perl-tiny-perl line 15.