summaryrefslogtreecommitdiff
path: root/node_modules/yaml/dist/parse/parser.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-08-30 17:21:18 +0800
commitefbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch)
tree2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/yaml/dist/parse/parser.js
parent43acceb75957c880a5ba5a31aae221394a36d5f6 (diff)
node fixes, updates
Diffstat (limited to 'node_modules/yaml/dist/parse/parser.js')
-rw-r--r--node_modules/yaml/dist/parse/parser.js23
1 files changed, 11 insertions, 12 deletions
diff --git a/node_modules/yaml/dist/parse/parser.js b/node_modules/yaml/dist/parse/parser.js
index 7a1493d8..91fb676a 100644
--- a/node_modules/yaml/dist/parse/parser.js
+++ b/node_modules/yaml/dist/parse/parser.js
@@ -308,7 +308,7 @@ class Parser {
}
else {
Object.assign(it, { key: token, sep: [] });
- this.onKeyLine = !includesToken(it.start, 'explicit-key-ind');
+ this.onKeyLine = !it.explicitKey;
return;
}
break;
@@ -517,9 +517,9 @@ class Parser {
return;
}
if (this.indent >= map.indent) {
- const atNextItem = !this.onKeyLine &&
- this.indent === map.indent &&
- it.sep &&
+ const atMapIndent = !this.onKeyLine && this.indent === map.indent;
+ const atNextItem = atMapIndent &&
+ (it.sep || it.explicitKey) &&
this.type !== 'seq-item-ind';
// For empty nodes, assign newline-separated not indented empty tokens to following node
let start = [];
@@ -560,25 +560,26 @@ class Parser {
}
return;
case 'explicit-key-ind':
- if (!it.sep && !includesToken(it.start, 'explicit-key-ind')) {
+ if (!it.sep && !it.explicitKey) {
it.start.push(this.sourceToken);
+ it.explicitKey = true;
}
else if (atNextItem || it.value) {
start.push(this.sourceToken);
- map.items.push({ start });
+ map.items.push({ start, explicitKey: true });
}
else {
this.stack.push({
type: 'block-map',
offset: this.offset,
indent: this.indent,
- items: [{ start: [this.sourceToken] }]
+ items: [{ start: [this.sourceToken], explicitKey: true }]
});
}
this.onKeyLine = true;
return;
case 'map-value-ind':
- if (includesToken(it.start, 'explicit-key-ind')) {
+ if (it.explicitKey) {
if (!it.sep) {
if (includesToken(it.start, 'newline')) {
Object.assign(it, { key: null, sep: [this.sourceToken] });
@@ -669,9 +670,7 @@ class Parser {
default: {
const bv = this.startBlockValue(map);
if (bv) {
- if (atNextItem &&
- bv.type !== 'block-seq' &&
- includesToken(it.start, 'explicit-key-ind')) {
+ if (atMapIndent && bv.type !== 'block-seq') {
map.items.push({ start });
}
this.stack.push(bv);
@@ -892,7 +891,7 @@ class Parser {
type: 'block-map',
offset: this.offset,
indent: this.indent,
- items: [{ start }]
+ items: [{ start, explicitKey: true }]
};
}
case 'map-value-ind': {