@bolt-foundry/gambit-core 0.8.0 → 0.8.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.
- package/README.md +28 -32
- package/cards/context.card.md +5 -5
- package/cards/generate-test-input.card.md +12 -0
- package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/_utils.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/_utils.js +1 -1
- package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/deep_merge.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/deep_merge.js +1 -1
- package/esm/deps/jsr.io/@std/front-matter/1.0.9/yaml.js +1 -1
- package/esm/deps/jsr.io/@std/toml/1.0.11/_parser.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.js +1 -1
- package/{script/deps/jsr.io/@std/yaml/1.0.10 → esm/deps/jsr.io/@std/yaml/1.0.11}/_loader_state.d.ts +21 -18
- package/esm/deps/jsr.io/@std/yaml/1.0.11/_loader_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_loader_state.js +250 -273
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.js +1 -1
- package/{script/deps/jsr.io/@std/yaml/1.0.10 → esm/deps/jsr.io/@std/yaml/1.0.11}/_type/map.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/map.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.js +1 -1
- package/{script/deps/jsr.io/@std/yaml/1.0.10 → esm/deps/jsr.io/@std/yaml/1.0.11}/_type/seq.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/seq.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.js +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.js +1 -1
- package/esm/mod.d.ts +11 -33
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +7 -3
- package/esm/src/constants.d.ts +4 -0
- package/esm/src/constants.d.ts.map +1 -1
- package/esm/src/constants.js +5 -0
- package/esm/src/definitions.d.ts +5 -1
- package/esm/src/definitions.d.ts.map +1 -1
- package/esm/src/loader.d.ts.map +1 -1
- package/esm/src/loader.js +61 -2
- package/esm/src/markdown.d.ts.map +1 -1
- package/esm/src/markdown.js +55 -12
- package/esm/src/render.d.ts.map +1 -1
- package/esm/src/render.js +22 -8
- package/esm/src/runtime.d.ts +1 -0
- package/esm/src/runtime.d.ts.map +1 -1
- package/esm/src/runtime.js +327 -172
- package/esm/src/state.d.ts +5 -4
- package/esm/src/state.d.ts.map +1 -1
- package/esm/src/state.js +48 -2
- package/esm/src/types.d.ts +156 -281
- package/esm/src/types.d.ts.map +1 -1
- package/esm/src/types.js +102 -1
- package/package.json +1 -1
- package/schemas/graders/grader_output.ts +7 -0
- package/script/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/_utils.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/_utils.js +1 -1
- package/script/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/deep_merge.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/deep_merge.js +1 -1
- package/script/deps/jsr.io/@std/front-matter/1.0.9/yaml.js +1 -1
- package/script/deps/jsr.io/@std/toml/1.0.11/_parser.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.js +1 -1
- package/{esm/deps/jsr.io/@std/yaml/1.0.10 → script/deps/jsr.io/@std/yaml/1.0.11}/_loader_state.d.ts +21 -18
- package/script/deps/jsr.io/@std/yaml/1.0.11/_loader_state.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_loader_state.js +250 -273
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.js +1 -1
- package/{esm/deps/jsr.io/@std/yaml/1.0.10 → script/deps/jsr.io/@std/yaml/1.0.11}/_type/map.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/map.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.js +1 -1
- package/{esm/deps/jsr.io/@std/yaml/1.0.10 → script/deps/jsr.io/@std/yaml/1.0.11}/_type/seq.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/seq.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.js +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.d.ts.map +1 -1
- package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.js +1 -1
- package/script/mod.d.ts +11 -33
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +14 -6
- package/script/src/constants.d.ts +4 -0
- package/script/src/constants.d.ts.map +1 -1
- package/script/src/constants.js +6 -1
- package/script/src/definitions.d.ts +5 -1
- package/script/src/definitions.d.ts.map +1 -1
- package/script/src/loader.d.ts.map +1 -1
- package/script/src/loader.js +61 -2
- package/script/src/markdown.d.ts.map +1 -1
- package/script/src/markdown.js +54 -11
- package/script/src/render.d.ts.map +1 -1
- package/script/src/render.js +22 -8
- package/script/src/runtime.d.ts +1 -0
- package/script/src/runtime.d.ts.map +1 -1
- package/script/src/runtime.js +326 -171
- package/script/src/state.d.ts +5 -4
- package/script/src/state.d.ts.map +1 -1
- package/script/src/state.js +48 -2
- package/script/src/types.d.ts +156 -281
- package/script/src/types.d.ts.map +1 -1
- package/script/src/types.js +103 -0
- package/esm/deps/jsr.io/@std/yaml/1.0.10/_loader_state.d.ts.map +0 -1
- package/esm/src/openai_compat.d.ts +0 -63
- package/esm/src/openai_compat.d.ts.map +0 -1
- package/esm/src/openai_compat.js +0 -339
- package/esm/src/openresponses.d.ts +0 -6
- package/esm/src/openresponses.d.ts.map +0 -1
- package/esm/src/openresponses.js +0 -75
- package/script/deps/jsr.io/@std/yaml/1.0.10/_loader_state.d.ts.map +0 -1
- package/script/src/openai_compat.d.ts +0 -63
- package/script/src/openai_compat.d.ts.map +0 -1
- package/script/src/openai_compat.js +0 -343
- package/script/src/openresponses.d.ts +0 -6
- package/script/src/openresponses.d.ts.map +0 -1
- package/script/src/openresponses.js +0 -81
- /package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/_utils.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/deep_merge.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.js +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/map.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/seq.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.d.ts +0 -0
- /package/script/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/_utils.d.ts +0 -0
- /package/script/deps/jsr.io/@std/collections/{1.1.3 → 1.1.4}/deep_merge.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_chars.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_schema.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/binary.js +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/bool.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/float.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/int.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/map.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/merge.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/nil.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/omap.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/pairs.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/regexp.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/seq.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/set.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/str.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/timestamp.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type/undefined.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_type.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/_utils.d.ts +0 -0
- /package/script/deps/jsr.io/@std/yaml/{1.0.10 → 1.0.11}/parse.d.ts +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Ported from js-yaml v3.13.1:
|
|
3
3
|
// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
|
|
4
4
|
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
|
|
5
|
-
// Copyright 2018-
|
|
5
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
6
6
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
7
7
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
8
8
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -126,6 +126,20 @@ function markToString(buffer, position, line, column) {
|
|
|
126
126
|
where += `:\n${snippet}`;
|
|
127
127
|
return where;
|
|
128
128
|
}
|
|
129
|
+
function getIndentStatus(lineIndent, parentIndent) {
|
|
130
|
+
if (lineIndent > parentIndent)
|
|
131
|
+
return 1;
|
|
132
|
+
if (lineIndent < parentIndent)
|
|
133
|
+
return -1;
|
|
134
|
+
return 0;
|
|
135
|
+
}
|
|
136
|
+
function writeFoldedLines(count) {
|
|
137
|
+
if (count === 1)
|
|
138
|
+
return " ";
|
|
139
|
+
if (count > 1)
|
|
140
|
+
return "\n".repeat(count - 1);
|
|
141
|
+
return "";
|
|
142
|
+
}
|
|
129
143
|
class LoaderState {
|
|
130
144
|
constructor(input, { schema = _schema_js_1.DEFAULT_SCHEMA, onWarning, allowDuplicateKeys = false, }) {
|
|
131
145
|
_LoaderState_instances.add(this);
|
|
@@ -207,30 +221,6 @@ class LoaderState {
|
|
|
207
221
|
writable: true,
|
|
208
222
|
value: new Map()
|
|
209
223
|
});
|
|
210
|
-
Object.defineProperty(this, "tag", {
|
|
211
|
-
enumerable: true,
|
|
212
|
-
configurable: true,
|
|
213
|
-
writable: true,
|
|
214
|
-
value: void 0
|
|
215
|
-
});
|
|
216
|
-
Object.defineProperty(this, "anchor", {
|
|
217
|
-
enumerable: true,
|
|
218
|
-
configurable: true,
|
|
219
|
-
writable: true,
|
|
220
|
-
value: void 0
|
|
221
|
-
});
|
|
222
|
-
Object.defineProperty(this, "kind", {
|
|
223
|
-
enumerable: true,
|
|
224
|
-
configurable: true,
|
|
225
|
-
writable: true,
|
|
226
|
-
value: void 0
|
|
227
|
-
});
|
|
228
|
-
Object.defineProperty(this, "result", {
|
|
229
|
-
enumerable: true,
|
|
230
|
-
configurable: true,
|
|
231
|
-
writable: true,
|
|
232
|
-
value: ""
|
|
233
|
-
});
|
|
234
224
|
this.input = input;
|
|
235
225
|
this.onWarning = onWarning;
|
|
236
226
|
this.allowDuplicateKeys = allowDuplicateKeys;
|
|
@@ -323,17 +313,14 @@ class LoaderState {
|
|
|
323
313
|
else if (PATTERN_NON_PRINTABLE.test(result)) {
|
|
324
314
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Stream contains non-printable characters");
|
|
325
315
|
}
|
|
326
|
-
|
|
316
|
+
return result;
|
|
327
317
|
}
|
|
328
318
|
}
|
|
329
|
-
readBlockSequence(nodeIndent) {
|
|
319
|
+
readBlockSequence(tag, anchor, nodeIndent) {
|
|
330
320
|
let detected = false;
|
|
331
|
-
const tag = this.tag;
|
|
332
|
-
const anchor = this.anchor;
|
|
333
321
|
const result = [];
|
|
334
|
-
if (
|
|
335
|
-
this.anchorMap.set(
|
|
336
|
-
}
|
|
322
|
+
if (anchor !== null)
|
|
323
|
+
this.anchorMap.set(anchor, result);
|
|
337
324
|
let ch = this.peek();
|
|
338
325
|
while (ch !== 0) {
|
|
339
326
|
if (ch !== _chars_js_1.MINUS) {
|
|
@@ -353,13 +340,14 @@ class LoaderState {
|
|
|
353
340
|
}
|
|
354
341
|
}
|
|
355
342
|
const line = this.line;
|
|
356
|
-
this.composeNode({
|
|
343
|
+
const newState = this.composeNode({
|
|
357
344
|
parentIndent: nodeIndent,
|
|
358
345
|
nodeContext: CONTEXT_BLOCK_IN,
|
|
359
346
|
allowToSeek: false,
|
|
360
347
|
allowCompact: true,
|
|
361
348
|
});
|
|
362
|
-
|
|
349
|
+
if (newState)
|
|
350
|
+
result.push(newState.result);
|
|
363
351
|
this.skipSeparationSpace(true, -1);
|
|
364
352
|
ch = this.peek();
|
|
365
353
|
if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) {
|
|
@@ -369,14 +357,8 @@ class LoaderState {
|
|
|
369
357
|
break;
|
|
370
358
|
}
|
|
371
359
|
}
|
|
372
|
-
if (detected)
|
|
373
|
-
|
|
374
|
-
this.anchor = anchor;
|
|
375
|
-
this.kind = "sequence";
|
|
376
|
-
this.result = result;
|
|
377
|
-
return true;
|
|
378
|
-
}
|
|
379
|
-
return false;
|
|
360
|
+
if (detected)
|
|
361
|
+
return { tag, anchor, kind: "sequence", result };
|
|
380
362
|
}
|
|
381
363
|
mergeMappings(destination, source, overridableKeys) {
|
|
382
364
|
if (!(0, _utils_js_1.isObject)(source)) {
|
|
@@ -504,17 +486,7 @@ class LoaderState {
|
|
|
504
486
|
}
|
|
505
487
|
return false;
|
|
506
488
|
}
|
|
507
|
-
|
|
508
|
-
if (count === 1) {
|
|
509
|
-
this.result += " ";
|
|
510
|
-
}
|
|
511
|
-
else if (count > 1) {
|
|
512
|
-
this.result += "\n".repeat(count - 1);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
readPlainScalar(nodeIndent, withinFlowCollection) {
|
|
516
|
-
const kind = this.kind;
|
|
517
|
-
const result = this.result;
|
|
489
|
+
readPlainScalar(tag, anchor, nodeIndent, withinFlowCollection) {
|
|
518
490
|
let ch = this.peek();
|
|
519
491
|
if ((0, _chars_js_1.isWhiteSpaceOrEOL)(ch) ||
|
|
520
492
|
(0, _chars_js_1.isFlowIndicator)(ch) ||
|
|
@@ -529,18 +501,17 @@ class LoaderState {
|
|
|
529
501
|
ch === _chars_js_1.PERCENT ||
|
|
530
502
|
ch === _chars_js_1.COMMERCIAL_AT ||
|
|
531
503
|
ch === _chars_js_1.GRAVE_ACCENT) {
|
|
532
|
-
return
|
|
504
|
+
return;
|
|
533
505
|
}
|
|
534
506
|
let following;
|
|
535
507
|
if (ch === _chars_js_1.QUESTION || ch === _chars_js_1.MINUS) {
|
|
536
508
|
following = this.peek(1);
|
|
537
509
|
if ((0, _chars_js_1.isWhiteSpaceOrEOL)(following) ||
|
|
538
510
|
(withinFlowCollection && (0, _chars_js_1.isFlowIndicator)(following))) {
|
|
539
|
-
return
|
|
511
|
+
return;
|
|
540
512
|
}
|
|
541
513
|
}
|
|
542
|
-
|
|
543
|
-
this.result = "";
|
|
514
|
+
let result = "";
|
|
544
515
|
let captureEnd = this.position;
|
|
545
516
|
let captureStart = this.position;
|
|
546
517
|
let hasPendingContent = false;
|
|
@@ -582,8 +553,10 @@ class LoaderState {
|
|
|
582
553
|
}
|
|
583
554
|
}
|
|
584
555
|
if (hasPendingContent) {
|
|
585
|
-
this.captureSegment(captureStart, captureEnd, false);
|
|
586
|
-
|
|
556
|
+
const segment = this.captureSegment(captureStart, captureEnd, false);
|
|
557
|
+
if (segment)
|
|
558
|
+
result += segment;
|
|
559
|
+
result += writeFoldedLines(this.line - line);
|
|
587
560
|
captureStart = captureEnd = this.position;
|
|
588
561
|
hasPendingContent = false;
|
|
589
562
|
}
|
|
@@ -592,28 +565,28 @@ class LoaderState {
|
|
|
592
565
|
}
|
|
593
566
|
ch = this.next();
|
|
594
567
|
}
|
|
595
|
-
this.captureSegment(captureStart, captureEnd, false);
|
|
596
|
-
if (
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
568
|
+
const segment = this.captureSegment(captureStart, captureEnd, false);
|
|
569
|
+
if (segment)
|
|
570
|
+
result += segment;
|
|
571
|
+
if (anchor !== null)
|
|
572
|
+
this.anchorMap.set(anchor, result);
|
|
573
|
+
if (result)
|
|
574
|
+
return { tag, anchor, kind: "scalar", result };
|
|
602
575
|
}
|
|
603
|
-
readSingleQuotedScalar(nodeIndent) {
|
|
576
|
+
readSingleQuotedScalar(tag, anchor, nodeIndent) {
|
|
604
577
|
let ch = this.peek();
|
|
605
|
-
if (ch !== _chars_js_1.SINGLE_QUOTE)
|
|
606
|
-
return
|
|
607
|
-
|
|
608
|
-
this.kind = "scalar";
|
|
609
|
-
this.result = "";
|
|
578
|
+
if (ch !== _chars_js_1.SINGLE_QUOTE)
|
|
579
|
+
return;
|
|
580
|
+
let result = "";
|
|
610
581
|
this.position++;
|
|
611
582
|
let captureStart = this.position;
|
|
612
583
|
let captureEnd = this.position;
|
|
613
584
|
ch = this.peek();
|
|
614
585
|
while (ch !== 0) {
|
|
615
586
|
if (ch === _chars_js_1.SINGLE_QUOTE) {
|
|
616
|
-
this.captureSegment(captureStart, this.position, true);
|
|
587
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
588
|
+
if (segment)
|
|
589
|
+
result += segment;
|
|
617
590
|
ch = this.next();
|
|
618
591
|
if (ch === _chars_js_1.SINGLE_QUOTE) {
|
|
619
592
|
captureStart = this.position;
|
|
@@ -621,12 +594,16 @@ class LoaderState {
|
|
|
621
594
|
captureEnd = this.position;
|
|
622
595
|
}
|
|
623
596
|
else {
|
|
624
|
-
|
|
597
|
+
if (anchor !== null)
|
|
598
|
+
this.anchorMap.set(anchor, result);
|
|
599
|
+
return { tag, anchor, kind: "scalar", result };
|
|
625
600
|
}
|
|
626
601
|
}
|
|
627
602
|
else if ((0, _chars_js_1.isEOL)(ch)) {
|
|
628
|
-
this.captureSegment(captureStart, captureEnd, true);
|
|
629
|
-
|
|
603
|
+
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
604
|
+
if (segment)
|
|
605
|
+
result += segment;
|
|
606
|
+
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
630
607
|
captureStart = captureEnd = this.position;
|
|
631
608
|
}
|
|
632
609
|
else if (this.position === this.lineStart &&
|
|
@@ -641,13 +618,11 @@ class LoaderState {
|
|
|
641
618
|
}
|
|
642
619
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the stream within a single quoted scalar");
|
|
643
620
|
}
|
|
644
|
-
readDoubleQuotedScalar(nodeIndent) {
|
|
621
|
+
readDoubleQuotedScalar(tag, anchor, nodeIndent) {
|
|
645
622
|
let ch = this.peek();
|
|
646
|
-
if (ch !== _chars_js_1.DOUBLE_QUOTE)
|
|
647
|
-
return
|
|
648
|
-
|
|
649
|
-
this.kind = "scalar";
|
|
650
|
-
this.result = "";
|
|
623
|
+
if (ch !== _chars_js_1.DOUBLE_QUOTE)
|
|
624
|
+
return;
|
|
625
|
+
let result = "";
|
|
651
626
|
this.position++;
|
|
652
627
|
let captureEnd = this.position;
|
|
653
628
|
let captureStart = this.position;
|
|
@@ -655,18 +630,24 @@ class LoaderState {
|
|
|
655
630
|
ch = this.peek();
|
|
656
631
|
while (ch !== 0) {
|
|
657
632
|
if (ch === _chars_js_1.DOUBLE_QUOTE) {
|
|
658
|
-
this.captureSegment(captureStart, this.position, true);
|
|
633
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
634
|
+
if (segment)
|
|
635
|
+
result += segment;
|
|
659
636
|
this.position++;
|
|
660
|
-
|
|
637
|
+
if (anchor !== null)
|
|
638
|
+
this.anchorMap.set(anchor, result);
|
|
639
|
+
return { tag, anchor, kind: "scalar", result };
|
|
661
640
|
}
|
|
662
641
|
if (ch === _chars_js_1.BACKSLASH) {
|
|
663
|
-
this.captureSegment(captureStart, this.position, true);
|
|
642
|
+
const segment = this.captureSegment(captureStart, this.position, true);
|
|
643
|
+
if (segment)
|
|
644
|
+
result += segment;
|
|
664
645
|
ch = this.next();
|
|
665
646
|
if ((0, _chars_js_1.isEOL)(ch)) {
|
|
666
647
|
this.skipSeparationSpace(false, nodeIndent);
|
|
667
648
|
}
|
|
668
649
|
else if (ch < 256 && SIMPLE_ESCAPE_SEQUENCES.has(ch)) {
|
|
669
|
-
|
|
650
|
+
result += SIMPLE_ESCAPE_SEQUENCES.get(ch);
|
|
670
651
|
this.position++;
|
|
671
652
|
}
|
|
672
653
|
else if ((tmp = ESCAPED_HEX_LENGTHS.get(ch) ?? 0) > 0) {
|
|
@@ -681,7 +662,7 @@ class LoaderState {
|
|
|
681
662
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read double quoted scalar: expected hexadecimal character");
|
|
682
663
|
}
|
|
683
664
|
}
|
|
684
|
-
|
|
665
|
+
result += codepointToChar(hexResult);
|
|
685
666
|
this.position++;
|
|
686
667
|
}
|
|
687
668
|
else {
|
|
@@ -690,8 +671,10 @@ class LoaderState {
|
|
|
690
671
|
captureStart = captureEnd = this.position;
|
|
691
672
|
}
|
|
692
673
|
else if ((0, _chars_js_1.isEOL)(ch)) {
|
|
693
|
-
this.captureSegment(captureStart, captureEnd, true);
|
|
694
|
-
|
|
674
|
+
const segment = this.captureSegment(captureStart, captureEnd, true);
|
|
675
|
+
if (segment)
|
|
676
|
+
result += segment;
|
|
677
|
+
result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
|
|
695
678
|
captureStart = captureEnd = this.position;
|
|
696
679
|
}
|
|
697
680
|
else if (this.position === this.lineStart &&
|
|
@@ -706,7 +689,7 @@ class LoaderState {
|
|
|
706
689
|
}
|
|
707
690
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Unexpected end of the stream within a double quoted scalar");
|
|
708
691
|
}
|
|
709
|
-
readFlowCollection(nodeIndent) {
|
|
692
|
+
readFlowCollection(tag, anchor, nodeIndent) {
|
|
710
693
|
let ch = this.peek();
|
|
711
694
|
let terminator;
|
|
712
695
|
let isMapping = true;
|
|
@@ -720,14 +703,11 @@ class LoaderState {
|
|
|
720
703
|
terminator = _chars_js_1.RIGHT_CURLY_BRACKET;
|
|
721
704
|
}
|
|
722
705
|
else {
|
|
723
|
-
return
|
|
724
|
-
}
|
|
725
|
-
if (this.anchor !== null && typeof this.anchor !== "undefined") {
|
|
726
|
-
this.anchorMap.set(this.anchor, result);
|
|
706
|
+
return;
|
|
727
707
|
}
|
|
708
|
+
if (anchor !== null)
|
|
709
|
+
this.anchorMap.set(anchor, result);
|
|
728
710
|
ch = this.next();
|
|
729
|
-
const tag = this.tag;
|
|
730
|
-
const anchor = this.anchor;
|
|
731
711
|
let readNext = true;
|
|
732
712
|
let valueNode = null;
|
|
733
713
|
let keyNode = null;
|
|
@@ -742,11 +722,8 @@ class LoaderState {
|
|
|
742
722
|
ch = this.peek();
|
|
743
723
|
if (ch === terminator) {
|
|
744
724
|
this.position++;
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
this.kind = isMapping ? "mapping" : "sequence";
|
|
748
|
-
this.result = result;
|
|
749
|
-
return true;
|
|
725
|
+
const kind = isMapping ? "mapping" : "sequence";
|
|
726
|
+
return { tag, anchor, kind, result };
|
|
750
727
|
}
|
|
751
728
|
if (!readNext) {
|
|
752
729
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read flow collection: missing comma between flow collection entries");
|
|
@@ -762,27 +739,30 @@ class LoaderState {
|
|
|
762
739
|
}
|
|
763
740
|
}
|
|
764
741
|
line = this.line;
|
|
765
|
-
this.composeNode({
|
|
742
|
+
const newState = this.composeNode({
|
|
766
743
|
parentIndent: nodeIndent,
|
|
767
744
|
nodeContext: CONTEXT_FLOW_IN,
|
|
768
745
|
allowToSeek: false,
|
|
769
746
|
allowCompact: true,
|
|
770
747
|
});
|
|
771
|
-
|
|
772
|
-
|
|
748
|
+
if (newState) {
|
|
749
|
+
keyTag = newState.tag || null;
|
|
750
|
+
keyNode = newState.result;
|
|
751
|
+
}
|
|
773
752
|
this.skipSeparationSpace(true, nodeIndent);
|
|
774
753
|
ch = this.peek();
|
|
775
754
|
if ((isExplicitPair || this.line === line) && ch === _chars_js_1.COLON) {
|
|
776
755
|
isPair = true;
|
|
777
756
|
ch = this.next();
|
|
778
757
|
this.skipSeparationSpace(true, nodeIndent);
|
|
779
|
-
this.composeNode({
|
|
758
|
+
const newState = this.composeNode({
|
|
780
759
|
parentIndent: nodeIndent,
|
|
781
760
|
nodeContext: CONTEXT_FLOW_IN,
|
|
782
761
|
allowToSeek: false,
|
|
783
762
|
allowCompact: true,
|
|
784
763
|
});
|
|
785
|
-
|
|
764
|
+
if (newState)
|
|
765
|
+
valueNode = newState.result;
|
|
786
766
|
}
|
|
787
767
|
if (isMapping) {
|
|
788
768
|
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode);
|
|
@@ -807,7 +787,7 @@ class LoaderState {
|
|
|
807
787
|
}
|
|
808
788
|
// Handles block scaler styles: e.g. '|', '>', '|-' and '>-'.
|
|
809
789
|
// https://yaml.org/spec/1.2.2/#81-block-scalar-styles
|
|
810
|
-
readBlockScalar(nodeIndent) {
|
|
790
|
+
readBlockScalar(tag, anchor, nodeIndent) {
|
|
811
791
|
let chomping = CHOMPING_CLIP;
|
|
812
792
|
let didReadContent = false;
|
|
813
793
|
let detectedIndent = false;
|
|
@@ -823,10 +803,9 @@ class LoaderState {
|
|
|
823
803
|
folding = true;
|
|
824
804
|
}
|
|
825
805
|
else {
|
|
826
|
-
return
|
|
806
|
+
return;
|
|
827
807
|
}
|
|
828
|
-
|
|
829
|
-
this.result = "";
|
|
808
|
+
let result = "";
|
|
830
809
|
let tmp = 0;
|
|
831
810
|
while (ch !== 0) {
|
|
832
811
|
ch = this.next();
|
|
@@ -879,12 +858,12 @@ class LoaderState {
|
|
|
879
858
|
if (this.lineIndent < textIndent) {
|
|
880
859
|
// Perform the chomping.
|
|
881
860
|
if (chomping === CHOMPING_KEEP) {
|
|
882
|
-
|
|
861
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
883
862
|
}
|
|
884
863
|
else if (chomping === CHOMPING_CLIP) {
|
|
885
864
|
if (didReadContent) {
|
|
886
865
|
// i.e. only if the scalar is not empty.
|
|
887
|
-
|
|
866
|
+
result += "\n";
|
|
888
867
|
}
|
|
889
868
|
}
|
|
890
869
|
// Break this `while` cycle and go to the function's epilogue.
|
|
@@ -896,29 +875,29 @@ class LoaderState {
|
|
|
896
875
|
if ((0, _chars_js_1.isWhiteSpace)(ch)) {
|
|
897
876
|
atMoreIndented = true;
|
|
898
877
|
// except for the first content line (cf. Example 8.1)
|
|
899
|
-
|
|
878
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
900
879
|
// End of more-indented block.
|
|
901
880
|
}
|
|
902
881
|
else if (atMoreIndented) {
|
|
903
882
|
atMoreIndented = false;
|
|
904
|
-
|
|
883
|
+
result += "\n".repeat(emptyLines + 1);
|
|
905
884
|
// Just one line break - perceive as the same line.
|
|
906
885
|
}
|
|
907
886
|
else if (emptyLines === 0) {
|
|
908
887
|
if (didReadContent) {
|
|
909
888
|
// i.e. only if we have already read some scalar content.
|
|
910
|
-
|
|
889
|
+
result += " ";
|
|
911
890
|
}
|
|
912
891
|
// Several line breaks - perceive as different lines.
|
|
913
892
|
}
|
|
914
893
|
else {
|
|
915
|
-
|
|
894
|
+
result += "\n".repeat(emptyLines);
|
|
916
895
|
}
|
|
917
896
|
// Literal style: just add exact number of line breaks between content lines.
|
|
918
897
|
}
|
|
919
898
|
else {
|
|
920
899
|
// Keep all line breaks except the header line break.
|
|
921
|
-
|
|
900
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
922
901
|
}
|
|
923
902
|
didReadContent = true;
|
|
924
903
|
detectedIndent = true;
|
|
@@ -927,13 +906,15 @@ class LoaderState {
|
|
|
927
906
|
while (!(0, _chars_js_1.isEOL)(ch) && ch !== 0) {
|
|
928
907
|
ch = this.next();
|
|
929
908
|
}
|
|
930
|
-
this.captureSegment(captureStart, this.position, false);
|
|
909
|
+
const segment = this.captureSegment(captureStart, this.position, false);
|
|
910
|
+
if (segment)
|
|
911
|
+
result += segment;
|
|
931
912
|
}
|
|
932
|
-
|
|
913
|
+
if (anchor !== null)
|
|
914
|
+
this.anchorMap.set(anchor, result);
|
|
915
|
+
return { tag, anchor, kind: "scalar", result };
|
|
933
916
|
}
|
|
934
|
-
readBlockMapping(nodeIndent, flowIndent) {
|
|
935
|
-
const tag = this.tag;
|
|
936
|
-
const anchor = this.anchor;
|
|
917
|
+
readBlockMapping(tag, anchor, nodeIndent, flowIndent) {
|
|
937
918
|
const result = {};
|
|
938
919
|
const overridableKeys = new Set();
|
|
939
920
|
let allowCompact = false;
|
|
@@ -944,9 +925,8 @@ class LoaderState {
|
|
|
944
925
|
let valueNode = null;
|
|
945
926
|
let atExplicitKey = false;
|
|
946
927
|
let detected = false;
|
|
947
|
-
if (
|
|
948
|
-
this.anchorMap.set(
|
|
949
|
-
}
|
|
928
|
+
if (anchor !== null)
|
|
929
|
+
this.anchorMap.set(anchor, result);
|
|
950
930
|
let ch = this.peek();
|
|
951
931
|
while (ch !== 0) {
|
|
952
932
|
const following = this.peek(1);
|
|
@@ -982,12 +962,15 @@ class LoaderState {
|
|
|
982
962
|
// Implicit notation case. Flow-style node as the key first, then ":", and the value.
|
|
983
963
|
//
|
|
984
964
|
}
|
|
985
|
-
else
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
965
|
+
else {
|
|
966
|
+
const newState = this.composeNode({
|
|
967
|
+
parentIndent: flowIndent,
|
|
968
|
+
nodeContext: CONTEXT_FLOW_OUT,
|
|
969
|
+
allowToSeek: false,
|
|
970
|
+
allowCompact: true,
|
|
971
|
+
});
|
|
972
|
+
if (!newState)
|
|
973
|
+
break; // Reading is done. Go to the epilogue.
|
|
991
974
|
if (this.line === line) {
|
|
992
975
|
ch = this.peek();
|
|
993
976
|
this.skipWhitespaces();
|
|
@@ -1006,45 +989,41 @@ class LoaderState {
|
|
|
1006
989
|
detected = true;
|
|
1007
990
|
atExplicitKey = false;
|
|
1008
991
|
allowCompact = false;
|
|
1009
|
-
keyTag =
|
|
1010
|
-
keyNode =
|
|
992
|
+
keyTag = newState.tag;
|
|
993
|
+
keyNode = newState.result;
|
|
1011
994
|
}
|
|
1012
995
|
else if (detected) {
|
|
1013
996
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read an implicit mapping pair: missing colon");
|
|
1014
997
|
}
|
|
1015
998
|
else {
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
return true; // Keep the result of `composeNode`.
|
|
999
|
+
const { kind, result } = newState;
|
|
1000
|
+
return { tag, anchor, kind, result }; // Keep the result of `composeNode`.
|
|
1019
1001
|
}
|
|
1020
1002
|
}
|
|
1021
1003
|
else if (detected) {
|
|
1022
1004
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read a block mapping entry: a multiline key may not be an implicit key");
|
|
1023
1005
|
}
|
|
1024
1006
|
else {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
return true; // Keep the result of `composeNode`.
|
|
1007
|
+
const { kind, result } = newState;
|
|
1008
|
+
return { tag, anchor, kind, result }; // Keep the result of `composeNode`.
|
|
1028
1009
|
}
|
|
1029
1010
|
}
|
|
1030
|
-
else {
|
|
1031
|
-
break; // Reading is done. Go to the epilogue.
|
|
1032
|
-
}
|
|
1033
1011
|
//
|
|
1034
1012
|
// Common reading code for both explicit and implicit notations.
|
|
1035
1013
|
//
|
|
1036
1014
|
if (this.line === line || this.lineIndent > nodeIndent) {
|
|
1037
|
-
|
|
1015
|
+
const newState = this.composeNode({
|
|
1038
1016
|
parentIndent: nodeIndent,
|
|
1039
1017
|
nodeContext: CONTEXT_BLOCK_OUT,
|
|
1040
1018
|
allowToSeek: true,
|
|
1041
1019
|
allowCompact,
|
|
1042
|
-
})
|
|
1020
|
+
});
|
|
1021
|
+
if (newState) {
|
|
1043
1022
|
if (atExplicitKey) {
|
|
1044
|
-
keyNode =
|
|
1023
|
+
keyNode = newState.result;
|
|
1045
1024
|
}
|
|
1046
1025
|
else {
|
|
1047
|
-
valueNode =
|
|
1026
|
+
valueNode = newState.result;
|
|
1048
1027
|
}
|
|
1049
1028
|
}
|
|
1050
1029
|
if (!atExplicitKey) {
|
|
@@ -1069,23 +1048,18 @@ class LoaderState {
|
|
|
1069
1048
|
this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
|
|
1070
1049
|
}
|
|
1071
1050
|
// Expose the resulting mapping.
|
|
1072
|
-
if (detected)
|
|
1073
|
-
|
|
1074
|
-
this.anchor = anchor;
|
|
1075
|
-
this.kind = "mapping";
|
|
1076
|
-
this.result = result;
|
|
1077
|
-
}
|
|
1078
|
-
return detected;
|
|
1051
|
+
if (detected)
|
|
1052
|
+
return { tag, anchor, kind: "mapping", result };
|
|
1079
1053
|
}
|
|
1080
|
-
readTagProperty() {
|
|
1054
|
+
readTagProperty(tag) {
|
|
1081
1055
|
let isVerbatim = false;
|
|
1082
1056
|
let isNamed = false;
|
|
1083
1057
|
let tagHandle = "";
|
|
1084
1058
|
let tagName;
|
|
1085
1059
|
let ch = this.peek();
|
|
1086
1060
|
if (ch !== _chars_js_1.EXCLAMATION)
|
|
1087
|
-
return
|
|
1088
|
-
if (
|
|
1061
|
+
return;
|
|
1062
|
+
if (tag !== null) {
|
|
1089
1063
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read tag property: duplication of a tag property");
|
|
1090
1064
|
}
|
|
1091
1065
|
ch = this.next();
|
|
@@ -1140,27 +1114,24 @@ class LoaderState {
|
|
|
1140
1114
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: invalid characters in tag name "${tagName}"`);
|
|
1141
1115
|
}
|
|
1142
1116
|
if (isVerbatim) {
|
|
1143
|
-
|
|
1117
|
+
return tagName;
|
|
1144
1118
|
}
|
|
1145
1119
|
else if (this.tagMap.has(tagHandle)) {
|
|
1146
|
-
|
|
1120
|
+
return this.tagMap.get(tagHandle) + tagName;
|
|
1147
1121
|
}
|
|
1148
1122
|
else if (tagHandle === "!") {
|
|
1149
|
-
|
|
1123
|
+
return `!${tagName}`;
|
|
1150
1124
|
}
|
|
1151
1125
|
else if (tagHandle === "!!") {
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1154
|
-
else {
|
|
1155
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: undeclared tag handle "${tagHandle}"`);
|
|
1126
|
+
return `tag:yaml.org,2002:${tagName}`;
|
|
1156
1127
|
}
|
|
1157
|
-
|
|
1128
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read tag property: undeclared tag handle "${tagHandle}"`);
|
|
1158
1129
|
}
|
|
1159
|
-
readAnchorProperty() {
|
|
1130
|
+
readAnchorProperty(anchor) {
|
|
1160
1131
|
let ch = this.peek();
|
|
1161
1132
|
if (ch !== _chars_js_1.AMPERSAND)
|
|
1162
|
-
return
|
|
1163
|
-
if (
|
|
1133
|
+
return;
|
|
1134
|
+
if (anchor !== null) {
|
|
1164
1135
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read anchor property: duplicate anchor property");
|
|
1165
1136
|
}
|
|
1166
1137
|
ch = this.next();
|
|
@@ -1171,12 +1142,11 @@ class LoaderState {
|
|
|
1171
1142
|
if (this.position === position) {
|
|
1172
1143
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read anchor property: name of an anchor node must contain at least one character");
|
|
1173
1144
|
}
|
|
1174
|
-
|
|
1175
|
-
return true;
|
|
1145
|
+
return this.input.slice(position, this.position);
|
|
1176
1146
|
}
|
|
1177
1147
|
readAlias() {
|
|
1178
1148
|
if (this.peek() !== _chars_js_1.ASTERISK)
|
|
1179
|
-
return
|
|
1149
|
+
return;
|
|
1180
1150
|
let ch = this.next();
|
|
1181
1151
|
const position = this.position;
|
|
1182
1152
|
while (ch !== 0 && !(0, _chars_js_1.isWhiteSpaceOrEOL)(ch) && !(0, _chars_js_1.isFlowIndicator)(ch)) {
|
|
@@ -1189,19 +1159,56 @@ class LoaderState {
|
|
|
1189
1159
|
if (!this.anchorMap.has(alias)) {
|
|
1190
1160
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot read alias: unidentified alias "${alias}"`);
|
|
1191
1161
|
}
|
|
1192
|
-
this.result = this.anchorMap.get(alias);
|
|
1193
1162
|
this.skipSeparationSpace(true, -1);
|
|
1194
|
-
return
|
|
1163
|
+
return this.anchorMap.get(alias);
|
|
1164
|
+
}
|
|
1165
|
+
resolveTag(state) {
|
|
1166
|
+
switch (state.tag) {
|
|
1167
|
+
case null:
|
|
1168
|
+
case "!":
|
|
1169
|
+
return state;
|
|
1170
|
+
case "?": {
|
|
1171
|
+
for (const type of this.implicitTypes) {
|
|
1172
|
+
// Implicit resolving is not allowed for non-scalar types, and '?'
|
|
1173
|
+
// non-specific tag is only assigned to plain scalars. So, it isn't
|
|
1174
|
+
// needed to check for 'kind' conformity.
|
|
1175
|
+
if (!type.resolve(state.result))
|
|
1176
|
+
continue;
|
|
1177
|
+
// `state.result` updated in resolver if matched
|
|
1178
|
+
const result = type.construct(state.result);
|
|
1179
|
+
state.result = result;
|
|
1180
|
+
state.tag = type.tag;
|
|
1181
|
+
const { anchor } = state;
|
|
1182
|
+
if (anchor !== null)
|
|
1183
|
+
this.anchorMap.set(anchor, result);
|
|
1184
|
+
return state;
|
|
1185
|
+
}
|
|
1186
|
+
return state;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
const kind = state.kind ?? "fallback";
|
|
1190
|
+
const map = this.typeMap[kind];
|
|
1191
|
+
const type = map.get(state.tag);
|
|
1192
|
+
if (!type) {
|
|
1193
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve unknown tag !<${state.tag}>`);
|
|
1194
|
+
}
|
|
1195
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
1196
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Unacceptable node kind for !<${state.tag}> tag: it should be "${type.kind}", not "${state.kind}"`);
|
|
1197
|
+
}
|
|
1198
|
+
if (!type.resolve(state.result)) {
|
|
1199
|
+
// `state.result` updated in resolver if matched
|
|
1200
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve a node with !<${state.tag}> explicit tag`);
|
|
1201
|
+
}
|
|
1202
|
+
const result = type.construct(state.result);
|
|
1203
|
+
state.result = result;
|
|
1204
|
+
const { anchor } = state;
|
|
1205
|
+
if (anchor !== null)
|
|
1206
|
+
this.anchorMap.set(anchor, result);
|
|
1207
|
+
return state;
|
|
1195
1208
|
}
|
|
1196
1209
|
composeNode({ parentIndent, nodeContext, allowToSeek, allowCompact }) {
|
|
1197
1210
|
let indentStatus = 1; // 1: this>parent, 0: this=parent, -1: this<parent
|
|
1198
1211
|
let atNewLine = false;
|
|
1199
|
-
let hasContent = false;
|
|
1200
|
-
let type;
|
|
1201
|
-
this.tag = null;
|
|
1202
|
-
this.anchor = null;
|
|
1203
|
-
this.kind = null;
|
|
1204
|
-
this.result = null;
|
|
1205
1212
|
const allowBlockScalars = CONTEXT_BLOCK_OUT === nodeContext ||
|
|
1206
1213
|
CONTEXT_BLOCK_IN === nodeContext;
|
|
1207
1214
|
let allowBlockCollections = allowBlockScalars;
|
|
@@ -1209,31 +1216,27 @@ class LoaderState {
|
|
|
1209
1216
|
if (allowToSeek) {
|
|
1210
1217
|
if (this.skipSeparationSpace(true, -1)) {
|
|
1211
1218
|
atNewLine = true;
|
|
1212
|
-
|
|
1213
|
-
indentStatus = 1;
|
|
1214
|
-
}
|
|
1215
|
-
else if (this.lineIndent === parentIndent) {
|
|
1216
|
-
indentStatus = 0;
|
|
1217
|
-
}
|
|
1218
|
-
else if (this.lineIndent < parentIndent) {
|
|
1219
|
-
indentStatus = -1;
|
|
1220
|
-
}
|
|
1219
|
+
indentStatus = getIndentStatus(this.lineIndent, parentIndent);
|
|
1221
1220
|
}
|
|
1222
1221
|
}
|
|
1222
|
+
let tag = null;
|
|
1223
|
+
let anchor = null;
|
|
1223
1224
|
if (indentStatus === 1) {
|
|
1224
|
-
while (
|
|
1225
|
+
while (true) {
|
|
1226
|
+
const newTag = this.readTagProperty(tag);
|
|
1227
|
+
if (newTag) {
|
|
1228
|
+
tag = newTag;
|
|
1229
|
+
}
|
|
1230
|
+
else {
|
|
1231
|
+
const newAnchor = this.readAnchorProperty(anchor);
|
|
1232
|
+
if (!newAnchor)
|
|
1233
|
+
break;
|
|
1234
|
+
anchor = newAnchor;
|
|
1235
|
+
}
|
|
1225
1236
|
if (this.skipSeparationSpace(true, -1)) {
|
|
1226
1237
|
atNewLine = true;
|
|
1227
1238
|
allowBlockCollections = allowBlockStyles;
|
|
1228
|
-
|
|
1229
|
-
indentStatus = 1;
|
|
1230
|
-
}
|
|
1231
|
-
else if (this.lineIndent === parentIndent) {
|
|
1232
|
-
indentStatus = 0;
|
|
1233
|
-
}
|
|
1234
|
-
else if (this.lineIndent < parentIndent) {
|
|
1235
|
-
indentStatus = -1;
|
|
1236
|
-
}
|
|
1239
|
+
indentStatus = getIndentStatus(this.lineIndent, parentIndent);
|
|
1237
1240
|
}
|
|
1238
1241
|
else {
|
|
1239
1242
|
allowBlockCollections = false;
|
|
@@ -1243,88 +1246,59 @@ class LoaderState {
|
|
|
1243
1246
|
if (allowBlockCollections) {
|
|
1244
1247
|
allowBlockCollections = atNewLine || allowCompact;
|
|
1245
1248
|
}
|
|
1246
|
-
if (indentStatus === 1
|
|
1249
|
+
if (indentStatus === 1) {
|
|
1247
1250
|
const cond = CONTEXT_FLOW_IN === nodeContext ||
|
|
1248
1251
|
CONTEXT_FLOW_OUT === nodeContext;
|
|
1249
1252
|
const flowIndent = cond ? parentIndent : parentIndent + 1;
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
this.anchorMap.set(this.anchor, this.result);
|
|
1278
|
-
}
|
|
1253
|
+
if (allowBlockCollections) {
|
|
1254
|
+
const blockIndent = this.position - this.lineStart;
|
|
1255
|
+
const blockSequenceState = this.readBlockSequence(tag, anchor, blockIndent);
|
|
1256
|
+
if (blockSequenceState)
|
|
1257
|
+
return this.resolveTag(blockSequenceState);
|
|
1258
|
+
const blockMappingState = this.readBlockMapping(tag, anchor, blockIndent, flowIndent);
|
|
1259
|
+
if (blockMappingState)
|
|
1260
|
+
return this.resolveTag(blockMappingState);
|
|
1261
|
+
}
|
|
1262
|
+
const flowCollectionState = this.readFlowCollection(tag, anchor, flowIndent);
|
|
1263
|
+
if (flowCollectionState)
|
|
1264
|
+
return this.resolveTag(flowCollectionState);
|
|
1265
|
+
if (allowBlockScalars) {
|
|
1266
|
+
const blockScalarState = this.readBlockScalar(tag, anchor, flowIndent);
|
|
1267
|
+
if (blockScalarState)
|
|
1268
|
+
return this.resolveTag(blockScalarState);
|
|
1269
|
+
}
|
|
1270
|
+
const singleQuoteState = this.readSingleQuotedScalar(tag, anchor, flowIndent);
|
|
1271
|
+
if (singleQuoteState)
|
|
1272
|
+
return this.resolveTag(singleQuoteState);
|
|
1273
|
+
const doubleQuoteState = this.readDoubleQuotedScalar(tag, anchor, flowIndent);
|
|
1274
|
+
if (doubleQuoteState)
|
|
1275
|
+
return this.resolveTag(doubleQuoteState);
|
|
1276
|
+
const alias = this.readAlias();
|
|
1277
|
+
if (alias) {
|
|
1278
|
+
if (tag !== null || anchor !== null) {
|
|
1279
|
+
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot compose node: alias node should not have any properties");
|
|
1279
1280
|
}
|
|
1281
|
+
return this.resolveTag({ tag, anchor, kind: null, result: alias });
|
|
1280
1282
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
this.readBlockSequence(blockIndent);
|
|
1283
|
+
const plainScalarState = this.readPlainScalar(tag, anchor, flowIndent, CONTEXT_FLOW_IN === nodeContext);
|
|
1284
|
+
if (plainScalarState) {
|
|
1285
|
+
plainScalarState.tag ??= "?";
|
|
1286
|
+
return this.resolveTag(plainScalarState);
|
|
1286
1287
|
}
|
|
1287
1288
|
}
|
|
1288
|
-
if (
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
this.result = type.construct(this.result);
|
|
1298
|
-
this.tag = type.tag;
|
|
1299
|
-
if (this.anchor !== null) {
|
|
1300
|
-
this.anchorMap.set(this.anchor, this.result);
|
|
1301
|
-
}
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
else if (this.typeMap[this.kind ?? "fallback"].has(this.tag)) {
|
|
1307
|
-
const map = this.typeMap[this.kind ?? "fallback"];
|
|
1308
|
-
type = map.get(this.tag);
|
|
1309
|
-
if (this.result !== null && type.kind !== this.kind) {
|
|
1310
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Unacceptable node kind for !<${this.tag}> tag: it should be "${type.kind}", not "${this.kind}"`);
|
|
1311
|
-
}
|
|
1312
|
-
if (!type.resolve(this.result)) {
|
|
1313
|
-
// `state.result` updated in resolver if matched
|
|
1314
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve a node with !<${this.tag}> explicit tag`);
|
|
1315
|
-
}
|
|
1316
|
-
else {
|
|
1317
|
-
this.result = type.construct(this.result);
|
|
1318
|
-
if (this.anchor !== null) {
|
|
1319
|
-
this.anchorMap.set(this.anchor, this.result);
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
}
|
|
1323
|
-
else {
|
|
1324
|
-
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, `Cannot resolve unknown tag !<${this.tag}>`);
|
|
1325
|
-
}
|
|
1289
|
+
else if (indentStatus === 0 &&
|
|
1290
|
+
CONTEXT_BLOCK_OUT === nodeContext &&
|
|
1291
|
+
allowBlockCollections) {
|
|
1292
|
+
// Special case: block sequences are allowed to have same indentation level as the parent.
|
|
1293
|
+
// http://www.yaml.org/spec/1.2/spec.html#id2799784
|
|
1294
|
+
const blockIndent = this.position - this.lineStart;
|
|
1295
|
+
const newState = this.readBlockSequence(tag, anchor, blockIndent);
|
|
1296
|
+
if (newState)
|
|
1297
|
+
return this.resolveTag(newState);
|
|
1326
1298
|
}
|
|
1327
|
-
|
|
1299
|
+
const newState = this.resolveTag({ tag, anchor, kind: null, result: null });
|
|
1300
|
+
if (newState.tag !== null || newState.anchor !== null)
|
|
1301
|
+
return newState;
|
|
1328
1302
|
}
|
|
1329
1303
|
readDirectives() {
|
|
1330
1304
|
let hasDirectives = false;
|
|
@@ -1386,6 +1360,7 @@ class LoaderState {
|
|
|
1386
1360
|
this.anchorMap = new Map();
|
|
1387
1361
|
const hasDirectives = this.readDirectives();
|
|
1388
1362
|
this.skipSeparationSpace(true, -1);
|
|
1363
|
+
let result = null;
|
|
1389
1364
|
if (this.lineIndent === 0 &&
|
|
1390
1365
|
this.peek() === _chars_js_1.MINUS &&
|
|
1391
1366
|
this.peek(1) === _chars_js_1.MINUS &&
|
|
@@ -1396,12 +1371,14 @@ class LoaderState {
|
|
|
1396
1371
|
else if (hasDirectives) {
|
|
1397
1372
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read document: directives end mark is expected");
|
|
1398
1373
|
}
|
|
1399
|
-
this.composeNode({
|
|
1374
|
+
const newState = this.composeNode({
|
|
1400
1375
|
parentIndent: this.lineIndent - 1,
|
|
1401
1376
|
nodeContext: CONTEXT_BLOCK_OUT,
|
|
1402
1377
|
allowToSeek: false,
|
|
1403
1378
|
allowCompact: true,
|
|
1404
1379
|
});
|
|
1380
|
+
if (newState)
|
|
1381
|
+
result = newState.result;
|
|
1405
1382
|
this.skipSeparationSpace(true, -1);
|
|
1406
1383
|
if (this.checkLineBreaks &&
|
|
1407
1384
|
PATTERN_NON_ASCII_LINE_BREAKS.test(this.input.slice(documentStart, this.position))) {
|
|
@@ -1416,7 +1393,7 @@ class LoaderState {
|
|
|
1416
1393
|
else if (this.position < this.length - 1) {
|
|
1417
1394
|
throw __classPrivateFieldGet(this, _LoaderState_instances, "m", _LoaderState_createError).call(this, "Cannot read document: end of the stream or a document separator is expected");
|
|
1418
1395
|
}
|
|
1419
|
-
return
|
|
1396
|
+
return result;
|
|
1420
1397
|
}
|
|
1421
1398
|
*readDocuments() {
|
|
1422
1399
|
while (this.position < this.length - 1) {
|