diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2024-08-30 17:21:18 +0800 |
| commit | efbc2ffe6a1ee5ec38a4396305561d6515d0943e (patch) | |
| tree | 2b4c94f18f2c792dfda813050755d5c0273fae22 /node_modules/yaml/browser/dist/parse/parser.js | |
| parent | 43acceb75957c880a5ba5a31aae221394a36d5f6 (diff) | |
node fixes, updates
Diffstat (limited to 'node_modules/yaml/browser/dist/parse/parser.js')
| -rw-r--r-- | node_modules/yaml/browser/dist/parse/parser.js | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/node_modules/yaml/browser/dist/parse/parser.js b/node_modules/yaml/browser/dist/parse/parser.js index 65da03d6..d679c6dc 100644 --- a/node_modules/yaml/browser/dist/parse/parser.js +++ b/node_modules/yaml/browser/dist/parse/parser.js @@ -304,7 +304,7 @@ class Parser { } else { Object.assign(it, { key: token, sep: [] }); - this.onKeyLine = !includesToken(it.start, 'explicit-key-ind'); + this.onKeyLine = !it.explicitKey; return; } break; @@ -513,9 +513,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 = []; @@ -556,25 +556,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] }); @@ -665,9 +666,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); @@ -888,7 +887,7 @@ class Parser { type: 'block-map', offset: this.offset, indent: this.indent, - items: [{ start }] + items: [{ start, explicitKey: true }] }; } case 'map-value-ind': { |
