yaml 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,6 +11,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
11
11
|
if (ctx.atRoot)
|
|
12
12
|
ctx.atRoot = false;
|
|
13
13
|
let offset = bm.offset;
|
|
14
|
+
let commentEnd = null;
|
|
14
15
|
for (const collItem of bm.items) {
|
|
15
16
|
const { start, key, sep, value } = collItem;
|
|
16
17
|
// key properties
|
|
@@ -30,7 +31,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
30
31
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
31
32
|
}
|
|
32
33
|
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
33
|
-
|
|
34
|
+
commentEnd = keyProps.end;
|
|
34
35
|
if (keyProps.comment) {
|
|
35
36
|
if (map.comment)
|
|
36
37
|
map.comment += '\n' + keyProps.comment;
|
|
@@ -100,7 +101,9 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
100
101
|
map.items.push(pair);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
+
if (commentEnd && commentEnd < offset)
|
|
105
|
+
onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');
|
|
106
|
+
map.range = [bm.offset, offset, commentEnd ?? offset];
|
|
104
107
|
return map;
|
|
105
108
|
}
|
|
106
109
|
|
|
@@ -7,6 +7,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
7
7
|
if (ctx.atRoot)
|
|
8
8
|
ctx.atRoot = false;
|
|
9
9
|
let offset = bs.offset;
|
|
10
|
+
let commentEnd = null;
|
|
10
11
|
for (const { start, value } of bs.items) {
|
|
11
12
|
const props = resolveProps(start, {
|
|
12
13
|
indicator: 'seq-item-ind',
|
|
@@ -15,16 +16,15 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
15
16
|
onError,
|
|
16
17
|
startOnNewline: true
|
|
17
18
|
});
|
|
18
|
-
offset = props.end;
|
|
19
19
|
if (!props.found) {
|
|
20
20
|
if (props.anchor || props.tag || value) {
|
|
21
21
|
if (value && value.type === 'block-seq')
|
|
22
|
-
onError(
|
|
22
|
+
onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
|
|
23
23
|
else
|
|
24
24
|
onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
27
|
+
commentEnd = props.end;
|
|
28
28
|
if (props.comment)
|
|
29
29
|
seq.comment = props.comment;
|
|
30
30
|
continue;
|
|
@@ -32,13 +32,13 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
32
32
|
}
|
|
33
33
|
const node = value
|
|
34
34
|
? composeNode(ctx, value, props, onError)
|
|
35
|
-
: composeEmptyNode(ctx,
|
|
35
|
+
: composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
36
36
|
if (ctx.schema.compat)
|
|
37
37
|
flowIndentCheck(bs.indent, value, onError);
|
|
38
38
|
offset = node.range[2];
|
|
39
39
|
seq.items.push(node);
|
|
40
40
|
}
|
|
41
|
-
seq.range = [bs.offset, offset, offset];
|
|
41
|
+
seq.range = [bs.offset, offset, commentEnd ?? offset];
|
|
42
42
|
return seq;
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -13,6 +13,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
13
13
|
if (ctx.atRoot)
|
|
14
14
|
ctx.atRoot = false;
|
|
15
15
|
let offset = bm.offset;
|
|
16
|
+
let commentEnd = null;
|
|
16
17
|
for (const collItem of bm.items) {
|
|
17
18
|
const { start, key, sep, value } = collItem;
|
|
18
19
|
// key properties
|
|
@@ -32,7 +33,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
32
33
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
33
34
|
}
|
|
34
35
|
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
35
|
-
|
|
36
|
+
commentEnd = keyProps.end;
|
|
36
37
|
if (keyProps.comment) {
|
|
37
38
|
if (map.comment)
|
|
38
39
|
map.comment += '\n' + keyProps.comment;
|
|
@@ -102,7 +103,9 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
102
103
|
map.items.push(pair);
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
|
|
106
|
+
if (commentEnd && commentEnd < offset)
|
|
107
|
+
onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');
|
|
108
|
+
map.range = [bm.offset, offset, commentEnd ?? offset];
|
|
106
109
|
return map;
|
|
107
110
|
}
|
|
108
111
|
|
|
@@ -9,6 +9,7 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
9
9
|
if (ctx.atRoot)
|
|
10
10
|
ctx.atRoot = false;
|
|
11
11
|
let offset = bs.offset;
|
|
12
|
+
let commentEnd = null;
|
|
12
13
|
for (const { start, value } of bs.items) {
|
|
13
14
|
const props = resolveProps.resolveProps(start, {
|
|
14
15
|
indicator: 'seq-item-ind',
|
|
@@ -17,16 +18,15 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
17
18
|
onError,
|
|
18
19
|
startOnNewline: true
|
|
19
20
|
});
|
|
20
|
-
offset = props.end;
|
|
21
21
|
if (!props.found) {
|
|
22
22
|
if (props.anchor || props.tag || value) {
|
|
23
23
|
if (value && value.type === 'block-seq')
|
|
24
|
-
onError(
|
|
24
|
+
onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
|
|
25
25
|
else
|
|
26
26
|
onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
|
|
29
|
+
commentEnd = props.end;
|
|
30
30
|
if (props.comment)
|
|
31
31
|
seq.comment = props.comment;
|
|
32
32
|
continue;
|
|
@@ -34,13 +34,13 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
34
34
|
}
|
|
35
35
|
const node = value
|
|
36
36
|
? composeNode(ctx, value, props, onError)
|
|
37
|
-
: composeEmptyNode(ctx,
|
|
37
|
+
: composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
38
38
|
if (ctx.schema.compat)
|
|
39
39
|
utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);
|
|
40
40
|
offset = node.range[2];
|
|
41
41
|
seq.items.push(node);
|
|
42
42
|
}
|
|
43
|
-
seq.range = [bs.offset, offset, offset];
|
|
43
|
+
seq.range = [bs.offset, offset, commentEnd ?? offset];
|
|
44
44
|
return seq;
|
|
45
45
|
}
|
|
46
46
|
|