pfwr 0.16.0 → 0.17.0
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 +3 -3
- package/dist/index.js +2110 -2268
- package/package.json +10 -4
package/dist/index.js
CHANGED
|
@@ -1706,7 +1706,7 @@ var extend = /*@__PURE__*/getDefaultExportFromCjs(extendExports);
|
|
|
1706
1706
|
|
|
1707
1707
|
function ok$6() {}
|
|
1708
1708
|
|
|
1709
|
-
function isPlainObject(value) {
|
|
1709
|
+
function isPlainObject$1(value) {
|
|
1710
1710
|
if (typeof value !== 'object' || value === null) {
|
|
1711
1711
|
return false;
|
|
1712
1712
|
}
|
|
@@ -2731,7 +2731,7 @@ class Processor extends CallableInstance {
|
|
|
2731
2731
|
else if (parameters.length > 0) {
|
|
2732
2732
|
let [primary, ...rest] = parameters;
|
|
2733
2733
|
const currentPrimary = attachers[entryIndex][1];
|
|
2734
|
-
if (isPlainObject(currentPrimary) && isPlainObject(primary)) {
|
|
2734
|
+
if (isPlainObject$1(currentPrimary) && isPlainObject$1(primary)) {
|
|
2735
2735
|
primary = extend(true, currentPrimary, primary);
|
|
2736
2736
|
}
|
|
2737
2737
|
|
|
@@ -2823,7 +2823,7 @@ function assertUnfrozen(name, frozen) {
|
|
|
2823
2823
|
function assertNode(node) {
|
|
2824
2824
|
// `isPlainObj` unfortunately uses `any` instead of `unknown`.
|
|
2825
2825
|
// type-coverage:ignore-next-line
|
|
2826
|
-
if (!isPlainObject(node) || typeof node.type !== 'string') {
|
|
2826
|
+
if (!isPlainObject$1(node) || typeof node.type !== 'string') {
|
|
2827
2827
|
throw new TypeError('Expected node, got `' + node + '`')
|
|
2828
2828
|
// Fine.
|
|
2829
2829
|
}
|
|
@@ -15616,9 +15616,9 @@ function createConstruct(matter) {
|
|
|
15616
15616
|
*/
|
|
15617
15617
|
function fence$1(matter, prop) {
|
|
15618
15618
|
return matter.marker
|
|
15619
|
-
? pick$
|
|
15619
|
+
? pick$3(matter.marker, prop).repeat(3)
|
|
15620
15620
|
: // @ts-expect-error: They’re mutually exclusive.
|
|
15621
|
-
pick$
|
|
15621
|
+
pick$3(matter.fence, prop)
|
|
15622
15622
|
}
|
|
15623
15623
|
|
|
15624
15624
|
/**
|
|
@@ -15626,7 +15626,7 @@ function fence$1(matter, prop) {
|
|
|
15626
15626
|
* @param {'close' | 'open'} prop
|
|
15627
15627
|
* @returns {string}
|
|
15628
15628
|
*/
|
|
15629
|
-
function pick$
|
|
15629
|
+
function pick$3(schema, prop) {
|
|
15630
15630
|
return typeof schema === 'string' ? schema : schema[prop]
|
|
15631
15631
|
}
|
|
15632
15632
|
|
|
@@ -15795,9 +15795,9 @@ function handler(matter) {
|
|
|
15795
15795
|
*/
|
|
15796
15796
|
function fence(matter, prop) {
|
|
15797
15797
|
return matter.marker
|
|
15798
|
-
? pick$
|
|
15798
|
+
? pick$2(matter.marker, prop).repeat(3)
|
|
15799
15799
|
: // @ts-expect-error: They’re mutually exclusive.
|
|
15800
|
-
pick$
|
|
15800
|
+
pick$2(matter.fence, prop)
|
|
15801
15801
|
}
|
|
15802
15802
|
|
|
15803
15803
|
/**
|
|
@@ -15811,7 +15811,7 @@ function fence(matter, prop) {
|
|
|
15811
15811
|
* @returns {string}
|
|
15812
15812
|
* Thing to use for the opening or closing.
|
|
15813
15813
|
*/
|
|
15814
|
-
function pick$
|
|
15814
|
+
function pick$2(schema, prop) {
|
|
15815
15815
|
return typeof schema === 'string' ? schema : schema[prop]
|
|
15816
15816
|
}
|
|
15817
15817
|
|
|
@@ -36143,7 +36143,7 @@ var hammer_and_wrench = {
|
|
|
36143
36143
|
fitzpatrick_scale: false,
|
|
36144
36144
|
category: "objects"
|
|
36145
36145
|
};
|
|
36146
|
-
var pick = {
|
|
36146
|
+
var pick$1 = {
|
|
36147
36147
|
keywords: [
|
|
36148
36148
|
"tools",
|
|
36149
36149
|
"dig"
|
|
@@ -44592,7 +44592,7 @@ var require$$0 = {
|
|
|
44592
44592
|
hammer: hammer,
|
|
44593
44593
|
hammer_and_pick: hammer_and_pick,
|
|
44594
44594
|
hammer_and_wrench: hammer_and_wrench,
|
|
44595
|
-
pick: pick,
|
|
44595
|
+
pick: pick$1,
|
|
44596
44596
|
nut_and_bolt: nut_and_bolt,
|
|
44597
44597
|
gear: gear,
|
|
44598
44598
|
brick: brick,
|
|
@@ -48930,7 +48930,7 @@ function increment$4() {
|
|
|
48930
48930
|
return 2 ** ++powers$4
|
|
48931
48931
|
}
|
|
48932
48932
|
|
|
48933
|
-
var types$
|
|
48933
|
+
var types$5 = /*#__PURE__*/Object.freeze({
|
|
48934
48934
|
__proto__: null,
|
|
48935
48935
|
boolean: boolean$4,
|
|
48936
48936
|
booleanish: booleanish$4,
|
|
@@ -48947,7 +48947,7 @@ var types$6 = /*#__PURE__*/Object.freeze({
|
|
|
48947
48947
|
|
|
48948
48948
|
|
|
48949
48949
|
const checks$4 = /** @type {ReadonlyArray<keyof typeof types>} */ (
|
|
48950
|
-
Object.keys(types$
|
|
48950
|
+
Object.keys(types$5)
|
|
48951
48951
|
);
|
|
48952
48952
|
|
|
48953
48953
|
let DefinedInfo$4 = class DefinedInfo extends Info$4 {
|
|
@@ -48974,7 +48974,7 @@ let DefinedInfo$4 = class DefinedInfo extends Info$4 {
|
|
|
48974
48974
|
if (typeof mask === 'number') {
|
|
48975
48975
|
while (++index < checks$4.length) {
|
|
48976
48976
|
const check = checks$4[index];
|
|
48977
|
-
mark$4(this, checks$4[index], (mask & types$
|
|
48977
|
+
mark$4(this, checks$4[index], (mask & types$5[check]) === types$5[check]);
|
|
48978
48978
|
}
|
|
48979
48979
|
}
|
|
48980
48980
|
}
|
|
@@ -52194,7 +52194,7 @@ function increment$3() {
|
|
|
52194
52194
|
return 2 ** ++powers$3
|
|
52195
52195
|
}
|
|
52196
52196
|
|
|
52197
|
-
var types$
|
|
52197
|
+
var types$4 = /*#__PURE__*/Object.freeze({
|
|
52198
52198
|
__proto__: null,
|
|
52199
52199
|
boolean: boolean$3,
|
|
52200
52200
|
booleanish: booleanish$3,
|
|
@@ -52207,7 +52207,7 @@ var types$5 = /*#__PURE__*/Object.freeze({
|
|
|
52207
52207
|
|
|
52208
52208
|
/** @type {Array<keyof types>} */
|
|
52209
52209
|
// @ts-expect-error: hush.
|
|
52210
|
-
const checks$3 = Object.keys(types$
|
|
52210
|
+
const checks$3 = Object.keys(types$4);
|
|
52211
52211
|
|
|
52212
52212
|
let DefinedInfo$3 = class DefinedInfo extends Info$3 {
|
|
52213
52213
|
/**
|
|
@@ -52227,7 +52227,7 @@ let DefinedInfo$3 = class DefinedInfo extends Info$3 {
|
|
|
52227
52227
|
if (typeof mask === 'number') {
|
|
52228
52228
|
while (++index < checks$3.length) {
|
|
52229
52229
|
const check = checks$3[index];
|
|
52230
|
-
mark$3(this, checks$3[index], (mask & types$
|
|
52230
|
+
mark$3(this, checks$3[index], (mask & types$4[check]) === types$4[check]);
|
|
52231
52231
|
}
|
|
52232
52232
|
}
|
|
52233
52233
|
}
|
|
@@ -54078,7 +54078,7 @@ function increment$2() {
|
|
|
54078
54078
|
return 2 ** ++powers$2
|
|
54079
54079
|
}
|
|
54080
54080
|
|
|
54081
|
-
var types$
|
|
54081
|
+
var types$3 = /*#__PURE__*/Object.freeze({
|
|
54082
54082
|
__proto__: null,
|
|
54083
54083
|
boolean: boolean$2,
|
|
54084
54084
|
booleanish: booleanish$2,
|
|
@@ -54095,7 +54095,7 @@ var types$4 = /*#__PURE__*/Object.freeze({
|
|
|
54095
54095
|
|
|
54096
54096
|
|
|
54097
54097
|
const checks$2 = /** @type {ReadonlyArray<keyof typeof types>} */ (
|
|
54098
|
-
Object.keys(types$
|
|
54098
|
+
Object.keys(types$3)
|
|
54099
54099
|
);
|
|
54100
54100
|
|
|
54101
54101
|
let DefinedInfo$2 = class DefinedInfo extends Info$2 {
|
|
@@ -54122,7 +54122,7 @@ let DefinedInfo$2 = class DefinedInfo extends Info$2 {
|
|
|
54122
54122
|
if (typeof mask === 'number') {
|
|
54123
54123
|
while (++index < checks$2.length) {
|
|
54124
54124
|
const check = checks$2[index];
|
|
54125
|
-
mark$2(this, checks$2[index], (mask & types$
|
|
54125
|
+
mark$2(this, checks$2[index], (mask & types$3[check]) === types$3[check]);
|
|
54126
54126
|
}
|
|
54127
54127
|
}
|
|
54128
54128
|
}
|
|
@@ -56929,7 +56929,7 @@ function increment$1() {
|
|
|
56929
56929
|
return 2 ** ++powers$1
|
|
56930
56930
|
}
|
|
56931
56931
|
|
|
56932
|
-
var types$
|
|
56932
|
+
var types$2 = /*#__PURE__*/Object.freeze({
|
|
56933
56933
|
__proto__: null,
|
|
56934
56934
|
boolean: boolean$1,
|
|
56935
56935
|
booleanish: booleanish$1,
|
|
@@ -56946,7 +56946,7 @@ var types$3 = /*#__PURE__*/Object.freeze({
|
|
|
56946
56946
|
|
|
56947
56947
|
|
|
56948
56948
|
const checks$1 = /** @type {ReadonlyArray<keyof typeof types>} */ (
|
|
56949
|
-
Object.keys(types$
|
|
56949
|
+
Object.keys(types$2)
|
|
56950
56950
|
);
|
|
56951
56951
|
|
|
56952
56952
|
let DefinedInfo$1 = class DefinedInfo extends Info$1 {
|
|
@@ -56973,7 +56973,7 @@ let DefinedInfo$1 = class DefinedInfo extends Info$1 {
|
|
|
56973
56973
|
if (typeof mask === 'number') {
|
|
56974
56974
|
while (++index < checks$1.length) {
|
|
56975
56975
|
const check = checks$1[index];
|
|
56976
|
-
mark$1(this, checks$1[index], (mask & types$
|
|
56976
|
+
mark$1(this, checks$1[index], (mask & types$2[check]) === types$2[check]);
|
|
56977
56977
|
}
|
|
56978
56978
|
}
|
|
56979
56979
|
}
|
|
@@ -58752,7 +58752,7 @@ function increment() {
|
|
|
58752
58752
|
return 2 ** ++powers
|
|
58753
58753
|
}
|
|
58754
58754
|
|
|
58755
|
-
var types$
|
|
58755
|
+
var types$1 = /*#__PURE__*/Object.freeze({
|
|
58756
58756
|
__proto__: null,
|
|
58757
58757
|
boolean: boolean,
|
|
58758
58758
|
booleanish: booleanish,
|
|
@@ -58769,7 +58769,7 @@ var types$2 = /*#__PURE__*/Object.freeze({
|
|
|
58769
58769
|
|
|
58770
58770
|
|
|
58771
58771
|
const checks = /** @type {ReadonlyArray<keyof typeof types>} */ (
|
|
58772
|
-
Object.keys(types$
|
|
58772
|
+
Object.keys(types$1)
|
|
58773
58773
|
);
|
|
58774
58774
|
|
|
58775
58775
|
class DefinedInfo extends Info {
|
|
@@ -58796,7 +58796,7 @@ class DefinedInfo extends Info {
|
|
|
58796
58796
|
if (typeof mask === 'number') {
|
|
58797
58797
|
while (++index < checks.length) {
|
|
58798
58798
|
const check = checks[index];
|
|
58799
|
-
mark(this, checks[index], (mask & types$
|
|
58799
|
+
mark(this, checks[index], (mask & types$1[check]) === types$1[check]);
|
|
58800
58800
|
}
|
|
58801
58801
|
}
|
|
58802
58802
|
}
|
|
@@ -64211,28 +64211,28 @@ function requireInfo () {
|
|
|
64211
64211
|
return info;
|
|
64212
64212
|
}
|
|
64213
64213
|
|
|
64214
|
-
var types
|
|
64214
|
+
var types = {};
|
|
64215
64215
|
|
|
64216
64216
|
var hasRequiredTypes;
|
|
64217
64217
|
|
|
64218
64218
|
function requireTypes () {
|
|
64219
|
-
if (hasRequiredTypes) return types
|
|
64219
|
+
if (hasRequiredTypes) return types;
|
|
64220
64220
|
hasRequiredTypes = 1;
|
|
64221
64221
|
|
|
64222
64222
|
var powers = 0;
|
|
64223
64223
|
|
|
64224
|
-
types
|
|
64225
|
-
types
|
|
64226
|
-
types
|
|
64227
|
-
types
|
|
64228
|
-
types
|
|
64229
|
-
types
|
|
64230
|
-
types
|
|
64224
|
+
types.boolean = increment();
|
|
64225
|
+
types.booleanish = increment();
|
|
64226
|
+
types.overloadedBoolean = increment();
|
|
64227
|
+
types.number = increment();
|
|
64228
|
+
types.spaceSeparated = increment();
|
|
64229
|
+
types.commaSeparated = increment();
|
|
64230
|
+
types.commaOrSpaceSeparated = increment();
|
|
64231
64231
|
|
|
64232
64232
|
function increment() {
|
|
64233
64233
|
return Math.pow(2, ++powers)
|
|
64234
64234
|
}
|
|
64235
|
-
return types
|
|
64235
|
+
return types;
|
|
64236
64236
|
}
|
|
64237
64237
|
|
|
64238
64238
|
var definedInfo;
|
|
@@ -68486,2384 +68486,2226 @@ function transform$1(tree) {
|
|
|
68486
68486
|
|
|
68487
68487
|
}
|
|
68488
68488
|
|
|
68489
|
-
/*! js-yaml
|
|
68490
|
-
//#region
|
|
68491
|
-
var
|
|
68492
|
-
var
|
|
68493
|
-
|
|
68494
|
-
|
|
68495
|
-
|
|
68496
|
-
|
|
68497
|
-
|
|
68498
|
-
|
|
68499
|
-
|
|
68500
|
-
|
|
68501
|
-
|
|
68502
|
-
|
|
68503
|
-
|
|
68504
|
-
});
|
|
68505
|
-
}
|
|
68506
|
-
return to;
|
|
68507
|
-
};
|
|
68508
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(__defProp(target, "default", {
|
|
68509
|
-
value: mod,
|
|
68510
|
-
enumerable: true
|
|
68511
|
-
}) , mod));
|
|
68512
|
-
//#endregion
|
|
68513
|
-
//#region lib/common.js
|
|
68514
|
-
var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
68515
|
-
function isNothing(subject) {
|
|
68516
|
-
return typeof subject === "undefined" || subject === null;
|
|
68517
|
-
}
|
|
68518
|
-
function isObject(subject) {
|
|
68519
|
-
return typeof subject === "object" && subject !== null;
|
|
68520
|
-
}
|
|
68521
|
-
function toArray(sequence) {
|
|
68522
|
-
if (Array.isArray(sequence)) return sequence;
|
|
68523
|
-
else if (isNothing(sequence)) return [];
|
|
68524
|
-
return [sequence];
|
|
68525
|
-
}
|
|
68526
|
-
function extend(target, source) {
|
|
68527
|
-
if (source) {
|
|
68528
|
-
const sourceKeys = Object.keys(source);
|
|
68529
|
-
for (let index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
68530
|
-
const key = sourceKeys[index];
|
|
68531
|
-
target[key] = source[key];
|
|
68532
|
-
}
|
|
68533
|
-
}
|
|
68534
|
-
return target;
|
|
68535
|
-
}
|
|
68536
|
-
function repeat(string, count) {
|
|
68537
|
-
let result = "";
|
|
68538
|
-
for (let cycle = 0; cycle < count; cycle += 1) result += string;
|
|
68539
|
-
return result;
|
|
68540
|
-
}
|
|
68541
|
-
function isNegativeZero(number) {
|
|
68542
|
-
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
|
68543
|
-
}
|
|
68544
|
-
module.exports.isNothing = isNothing;
|
|
68545
|
-
module.exports.isObject = isObject;
|
|
68546
|
-
module.exports.toArray = toArray;
|
|
68547
|
-
module.exports.repeat = repeat;
|
|
68548
|
-
module.exports.isNegativeZero = isNegativeZero;
|
|
68549
|
-
module.exports.extend = extend;
|
|
68550
|
-
}));
|
|
68551
|
-
//#endregion
|
|
68552
|
-
//#region lib/exception.js
|
|
68553
|
-
var require_exception = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
68554
|
-
function formatError(exception, compact) {
|
|
68555
|
-
let where = "";
|
|
68556
|
-
const message = exception.reason || "(unknown reason)";
|
|
68557
|
-
if (!exception.mark) return message;
|
|
68558
|
-
if (exception.mark.name) where += "in \"" + exception.mark.name + "\" ";
|
|
68559
|
-
where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
|
|
68560
|
-
if (!compact && exception.mark.snippet) where += "\n\n" + exception.mark.snippet;
|
|
68561
|
-
return message + " " + where;
|
|
68562
|
-
}
|
|
68563
|
-
function YAMLException(reason, mark) {
|
|
68564
|
-
Error.call(this);
|
|
68565
|
-
this.name = "YAMLException";
|
|
68566
|
-
this.reason = reason;
|
|
68567
|
-
this.mark = mark;
|
|
68568
|
-
this.message = formatError(this, false);
|
|
68569
|
-
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
68570
|
-
else this.stack = (/* @__PURE__ */ new Error()).stack || "";
|
|
68571
|
-
}
|
|
68572
|
-
YAMLException.prototype = Object.create(Error.prototype);
|
|
68573
|
-
YAMLException.prototype.constructor = YAMLException;
|
|
68574
|
-
YAMLException.prototype.toString = function toString(compact) {
|
|
68575
|
-
return this.name + ": " + formatError(this, compact);
|
|
68489
|
+
/*! js-yaml 5.2.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
68490
|
+
//#region src/tag.ts
|
|
68491
|
+
var NOT_RESOLVED = Symbol("NOT_RESOLVED");
|
|
68492
|
+
var MERGE_KEY = Symbol("MERGE_KEY");
|
|
68493
|
+
function defineScalarTag(tagName, options) {
|
|
68494
|
+
return {
|
|
68495
|
+
tagName,
|
|
68496
|
+
nodeKind: "scalar",
|
|
68497
|
+
implicit: options.implicit ?? false,
|
|
68498
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
68499
|
+
implicitFirstChars: options.implicitFirstChars ?? null,
|
|
68500
|
+
resolve: options.resolve,
|
|
68501
|
+
identify: options.identify ?? null,
|
|
68502
|
+
represent: options.represent ?? ((data) => String(data)),
|
|
68503
|
+
representTagName: options.representTagName ?? null
|
|
68576
68504
|
};
|
|
68577
|
-
|
|
68578
|
-
|
|
68505
|
+
}
|
|
68506
|
+
function defineSequenceTag(tagName, options) {
|
|
68507
|
+
const carrierIsResult = options.finalize === void 0;
|
|
68508
|
+
return {
|
|
68509
|
+
tagName,
|
|
68510
|
+
nodeKind: "sequence",
|
|
68511
|
+
implicit: false,
|
|
68512
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
68513
|
+
create: options.create,
|
|
68514
|
+
addItem: options.addItem,
|
|
68515
|
+
finalize: options.finalize ?? ((carrier) => carrier),
|
|
68516
|
+
carrierIsResult,
|
|
68517
|
+
identify: options.identify ?? null,
|
|
68518
|
+
represent: options.represent ?? ((data) => data),
|
|
68519
|
+
representTagName: options.representTagName ?? null
|
|
68520
|
+
};
|
|
68521
|
+
}
|
|
68522
|
+
function defineMappingTag(tagName, options) {
|
|
68523
|
+
const carrierIsResult = options.finalize === void 0;
|
|
68524
|
+
return {
|
|
68525
|
+
tagName,
|
|
68526
|
+
nodeKind: "mapping",
|
|
68527
|
+
implicit: false,
|
|
68528
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
68529
|
+
create: options.create,
|
|
68530
|
+
addPair: options.addPair,
|
|
68531
|
+
has: options.has,
|
|
68532
|
+
keys: options.keys,
|
|
68533
|
+
get: options.get,
|
|
68534
|
+
finalize: options.finalize ?? ((carrier) => carrier),
|
|
68535
|
+
carrierIsResult,
|
|
68536
|
+
identify: options.identify ?? null,
|
|
68537
|
+
represent: options.represent ?? ((data) => data),
|
|
68538
|
+
representTagName: options.representTagName ?? null
|
|
68539
|
+
};
|
|
68540
|
+
}
|
|
68579
68541
|
//#endregion
|
|
68580
|
-
//#region
|
|
68581
|
-
var
|
|
68582
|
-
|
|
68583
|
-
|
|
68584
|
-
|
|
68585
|
-
let tail = "";
|
|
68586
|
-
const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
68587
|
-
if (position - lineStart > maxHalfLength) {
|
|
68588
|
-
head = " ... ";
|
|
68589
|
-
lineStart = position - maxHalfLength + head.length;
|
|
68590
|
-
}
|
|
68591
|
-
if (lineEnd - position > maxHalfLength) {
|
|
68592
|
-
tail = " ...";
|
|
68593
|
-
lineEnd = position + maxHalfLength - tail.length;
|
|
68594
|
-
}
|
|
68595
|
-
return {
|
|
68596
|
-
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
|
|
68597
|
-
pos: position - lineStart + head.length
|
|
68598
|
-
};
|
|
68599
|
-
}
|
|
68600
|
-
function padStart(string, max) {
|
|
68601
|
-
return common.repeat(" ", max - string.length) + string;
|
|
68602
|
-
}
|
|
68603
|
-
function makeSnippet(mark, options) {
|
|
68604
|
-
options = Object.create(options || null);
|
|
68605
|
-
if (!mark.buffer) return null;
|
|
68606
|
-
if (!options.maxLength) options.maxLength = 79;
|
|
68607
|
-
if (typeof options.indent !== "number") options.indent = 1;
|
|
68608
|
-
if (typeof options.linesBefore !== "number") options.linesBefore = 3;
|
|
68609
|
-
if (typeof options.linesAfter !== "number") options.linesAfter = 2;
|
|
68610
|
-
const re = /\r?\n|\r|\0/g;
|
|
68611
|
-
const lineStarts = [0];
|
|
68612
|
-
const lineEnds = [];
|
|
68613
|
-
let match;
|
|
68614
|
-
let foundLineNo = -1;
|
|
68615
|
-
while (match = re.exec(mark.buffer)) {
|
|
68616
|
-
lineEnds.push(match.index);
|
|
68617
|
-
lineStarts.push(match.index + match[0].length);
|
|
68618
|
-
if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
|
|
68619
|
-
}
|
|
68620
|
-
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
68621
|
-
let result = "";
|
|
68622
|
-
const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
|
|
68623
|
-
const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
|
|
68624
|
-
for (let i = 1; i <= options.linesBefore; i++) {
|
|
68625
|
-
if (foundLineNo - i < 0) break;
|
|
68626
|
-
const line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
68627
|
-
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
|
|
68628
|
-
}
|
|
68629
|
-
const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
68630
|
-
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
68631
|
-
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
|
|
68632
|
-
for (let i = 1; i <= options.linesAfter; i++) {
|
|
68633
|
-
if (foundLineNo + i >= lineEnds.length) break;
|
|
68634
|
-
const line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
68635
|
-
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
|
|
68636
|
-
}
|
|
68637
|
-
return result.replace(/\n$/, "");
|
|
68638
|
-
}
|
|
68639
|
-
module.exports = makeSnippet;
|
|
68640
|
-
}));
|
|
68542
|
+
//#region src/tag/scalar/str.ts
|
|
68543
|
+
var strTag = defineScalarTag("tag:yaml.org,2002:str", {
|
|
68544
|
+
resolve: (source) => source,
|
|
68545
|
+
identify: (data) => typeof data === "string"
|
|
68546
|
+
});
|
|
68641
68547
|
//#endregion
|
|
68642
|
-
//#region
|
|
68643
|
-
var
|
|
68644
|
-
|
|
68645
|
-
|
|
68646
|
-
|
|
68647
|
-
|
|
68648
|
-
|
|
68649
|
-
|
|
68650
|
-
|
|
68651
|
-
|
|
68652
|
-
|
|
68653
|
-
"
|
|
68654
|
-
"
|
|
68655
|
-
"
|
|
68656
|
-
|
|
68657
|
-
|
|
68658
|
-
|
|
68659
|
-
|
|
68660
|
-
|
|
68661
|
-
|
|
68662
|
-
|
|
68663
|
-
|
|
68664
|
-
|
|
68665
|
-
map[style].forEach(function(alias) {
|
|
68666
|
-
result[String(alias)] = style;
|
|
68667
|
-
});
|
|
68668
|
-
});
|
|
68669
|
-
return result;
|
|
68670
|
-
}
|
|
68671
|
-
function Type(tag, options) {
|
|
68672
|
-
options = options || {};
|
|
68673
|
-
Object.keys(options).forEach(function(name) {
|
|
68674
|
-
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) throw new YAMLException("Unknown option \"" + name + "\" is met in definition of \"" + tag + "\" YAML type.");
|
|
68675
|
-
});
|
|
68676
|
-
this.options = options;
|
|
68677
|
-
this.tag = tag;
|
|
68678
|
-
this.kind = options["kind"] || null;
|
|
68679
|
-
this.resolve = options["resolve"] || function() {
|
|
68680
|
-
return true;
|
|
68681
|
-
};
|
|
68682
|
-
this.construct = options["construct"] || function(data) {
|
|
68683
|
-
return data;
|
|
68684
|
-
};
|
|
68685
|
-
this.instanceOf = options["instanceOf"] || null;
|
|
68686
|
-
this.predicate = options["predicate"] || null;
|
|
68687
|
-
this.represent = options["represent"] || null;
|
|
68688
|
-
this.representName = options["representName"] || null;
|
|
68689
|
-
this.defaultStyle = options["defaultStyle"] || null;
|
|
68690
|
-
this.multi = options["multi"] || false;
|
|
68691
|
-
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
|
|
68692
|
-
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) throw new YAMLException("Unknown kind \"" + this.kind + "\" is specified for \"" + tag + "\" YAML type.");
|
|
68693
|
-
}
|
|
68694
|
-
module.exports = Type;
|
|
68695
|
-
}));
|
|
68548
|
+
//#region src/tag/scalar/null_core.ts
|
|
68549
|
+
var NULL_VALUES$1 = [
|
|
68550
|
+
"",
|
|
68551
|
+
"~",
|
|
68552
|
+
"null",
|
|
68553
|
+
"Null",
|
|
68554
|
+
"NULL"
|
|
68555
|
+
];
|
|
68556
|
+
var nullCoreTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
68557
|
+
implicit: true,
|
|
68558
|
+
implicitFirstChars: [
|
|
68559
|
+
"",
|
|
68560
|
+
"~",
|
|
68561
|
+
"n",
|
|
68562
|
+
"N"
|
|
68563
|
+
],
|
|
68564
|
+
resolve: (source) => {
|
|
68565
|
+
if (NULL_VALUES$1.indexOf(source) !== -1) return null;
|
|
68566
|
+
return NOT_RESOLVED;
|
|
68567
|
+
},
|
|
68568
|
+
identify: (object) => object === null,
|
|
68569
|
+
represent: () => "null"
|
|
68570
|
+
});
|
|
68696
68571
|
//#endregion
|
|
68697
|
-
//#region
|
|
68698
|
-
var
|
|
68699
|
-
|
|
68700
|
-
|
|
68701
|
-
|
|
68702
|
-
|
|
68703
|
-
|
|
68704
|
-
|
|
68705
|
-
|
|
68706
|
-
|
|
68707
|
-
|
|
68708
|
-
result[newIndex] = currentType;
|
|
68709
|
-
});
|
|
68710
|
-
return result;
|
|
68711
|
-
}
|
|
68712
|
-
function compileMap() {
|
|
68713
|
-
const result = {
|
|
68714
|
-
scalar: {},
|
|
68715
|
-
sequence: {},
|
|
68716
|
-
mapping: {},
|
|
68717
|
-
fallback: {},
|
|
68718
|
-
multi: {
|
|
68719
|
-
scalar: [],
|
|
68720
|
-
sequence: [],
|
|
68721
|
-
mapping: [],
|
|
68722
|
-
fallback: []
|
|
68723
|
-
}
|
|
68724
|
-
};
|
|
68725
|
-
function collectType(type) {
|
|
68726
|
-
if (type.multi) {
|
|
68727
|
-
result.multi[type.kind].push(type);
|
|
68728
|
-
result.multi["fallback"].push(type);
|
|
68729
|
-
} else result[type.kind][type.tag] = result["fallback"][type.tag] = type;
|
|
68730
|
-
}
|
|
68731
|
-
for (let index = 0, length = arguments.length; index < length; index += 1) arguments[index].forEach(collectType);
|
|
68732
|
-
return result;
|
|
68733
|
-
}
|
|
68734
|
-
function Schema(definition) {
|
|
68735
|
-
return this.extend(definition);
|
|
68736
|
-
}
|
|
68737
|
-
Schema.prototype.extend = function extend(definition) {
|
|
68738
|
-
let implicit = [];
|
|
68739
|
-
let explicit = [];
|
|
68740
|
-
if (definition instanceof Type) explicit.push(definition);
|
|
68741
|
-
else if (Array.isArray(definition)) explicit = explicit.concat(definition);
|
|
68742
|
-
else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
|
68743
|
-
if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
|
68744
|
-
if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
|
68745
|
-
} else throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
|
68746
|
-
implicit.forEach(function(type) {
|
|
68747
|
-
if (!(type instanceof Type)) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
68748
|
-
if (type.loadKind && type.loadKind !== "scalar") throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
|
68749
|
-
if (type.multi) throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
|
68750
|
-
});
|
|
68751
|
-
explicit.forEach(function(type) {
|
|
68752
|
-
if (!(type instanceof Type)) throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
68753
|
-
});
|
|
68754
|
-
const result = Object.create(Schema.prototype);
|
|
68755
|
-
result.implicit = (this.implicit || []).concat(implicit);
|
|
68756
|
-
result.explicit = (this.explicit || []).concat(explicit);
|
|
68757
|
-
result.compiledImplicit = compileList(result, "implicit");
|
|
68758
|
-
result.compiledExplicit = compileList(result, "explicit");
|
|
68759
|
-
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
|
68760
|
-
return result;
|
|
68761
|
-
};
|
|
68762
|
-
module.exports = Schema;
|
|
68763
|
-
}));
|
|
68572
|
+
//#region src/tag/scalar/null_json.ts
|
|
68573
|
+
var nullJsonTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
68574
|
+
implicit: true,
|
|
68575
|
+
implicitFirstChars: ["n"],
|
|
68576
|
+
resolve: (source, isExplicit) => {
|
|
68577
|
+
if (source === "null" || isExplicit && source === "") return null;
|
|
68578
|
+
return NOT_RESOLVED;
|
|
68579
|
+
},
|
|
68580
|
+
identify: (object) => object === null,
|
|
68581
|
+
represent: () => "null"
|
|
68582
|
+
});
|
|
68764
68583
|
//#endregion
|
|
68765
|
-
//#region
|
|
68766
|
-
var
|
|
68767
|
-
|
|
68768
|
-
|
|
68769
|
-
|
|
68770
|
-
|
|
68771
|
-
|
|
68772
|
-
|
|
68773
|
-
|
|
68584
|
+
//#region src/tag/scalar/null_yaml11.ts
|
|
68585
|
+
var NULL_VALUES = [
|
|
68586
|
+
"",
|
|
68587
|
+
"~",
|
|
68588
|
+
"null",
|
|
68589
|
+
"Null",
|
|
68590
|
+
"NULL"
|
|
68591
|
+
];
|
|
68592
|
+
var nullYaml11Tag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
68593
|
+
implicit: true,
|
|
68594
|
+
implicitFirstChars: [
|
|
68595
|
+
"",
|
|
68596
|
+
"~",
|
|
68597
|
+
"n",
|
|
68598
|
+
"N"
|
|
68599
|
+
],
|
|
68600
|
+
resolve: (source) => {
|
|
68601
|
+
if (NULL_VALUES.indexOf(source) !== -1) return null;
|
|
68602
|
+
return NOT_RESOLVED;
|
|
68603
|
+
},
|
|
68604
|
+
identify: (object) => object === null,
|
|
68605
|
+
represent: () => "null"
|
|
68606
|
+
});
|
|
68774
68607
|
//#endregion
|
|
68775
|
-
//#region
|
|
68776
|
-
var
|
|
68777
|
-
|
|
68778
|
-
|
|
68779
|
-
|
|
68780
|
-
|
|
68781
|
-
|
|
68782
|
-
|
|
68783
|
-
|
|
68608
|
+
//#region src/tag/scalar/bool_core.ts
|
|
68609
|
+
var TRUE_VALUES$2 = [
|
|
68610
|
+
"true",
|
|
68611
|
+
"True",
|
|
68612
|
+
"TRUE"
|
|
68613
|
+
];
|
|
68614
|
+
var FALSE_VALUES$2 = [
|
|
68615
|
+
"false",
|
|
68616
|
+
"False",
|
|
68617
|
+
"FALSE"
|
|
68618
|
+
];
|
|
68619
|
+
var boolCoreTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
68620
|
+
implicit: true,
|
|
68621
|
+
implicitFirstChars: [
|
|
68622
|
+
"t",
|
|
68623
|
+
"T",
|
|
68624
|
+
"f",
|
|
68625
|
+
"F"
|
|
68626
|
+
],
|
|
68627
|
+
resolve: (source) => {
|
|
68628
|
+
if (TRUE_VALUES$2.indexOf(source) !== -1) return true;
|
|
68629
|
+
if (FALSE_VALUES$2.indexOf(source) !== -1) return false;
|
|
68630
|
+
return NOT_RESOLVED;
|
|
68631
|
+
},
|
|
68632
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
68633
|
+
represent: (object) => object ? "true" : "false"
|
|
68634
|
+
});
|
|
68784
68635
|
//#endregion
|
|
68785
|
-
//#region
|
|
68786
|
-
var
|
|
68787
|
-
|
|
68788
|
-
|
|
68789
|
-
|
|
68790
|
-
|
|
68791
|
-
|
|
68792
|
-
|
|
68793
|
-
|
|
68636
|
+
//#region src/tag/scalar/bool_json.ts
|
|
68637
|
+
var TRUE_VALUES$1 = ["true"];
|
|
68638
|
+
var FALSE_VALUES$1 = ["false"];
|
|
68639
|
+
var boolJsonTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
68640
|
+
implicit: true,
|
|
68641
|
+
implicitFirstChars: ["t", "f"],
|
|
68642
|
+
resolve: (source) => {
|
|
68643
|
+
if (TRUE_VALUES$1.indexOf(source) !== -1) return true;
|
|
68644
|
+
if (FALSE_VALUES$1.indexOf(source) !== -1) return false;
|
|
68645
|
+
return NOT_RESOLVED;
|
|
68646
|
+
},
|
|
68647
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
68648
|
+
represent: (object) => object ? "true" : "false"
|
|
68649
|
+
});
|
|
68794
68650
|
//#endregion
|
|
68795
|
-
//#region
|
|
68796
|
-
var
|
|
68797
|
-
|
|
68798
|
-
|
|
68799
|
-
|
|
68800
|
-
|
|
68801
|
-
|
|
68802
|
-
|
|
68651
|
+
//#region src/tag/scalar/bool_yaml11.ts
|
|
68652
|
+
var TRUE_VALUES = [
|
|
68653
|
+
"true",
|
|
68654
|
+
"True",
|
|
68655
|
+
"TRUE",
|
|
68656
|
+
"y",
|
|
68657
|
+
"Y",
|
|
68658
|
+
"yes",
|
|
68659
|
+
"Yes",
|
|
68660
|
+
"YES",
|
|
68661
|
+
"on",
|
|
68662
|
+
"On",
|
|
68663
|
+
"ON"
|
|
68664
|
+
];
|
|
68665
|
+
var FALSE_VALUES = [
|
|
68666
|
+
"false",
|
|
68667
|
+
"False",
|
|
68668
|
+
"FALSE",
|
|
68669
|
+
"n",
|
|
68670
|
+
"N",
|
|
68671
|
+
"no",
|
|
68672
|
+
"No",
|
|
68673
|
+
"NO",
|
|
68674
|
+
"off",
|
|
68675
|
+
"Off",
|
|
68676
|
+
"OFF"
|
|
68677
|
+
];
|
|
68678
|
+
var boolYaml11Tag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
68679
|
+
implicit: true,
|
|
68680
|
+
implicitFirstChars: [
|
|
68681
|
+
"y",
|
|
68682
|
+
"Y",
|
|
68683
|
+
"n",
|
|
68684
|
+
"N",
|
|
68685
|
+
"t",
|
|
68686
|
+
"T",
|
|
68687
|
+
"f",
|
|
68688
|
+
"F",
|
|
68689
|
+
"o",
|
|
68690
|
+
"O"
|
|
68691
|
+
],
|
|
68692
|
+
resolve: (source) => {
|
|
68693
|
+
if (TRUE_VALUES.indexOf(source) !== -1) return true;
|
|
68694
|
+
if (FALSE_VALUES.indexOf(source) !== -1) return false;
|
|
68695
|
+
return NOT_RESOLVED;
|
|
68696
|
+
},
|
|
68697
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
68698
|
+
represent: (object) => object ? "true" : "false"
|
|
68699
|
+
});
|
|
68803
68700
|
//#endregion
|
|
68804
|
-
//#region
|
|
68805
|
-
var
|
|
68806
|
-
|
|
68807
|
-
|
|
68808
|
-
|
|
68809
|
-
|
|
68810
|
-
|
|
68811
|
-
|
|
68812
|
-
|
|
68813
|
-
return null;
|
|
68701
|
+
//#region src/tag/scalar/int_core.ts
|
|
68702
|
+
var YAML_INTEGER_IMPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
68703
|
+
var YAML_INTEGER_EXPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
68704
|
+
function parseYamlInteger$2(source) {
|
|
68705
|
+
let value = source;
|
|
68706
|
+
let sign = 1;
|
|
68707
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
68708
|
+
if (value[0] === "-") sign = -1;
|
|
68709
|
+
value = value.slice(1);
|
|
68814
68710
|
}
|
|
68815
|
-
|
|
68816
|
-
|
|
68817
|
-
|
|
68818
|
-
|
|
68819
|
-
|
|
68820
|
-
|
|
68821
|
-
|
|
68822
|
-
|
|
68823
|
-
|
|
68824
|
-
|
|
68825
|
-
|
|
68826
|
-
|
|
68827
|
-
|
|
68828
|
-
|
|
68829
|
-
|
|
68830
|
-
|
|
68831
|
-
|
|
68832
|
-
|
|
68833
|
-
|
|
68834
|
-
|
|
68835
|
-
|
|
68836
|
-
|
|
68837
|
-
|
|
68838
|
-
}
|
|
68839
|
-
},
|
|
68840
|
-
defaultStyle: "lowercase"
|
|
68841
|
-
});
|
|
68842
|
-
}));
|
|
68711
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
68712
|
+
if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
|
|
68713
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
68714
|
+
return sign * parseInt(value, 10);
|
|
68715
|
+
}
|
|
68716
|
+
function resolveYamlInteger$2(source, isExplicit) {
|
|
68717
|
+
if (isExplicit) {
|
|
68718
|
+
if (!YAML_INTEGER_EXPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
68719
|
+
} else if (!YAML_INTEGER_IMPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
68720
|
+
const result = parseYamlInteger$2(source);
|
|
68721
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
68722
|
+
}
|
|
68723
|
+
var intCoreTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
68724
|
+
implicit: true,
|
|
68725
|
+
implicitFirstChars: [
|
|
68726
|
+
"-",
|
|
68727
|
+
"+",
|
|
68728
|
+
..."0123456789"
|
|
68729
|
+
],
|
|
68730
|
+
resolve: resolveYamlInteger$2,
|
|
68731
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
68732
|
+
represent: (object) => object.toString(10)
|
|
68733
|
+
});
|
|
68843
68734
|
//#endregion
|
|
68844
|
-
//#region
|
|
68845
|
-
var
|
|
68846
|
-
|
|
68847
|
-
|
|
68848
|
-
|
|
68849
|
-
|
|
68850
|
-
|
|
68851
|
-
|
|
68852
|
-
|
|
68853
|
-
return data === "true" || data === "True" || data === "TRUE";
|
|
68735
|
+
//#region src/tag/scalar/int_json.ts
|
|
68736
|
+
var YAML_INTEGER_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)$");
|
|
68737
|
+
var YAML_INTEGER_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
68738
|
+
function parseYamlInteger$1(source) {
|
|
68739
|
+
let value = source;
|
|
68740
|
+
let sign = 1;
|
|
68741
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
68742
|
+
if (value[0] === "-") sign = -1;
|
|
68743
|
+
value = value.slice(1);
|
|
68854
68744
|
}
|
|
68855
|
-
|
|
68856
|
-
|
|
68857
|
-
|
|
68858
|
-
|
|
68859
|
-
|
|
68860
|
-
|
|
68861
|
-
|
|
68862
|
-
|
|
68863
|
-
|
|
68864
|
-
|
|
68865
|
-
|
|
68866
|
-
|
|
68867
|
-
|
|
68868
|
-
|
|
68869
|
-
|
|
68870
|
-
|
|
68871
|
-
|
|
68872
|
-
|
|
68873
|
-
|
|
68874
|
-
defaultStyle: "lowercase"
|
|
68875
|
-
});
|
|
68876
|
-
}));
|
|
68745
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
68746
|
+
if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
|
|
68747
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
68748
|
+
return sign * parseInt(value, 10);
|
|
68749
|
+
}
|
|
68750
|
+
function resolveYamlInteger$1(source, isExplicit) {
|
|
68751
|
+
if (isExplicit) {
|
|
68752
|
+
if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
68753
|
+
} else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
68754
|
+
const result = parseYamlInteger$1(source);
|
|
68755
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
68756
|
+
}
|
|
68757
|
+
var intJsonTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
68758
|
+
implicit: true,
|
|
68759
|
+
implicitFirstChars: ["-", ..."0123456789"],
|
|
68760
|
+
resolve: resolveYamlInteger$1,
|
|
68761
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
68762
|
+
represent: (object) => object.toString(10)
|
|
68763
|
+
});
|
|
68877
68764
|
//#endregion
|
|
68878
|
-
//#region
|
|
68879
|
-
var
|
|
68880
|
-
|
|
68881
|
-
|
|
68882
|
-
|
|
68883
|
-
|
|
68884
|
-
|
|
68885
|
-
|
|
68886
|
-
return c >= 48 && c <= 55;
|
|
68887
|
-
}
|
|
68888
|
-
function isDecCode(c) {
|
|
68889
|
-
return c >= 48 && c <= 57;
|
|
68890
|
-
}
|
|
68891
|
-
function resolveYamlInteger(data) {
|
|
68892
|
-
if (data === null) return false;
|
|
68893
|
-
const max = data.length;
|
|
68894
|
-
let index = 0;
|
|
68895
|
-
let hasDigits = false;
|
|
68896
|
-
if (!max) return false;
|
|
68897
|
-
let ch = data[index];
|
|
68898
|
-
if (ch === "-" || ch === "+") ch = data[++index];
|
|
68899
|
-
if (ch === "0") {
|
|
68900
|
-
if (index + 1 === max) return true;
|
|
68901
|
-
ch = data[++index];
|
|
68902
|
-
if (ch === "b") {
|
|
68903
|
-
index++;
|
|
68904
|
-
for (; index < max; index++) {
|
|
68905
|
-
ch = data[index];
|
|
68906
|
-
if (ch !== "0" && ch !== "1") return false;
|
|
68907
|
-
hasDigits = true;
|
|
68908
|
-
}
|
|
68909
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data));
|
|
68910
|
-
}
|
|
68911
|
-
if (ch === "x") {
|
|
68912
|
-
index++;
|
|
68913
|
-
for (; index < max; index++) {
|
|
68914
|
-
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
68915
|
-
hasDigits = true;
|
|
68916
|
-
}
|
|
68917
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data));
|
|
68918
|
-
}
|
|
68919
|
-
if (ch === "o") {
|
|
68920
|
-
index++;
|
|
68921
|
-
for (; index < max; index++) {
|
|
68922
|
-
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
68923
|
-
hasDigits = true;
|
|
68924
|
-
}
|
|
68925
|
-
return hasDigits && Number.isFinite(parseYamlInteger(data));
|
|
68926
|
-
}
|
|
68927
|
-
}
|
|
68928
|
-
for (; index < max; index++) {
|
|
68929
|
-
if (!isDecCode(data.charCodeAt(index))) return false;
|
|
68930
|
-
hasDigits = true;
|
|
68931
|
-
}
|
|
68932
|
-
if (!hasDigits) return false;
|
|
68933
|
-
return Number.isFinite(parseYamlInteger(data));
|
|
68934
|
-
}
|
|
68935
|
-
function parseYamlInteger(data) {
|
|
68936
|
-
let value = data;
|
|
68937
|
-
let sign = 1;
|
|
68938
|
-
let ch = value[0];
|
|
68939
|
-
if (ch === "-" || ch === "+") {
|
|
68940
|
-
if (ch === "-") sign = -1;
|
|
68941
|
-
value = value.slice(1);
|
|
68942
|
-
ch = value[0];
|
|
68943
|
-
}
|
|
68944
|
-
if (value === "0") return 0;
|
|
68945
|
-
if (ch === "0") {
|
|
68946
|
-
if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
|
|
68947
|
-
if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
|
|
68948
|
-
if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
|
|
68949
|
-
}
|
|
68950
|
-
return sign * parseInt(value, 10);
|
|
68765
|
+
//#region src/tag/scalar/int_yaml11.ts
|
|
68766
|
+
var YAML_INTEGER_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");
|
|
68767
|
+
function parseYamlInteger(source) {
|
|
68768
|
+
let value = source.replace(/_/g, "");
|
|
68769
|
+
let sign = 1;
|
|
68770
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
68771
|
+
if (value[0] === "-") sign = -1;
|
|
68772
|
+
value = value.slice(1);
|
|
68951
68773
|
}
|
|
68952
|
-
|
|
68953
|
-
|
|
68774
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
68775
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
68776
|
+
if (value.includes(":")) {
|
|
68777
|
+
let result = 0;
|
|
68778
|
+
for (const part of value.split(":")) result = result * 60 + Number(part);
|
|
68779
|
+
return sign * result;
|
|
68954
68780
|
}
|
|
68955
|
-
|
|
68956
|
-
|
|
68957
|
-
|
|
68958
|
-
|
|
68959
|
-
|
|
68960
|
-
|
|
68961
|
-
|
|
68962
|
-
|
|
68963
|
-
|
|
68964
|
-
|
|
68965
|
-
|
|
68966
|
-
|
|
68967
|
-
|
|
68968
|
-
|
|
68969
|
-
|
|
68970
|
-
|
|
68971
|
-
|
|
68972
|
-
|
|
68973
|
-
|
|
68974
|
-
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
|
68975
|
-
}
|
|
68976
|
-
},
|
|
68977
|
-
defaultStyle: "decimal",
|
|
68978
|
-
styleAliases: {
|
|
68979
|
-
binary: [2, "bin"],
|
|
68980
|
-
octal: [8, "oct"],
|
|
68981
|
-
decimal: [10, "dec"],
|
|
68982
|
-
hexadecimal: [16, "hex"]
|
|
68983
|
-
}
|
|
68984
|
-
});
|
|
68985
|
-
}));
|
|
68781
|
+
if (value !== "0" && value[0] === "0") return sign * parseInt(value, 8);
|
|
68782
|
+
return sign * parseInt(value, 10);
|
|
68783
|
+
}
|
|
68784
|
+
function resolveYamlInteger(source) {
|
|
68785
|
+
if (!YAML_INTEGER_PATTERN.test(source)) return NOT_RESOLVED;
|
|
68786
|
+
const result = parseYamlInteger(source);
|
|
68787
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
68788
|
+
}
|
|
68789
|
+
var intYaml11Tag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
68790
|
+
implicit: true,
|
|
68791
|
+
implicitFirstChars: [
|
|
68792
|
+
"-",
|
|
68793
|
+
"+",
|
|
68794
|
+
..."0123456789"
|
|
68795
|
+
],
|
|
68796
|
+
resolve: resolveYamlInteger,
|
|
68797
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
68798
|
+
represent: (object) => object.toString(10)
|
|
68799
|
+
});
|
|
68986
68800
|
//#endregion
|
|
68987
|
-
//#region
|
|
68988
|
-
var
|
|
68989
|
-
|
|
68990
|
-
|
|
68991
|
-
|
|
68992
|
-
|
|
68993
|
-
|
|
68994
|
-
|
|
68995
|
-
|
|
68996
|
-
|
|
68997
|
-
|
|
68998
|
-
|
|
68999
|
-
|
|
69000
|
-
|
|
68801
|
+
//#region src/tag/scalar/float_core.ts
|
|
68802
|
+
var YAML_FLOAT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
68803
|
+
var YAML_FLOAT_SPECIAL_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
68804
|
+
function resolveYamlFloat$2(source) {
|
|
68805
|
+
if (!YAML_FLOAT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
68806
|
+
let value = source.toLowerCase();
|
|
68807
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
68808
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
68809
|
+
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
68810
|
+
if (value === ".nan") return NaN;
|
|
68811
|
+
const result = sign * parseFloat(value);
|
|
68812
|
+
if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN$1.test(source)) return result;
|
|
68813
|
+
return NOT_RESOLVED;
|
|
68814
|
+
}
|
|
68815
|
+
function representYamlFloat$2(object) {
|
|
68816
|
+
if (isNaN(object)) return ".nan";
|
|
68817
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
68818
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
68819
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
68820
|
+
const result = object.toString(10);
|
|
68821
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
68822
|
+
}
|
|
68823
|
+
var floatCoreTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
68824
|
+
implicit: true,
|
|
68825
|
+
implicitFirstChars: [
|
|
68826
|
+
"-",
|
|
68827
|
+
"+",
|
|
68828
|
+
".",
|
|
68829
|
+
..."0123456789"
|
|
68830
|
+
],
|
|
68831
|
+
resolve: resolveYamlFloat$2,
|
|
68832
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
68833
|
+
represent: representYamlFloat$2
|
|
68834
|
+
});
|
|
68835
|
+
//#endregion
|
|
68836
|
+
//#region src/tag/scalar/float_json.ts
|
|
68837
|
+
var YAML_FLOAT_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$");
|
|
68838
|
+
var YAML_FLOAT_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
68839
|
+
function resolveYamlFloat$1(source, isExplicit) {
|
|
68840
|
+
if (isExplicit) {
|
|
68841
|
+
if (!YAML_FLOAT_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
68842
|
+
let value = source.toLowerCase();
|
|
69001
68843
|
const sign = value[0] === "-" ? -1 : 1;
|
|
69002
|
-
if ("+-".
|
|
68844
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
69003
68845
|
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
69004
|
-
|
|
69005
|
-
|
|
69006
|
-
|
|
69007
|
-
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
69008
|
-
function representYamlFloat(object, style) {
|
|
69009
|
-
if (isNaN(object)) switch (style) {
|
|
69010
|
-
case "lowercase": return ".nan";
|
|
69011
|
-
case "uppercase": return ".NAN";
|
|
69012
|
-
case "camelcase": return ".NaN";
|
|
69013
|
-
}
|
|
69014
|
-
else if (Number.POSITIVE_INFINITY === object) switch (style) {
|
|
69015
|
-
case "lowercase": return ".inf";
|
|
69016
|
-
case "uppercase": return ".INF";
|
|
69017
|
-
case "camelcase": return ".Inf";
|
|
69018
|
-
}
|
|
69019
|
-
else if (Number.NEGATIVE_INFINITY === object) switch (style) {
|
|
69020
|
-
case "lowercase": return "-.inf";
|
|
69021
|
-
case "uppercase": return "-.INF";
|
|
69022
|
-
case "camelcase": return "-.Inf";
|
|
69023
|
-
}
|
|
69024
|
-
else if (common.isNegativeZero(object)) return "-0.0";
|
|
69025
|
-
const res = object.toString(10);
|
|
69026
|
-
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
68846
|
+
if (value === ".nan") return NaN;
|
|
68847
|
+
const result = sign * parseFloat(value);
|
|
68848
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
69027
68849
|
}
|
|
69028
|
-
|
|
69029
|
-
|
|
69030
|
-
|
|
69031
|
-
|
|
69032
|
-
|
|
69033
|
-
|
|
69034
|
-
|
|
69035
|
-
|
|
69036
|
-
|
|
69037
|
-
|
|
69038
|
-
|
|
69039
|
-
|
|
69040
|
-
|
|
69041
|
-
|
|
69042
|
-
|
|
69043
|
-
|
|
69044
|
-
|
|
69045
|
-
|
|
69046
|
-
|
|
69047
|
-
|
|
69048
|
-
] });
|
|
69049
|
-
}));
|
|
68850
|
+
if (!YAML_FLOAT_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
68851
|
+
const result = Number(source);
|
|
68852
|
+
if (Number.isFinite(result)) return result;
|
|
68853
|
+
return NOT_RESOLVED;
|
|
68854
|
+
}
|
|
68855
|
+
function representYamlFloat$1(object) {
|
|
68856
|
+
if (isNaN(object)) return ".nan";
|
|
68857
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
68858
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
68859
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
68860
|
+
const result = object.toString(10);
|
|
68861
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
68862
|
+
}
|
|
68863
|
+
var floatJsonTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
68864
|
+
implicit: true,
|
|
68865
|
+
implicitFirstChars: ["-", ..."0123456789"],
|
|
68866
|
+
resolve: resolveYamlFloat$1,
|
|
68867
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
68868
|
+
represent: representYamlFloat$1
|
|
68869
|
+
});
|
|
69050
68870
|
//#endregion
|
|
69051
|
-
//#region
|
|
69052
|
-
var
|
|
69053
|
-
|
|
69054
|
-
|
|
68871
|
+
//#region src/tag/scalar/float_yaml11.ts
|
|
68872
|
+
var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
68873
|
+
var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
68874
|
+
function resolveYamlFloat(source) {
|
|
68875
|
+
if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
68876
|
+
let value = source.toLowerCase().replace(/_/g, "");
|
|
68877
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
68878
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
68879
|
+
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
68880
|
+
if (value === ".nan") return NaN;
|
|
68881
|
+
let result = 0;
|
|
68882
|
+
if (value.includes(":")) {
|
|
68883
|
+
for (const part of value.split(":")) result = result * 60 + Number(part);
|
|
68884
|
+
result *= sign;
|
|
68885
|
+
} else result = sign * parseFloat(value);
|
|
68886
|
+
if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result;
|
|
68887
|
+
return NOT_RESOLVED;
|
|
68888
|
+
}
|
|
68889
|
+
function representYamlFloat(object) {
|
|
68890
|
+
if (isNaN(object)) return ".nan";
|
|
68891
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
68892
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
68893
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
68894
|
+
const result = object.toString(10);
|
|
68895
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
68896
|
+
}
|
|
68897
|
+
var floatYaml11Tag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
68898
|
+
implicit: true,
|
|
68899
|
+
implicitFirstChars: [
|
|
68900
|
+
"-",
|
|
68901
|
+
"+",
|
|
68902
|
+
".",
|
|
68903
|
+
..."0123456789"
|
|
68904
|
+
],
|
|
68905
|
+
resolve: resolveYamlFloat,
|
|
68906
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
68907
|
+
represent: representYamlFloat
|
|
68908
|
+
});
|
|
69055
68909
|
//#endregion
|
|
69056
|
-
//#region
|
|
69057
|
-
var
|
|
69058
|
-
|
|
69059
|
-
|
|
69060
|
-
|
|
69061
|
-
|
|
69062
|
-
|
|
69063
|
-
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
69064
|
-
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
69065
|
-
return false;
|
|
68910
|
+
//#region src/tag/scalar/merge.ts
|
|
68911
|
+
var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", {
|
|
68912
|
+
implicit: true,
|
|
68913
|
+
implicitFirstChars: ["<"],
|
|
68914
|
+
resolve: (source, isExplicit) => {
|
|
68915
|
+
if (source === "<<" || isExplicit && source === "") return MERGE_KEY;
|
|
68916
|
+
return NOT_RESOLVED;
|
|
69066
68917
|
}
|
|
69067
|
-
|
|
69068
|
-
|
|
69069
|
-
|
|
69070
|
-
|
|
69071
|
-
|
|
69072
|
-
|
|
69073
|
-
|
|
69074
|
-
|
|
69075
|
-
|
|
69076
|
-
|
|
69077
|
-
|
|
69078
|
-
|
|
69079
|
-
|
|
69080
|
-
|
|
69081
|
-
|
|
69082
|
-
|
|
69083
|
-
|
|
69084
|
-
|
|
69085
|
-
|
|
69086
|
-
|
|
69087
|
-
|
|
69088
|
-
|
|
69089
|
-
|
|
69090
|
-
|
|
69091
|
-
|
|
69092
|
-
|
|
68918
|
+
});
|
|
68919
|
+
//#endregion
|
|
68920
|
+
//#region src/tag/scalar/binary.ts
|
|
68921
|
+
var BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
68922
|
+
function resolveYamlBinary(source) {
|
|
68923
|
+
const input = source.replace(/\s/g, "");
|
|
68924
|
+
if (input.length % 4 !== 0 || !BASE64_PATTERN.test(input)) return NOT_RESOLVED;
|
|
68925
|
+
const binary = atob(input);
|
|
68926
|
+
const result = new Uint8Array(binary.length);
|
|
68927
|
+
for (let index = 0; index < binary.length; index++) result[index] = binary.charCodeAt(index);
|
|
68928
|
+
return result;
|
|
68929
|
+
}
|
|
68930
|
+
function representYamlBinary(object) {
|
|
68931
|
+
let binary = "";
|
|
68932
|
+
for (let index = 0; index < object.length; index++) binary += String.fromCharCode(object[index]);
|
|
68933
|
+
return btoa(binary);
|
|
68934
|
+
}
|
|
68935
|
+
var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
68936
|
+
resolve: resolveYamlBinary,
|
|
68937
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Uint8Array]",
|
|
68938
|
+
represent: representYamlBinary
|
|
68939
|
+
});
|
|
68940
|
+
//#endregion
|
|
68941
|
+
//#region src/tag/scalar/timestamp.ts
|
|
68942
|
+
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
68943
|
+
var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
68944
|
+
function resolveYamlTimestamp(source) {
|
|
68945
|
+
let match = YAML_DATE_REGEXP.exec(source);
|
|
68946
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
68947
|
+
if (match === null) return NOT_RESOLVED;
|
|
68948
|
+
const year = +match[1];
|
|
68949
|
+
const month = +match[2] - 1;
|
|
68950
|
+
const day = +match[3];
|
|
68951
|
+
if (!match[4]) {
|
|
68952
|
+
const date = new Date(Date.UTC(year, month, day));
|
|
68953
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
69093
68954
|
return date;
|
|
69094
68955
|
}
|
|
69095
|
-
|
|
69096
|
-
|
|
68956
|
+
const hour = +match[4];
|
|
68957
|
+
const minute = +match[5];
|
|
68958
|
+
const second = +match[6];
|
|
68959
|
+
let fraction = 0;
|
|
68960
|
+
if (hour > 23 || minute > 59 || second > 59) return NOT_RESOLVED;
|
|
68961
|
+
if (match[7]) {
|
|
68962
|
+
let value = match[7].slice(0, 3);
|
|
68963
|
+
while (value.length < 3) value += "0";
|
|
68964
|
+
fraction = +value;
|
|
69097
68965
|
}
|
|
69098
|
-
|
|
69099
|
-
|
|
69100
|
-
|
|
69101
|
-
|
|
69102
|
-
|
|
69103
|
-
|
|
69104
|
-
|
|
69105
|
-
|
|
69106
|
-
//#endregion
|
|
69107
|
-
//#region lib/type/merge.js
|
|
69108
|
-
var require_merge = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
69109
|
-
var Type = require_type();
|
|
69110
|
-
function resolveYamlMerge(data) {
|
|
69111
|
-
return data === "<<" || data === null;
|
|
68966
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
68967
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
68968
|
+
if (match[9]) {
|
|
68969
|
+
const offsetHour = +match[10];
|
|
68970
|
+
const offsetMinute = +(match[11] || 0);
|
|
68971
|
+
if (offsetHour > 23 || offsetMinute > 59) return NOT_RESOLVED;
|
|
68972
|
+
const offset = (offsetHour * 60 + offsetMinute) * 6e4;
|
|
68973
|
+
date.setTime(date.getTime() - (match[9] === "-" ? -offset : offset));
|
|
69112
68974
|
}
|
|
69113
|
-
|
|
69114
|
-
|
|
69115
|
-
|
|
69116
|
-
|
|
69117
|
-
|
|
68975
|
+
return date;
|
|
68976
|
+
}
|
|
68977
|
+
var timestampTag = defineScalarTag("tag:yaml.org,2002:timestamp", {
|
|
68978
|
+
implicit: true,
|
|
68979
|
+
implicitFirstChars: [..."0123456789"],
|
|
68980
|
+
resolve: resolveYamlTimestamp,
|
|
68981
|
+
identify: (object) => object instanceof Date,
|
|
68982
|
+
represent: (object) => object.toISOString()
|
|
68983
|
+
});
|
|
68984
|
+
//#endregion
|
|
68985
|
+
//#region src/tag/sequence/seq.ts
|
|
68986
|
+
var seqTag = defineSequenceTag("tag:yaml.org,2002:seq", {
|
|
68987
|
+
create: () => [],
|
|
68988
|
+
addItem: (container, item) => {
|
|
68989
|
+
container.push(item);
|
|
68990
|
+
},
|
|
68991
|
+
identify: Array.isArray
|
|
68992
|
+
});
|
|
69118
68993
|
//#endregion
|
|
69119
|
-
//#region
|
|
69120
|
-
|
|
69121
|
-
|
|
69122
|
-
|
|
69123
|
-
|
|
69124
|
-
|
|
69125
|
-
|
|
69126
|
-
|
|
69127
|
-
|
|
69128
|
-
|
|
69129
|
-
|
|
69130
|
-
|
|
69131
|
-
|
|
69132
|
-
|
|
68994
|
+
//#region src/common/object.ts
|
|
68995
|
+
function isPlainObject(data) {
|
|
68996
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) return false;
|
|
68997
|
+
const prototype = Object.getPrototypeOf(data);
|
|
68998
|
+
return prototype === null || prototype === Object.prototype;
|
|
68999
|
+
}
|
|
69000
|
+
function pick(object, keys) {
|
|
69001
|
+
const result = {};
|
|
69002
|
+
for (const key of keys) if (object[key] !== void 0) result[key] = object[key];
|
|
69003
|
+
return result;
|
|
69004
|
+
}
|
|
69005
|
+
//#endregion
|
|
69006
|
+
//#region src/tag/sequence/omap.ts
|
|
69007
|
+
var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", {
|
|
69008
|
+
create: () => ({
|
|
69009
|
+
list: [],
|
|
69010
|
+
seen: /* @__PURE__ */ new Set()
|
|
69011
|
+
}),
|
|
69012
|
+
addItem: (carrier, item) => {
|
|
69013
|
+
let key;
|
|
69014
|
+
if (item instanceof Map) {
|
|
69015
|
+
if (item.size !== 1) return "cannot resolve an ordered map item";
|
|
69016
|
+
key = item.keys().next().value;
|
|
69017
|
+
} else if (isPlainObject(item)) {
|
|
69018
|
+
const itemKeys = Object.keys(item);
|
|
69019
|
+
if (itemKeys.length !== 1) return "cannot resolve an ordered map item";
|
|
69020
|
+
key = itemKeys[0];
|
|
69021
|
+
} else return "cannot resolve an ordered map item";
|
|
69022
|
+
if (carrier.seen.has(key)) return "duplicate key in ordered map";
|
|
69023
|
+
carrier.seen.add(key);
|
|
69024
|
+
carrier.list.push(item);
|
|
69025
|
+
return "";
|
|
69026
|
+
},
|
|
69027
|
+
finalize: (carrier) => carrier.list
|
|
69028
|
+
});
|
|
69029
|
+
//#endregion
|
|
69030
|
+
//#region src/tag/sequence/pairs.ts
|
|
69031
|
+
var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
|
|
69032
|
+
create: () => [],
|
|
69033
|
+
addItem: (container, item) => {
|
|
69034
|
+
if (item instanceof Map) {
|
|
69035
|
+
if (item.size !== 1) return "cannot resolve a pairs item";
|
|
69036
|
+
container.push(item.entries().next().value);
|
|
69037
|
+
return "";
|
|
69133
69038
|
}
|
|
69134
|
-
return
|
|
69039
|
+
if (Object.prototype.toString.call(item) !== "[object Object]") return "cannot resolve a pairs item";
|
|
69040
|
+
const object = item;
|
|
69041
|
+
const keys = Object.keys(object);
|
|
69042
|
+
if (keys.length !== 1) return "cannot resolve a pairs item";
|
|
69043
|
+
container.push([keys[0], object[keys[0]]]);
|
|
69044
|
+
return "";
|
|
69135
69045
|
}
|
|
69136
|
-
|
|
69137
|
-
|
|
69138
|
-
|
|
69139
|
-
|
|
69140
|
-
|
|
69141
|
-
|
|
69142
|
-
|
|
69143
|
-
|
|
69144
|
-
|
|
69145
|
-
|
|
69146
|
-
|
|
69046
|
+
});
|
|
69047
|
+
//#endregion
|
|
69048
|
+
//#region src/tag/mapping/map.ts
|
|
69049
|
+
var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
69050
|
+
create: () => ({}),
|
|
69051
|
+
identify: isPlainObject,
|
|
69052
|
+
represent: (o) => {
|
|
69053
|
+
const map = /* @__PURE__ */ new Map();
|
|
69054
|
+
for (const key of Object.keys(o)) map.set(key, o[key]);
|
|
69055
|
+
return map;
|
|
69056
|
+
},
|
|
69057
|
+
addPair: (container, key, value) => {
|
|
69058
|
+
if (key !== null && typeof key === "object") return "object-based map does not support complex keys";
|
|
69059
|
+
const normalizedKey = String(key);
|
|
69060
|
+
if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
|
|
69061
|
+
value,
|
|
69062
|
+
enumerable: true,
|
|
69063
|
+
configurable: true,
|
|
69064
|
+
writable: true
|
|
69065
|
+
});
|
|
69066
|
+
else container[normalizedKey] = value;
|
|
69067
|
+
return "";
|
|
69068
|
+
},
|
|
69069
|
+
has: (container, key) => {
|
|
69070
|
+
if (key !== null && typeof key === "object") return false;
|
|
69071
|
+
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
69072
|
+
},
|
|
69073
|
+
keys: (container) => Object.keys(container),
|
|
69074
|
+
get: (container, key) => container[String(key)]
|
|
69075
|
+
});
|
|
69076
|
+
//#endregion
|
|
69077
|
+
//#region src/tag/mapping/set.ts
|
|
69078
|
+
var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
69079
|
+
create: () => /* @__PURE__ */ new Set(),
|
|
69080
|
+
identify: (data) => data instanceof Set,
|
|
69081
|
+
represent: (data) => {
|
|
69082
|
+
const map = /* @__PURE__ */ new Map();
|
|
69083
|
+
for (const key of data) map.set(key, null);
|
|
69084
|
+
return map;
|
|
69085
|
+
},
|
|
69086
|
+
addPair: (container, key, value) => {
|
|
69087
|
+
if (value !== null) return "cannot resolve a set item";
|
|
69088
|
+
container.add(key);
|
|
69089
|
+
return "";
|
|
69090
|
+
},
|
|
69091
|
+
has: (container, key) => container.has(key),
|
|
69092
|
+
keys: (container) => container.keys(),
|
|
69093
|
+
get: () => null
|
|
69094
|
+
});
|
|
69095
|
+
//#endregion
|
|
69096
|
+
//#region src/schema.ts
|
|
69097
|
+
function createTagDefinitionMap() {
|
|
69098
|
+
return {
|
|
69099
|
+
scalar: {},
|
|
69100
|
+
sequence: {},
|
|
69101
|
+
mapping: {}
|
|
69102
|
+
};
|
|
69103
|
+
}
|
|
69104
|
+
function createTagDefinitionListMap() {
|
|
69105
|
+
return {
|
|
69106
|
+
scalar: [],
|
|
69107
|
+
sequence: [],
|
|
69108
|
+
mapping: []
|
|
69109
|
+
};
|
|
69110
|
+
}
|
|
69111
|
+
function compileTags(tags) {
|
|
69112
|
+
const result = [];
|
|
69113
|
+
for (const tag of tags) {
|
|
69114
|
+
let index = result.length;
|
|
69115
|
+
for (let previousIndex = 0; previousIndex < result.length; previousIndex++) {
|
|
69116
|
+
const previous = result[previousIndex];
|
|
69117
|
+
if (previous.nodeKind === tag.nodeKind && previous.tagName === tag.tagName && previous.matchByTagPrefix === tag.matchByTagPrefix) {
|
|
69118
|
+
index = previousIndex;
|
|
69119
|
+
break;
|
|
69147
69120
|
}
|
|
69148
|
-
bits = bits << 6 | map.indexOf(input.charAt(idx));
|
|
69149
69121
|
}
|
|
69150
|
-
|
|
69151
|
-
if (tailbits === 0) {
|
|
69152
|
-
result.push(bits >> 16 & 255);
|
|
69153
|
-
result.push(bits >> 8 & 255);
|
|
69154
|
-
result.push(bits & 255);
|
|
69155
|
-
} else if (tailbits === 18) {
|
|
69156
|
-
result.push(bits >> 10 & 255);
|
|
69157
|
-
result.push(bits >> 2 & 255);
|
|
69158
|
-
} else if (tailbits === 12) result.push(bits >> 4 & 255);
|
|
69159
|
-
return new Uint8Array(result);
|
|
69122
|
+
result[index] = tag;
|
|
69160
69123
|
}
|
|
69161
|
-
|
|
69162
|
-
|
|
69163
|
-
|
|
69164
|
-
|
|
69165
|
-
|
|
69166
|
-
|
|
69167
|
-
|
|
69168
|
-
|
|
69169
|
-
|
|
69170
|
-
|
|
69171
|
-
|
|
69124
|
+
return result;
|
|
69125
|
+
}
|
|
69126
|
+
var Schema = class Schema {
|
|
69127
|
+
tags;
|
|
69128
|
+
implicitScalarTags;
|
|
69129
|
+
implicitScalarByFirstChar;
|
|
69130
|
+
implicitScalarAnyFirstChar;
|
|
69131
|
+
defaultScalarTag;
|
|
69132
|
+
defaultSequenceTag;
|
|
69133
|
+
defaultMappingTag;
|
|
69134
|
+
exact;
|
|
69135
|
+
prefix;
|
|
69136
|
+
constructor(tags) {
|
|
69137
|
+
const compiledTags = compileTags(tags);
|
|
69138
|
+
const implicitScalarTags = [];
|
|
69139
|
+
const exact = createTagDefinitionMap();
|
|
69140
|
+
const prefix = createTagDefinitionListMap();
|
|
69141
|
+
for (const tag of compiledTags) {
|
|
69142
|
+
if (tag.nodeKind === "scalar" && tag.implicit) {
|
|
69143
|
+
if (tag.matchByTagPrefix) throw new Error("Implicit scalar tags cannot match by tag prefix");
|
|
69144
|
+
implicitScalarTags.push(tag);
|
|
69145
|
+
}
|
|
69146
|
+
switch (tag.nodeKind) {
|
|
69147
|
+
case "scalar":
|
|
69148
|
+
if (tag.matchByTagPrefix) prefix.scalar.push(tag);
|
|
69149
|
+
else exact.scalar[tag.tagName] = tag;
|
|
69150
|
+
break;
|
|
69151
|
+
case "sequence":
|
|
69152
|
+
if (tag.matchByTagPrefix) prefix.sequence.push(tag);
|
|
69153
|
+
else exact.sequence[tag.tagName] = tag;
|
|
69154
|
+
break;
|
|
69155
|
+
case "mapping":
|
|
69156
|
+
if (tag.matchByTagPrefix) prefix.mapping.push(tag);
|
|
69157
|
+
else exact.mapping[tag.tagName] = tag;
|
|
69158
|
+
break;
|
|
69172
69159
|
}
|
|
69173
|
-
bits = (bits << 8) + object[idx];
|
|
69174
|
-
}
|
|
69175
|
-
const tail = max % 3;
|
|
69176
|
-
if (tail === 0) {
|
|
69177
|
-
result += map[bits >> 18 & 63];
|
|
69178
|
-
result += map[bits >> 12 & 63];
|
|
69179
|
-
result += map[bits >> 6 & 63];
|
|
69180
|
-
result += map[bits & 63];
|
|
69181
|
-
} else if (tail === 2) {
|
|
69182
|
-
result += map[bits >> 10 & 63];
|
|
69183
|
-
result += map[bits >> 4 & 63];
|
|
69184
|
-
result += map[bits << 2 & 63];
|
|
69185
|
-
result += map[64];
|
|
69186
|
-
} else if (tail === 1) {
|
|
69187
|
-
result += map[bits >> 2 & 63];
|
|
69188
|
-
result += map[bits << 4 & 63];
|
|
69189
|
-
result += map[64];
|
|
69190
|
-
result += map[64];
|
|
69191
69160
|
}
|
|
69192
|
-
|
|
69161
|
+
const implicitScalarAnyFirstChar = implicitScalarTags.filter((tag) => tag.implicitFirstChars === null);
|
|
69162
|
+
const keys = /* @__PURE__ */ new Set();
|
|
69163
|
+
for (const tag of implicitScalarTags) if (tag.implicitFirstChars !== null) for (const key of tag.implicitFirstChars) keys.add(key);
|
|
69164
|
+
const implicitScalarByFirstChar = /* @__PURE__ */ new Map();
|
|
69165
|
+
for (const key of keys) implicitScalarByFirstChar.set(key, implicitScalarTags.filter((tag) => tag.implicitFirstChars === null || tag.implicitFirstChars.indexOf(key) !== -1));
|
|
69166
|
+
const defaultScalarTag = exact.scalar["tag:yaml.org,2002:str"];
|
|
69167
|
+
if (!defaultScalarTag) throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");
|
|
69168
|
+
this.tags = compiledTags;
|
|
69169
|
+
this.implicitScalarTags = implicitScalarTags;
|
|
69170
|
+
this.implicitScalarByFirstChar = implicitScalarByFirstChar;
|
|
69171
|
+
this.implicitScalarAnyFirstChar = implicitScalarAnyFirstChar;
|
|
69172
|
+
this.defaultScalarTag = defaultScalarTag;
|
|
69173
|
+
this.defaultSequenceTag = exact.sequence["tag:yaml.org,2002:seq"];
|
|
69174
|
+
this.defaultMappingTag = exact.mapping["tag:yaml.org,2002:map"];
|
|
69175
|
+
this.exact = exact;
|
|
69176
|
+
this.prefix = prefix;
|
|
69193
69177
|
}
|
|
69194
|
-
|
|
69195
|
-
|
|
69178
|
+
withTags(...tags) {
|
|
69179
|
+
let flatTags = [];
|
|
69180
|
+
for (const tag of tags) flatTags = flatTags.concat(tag);
|
|
69181
|
+
return new Schema([...this.tags, ...flatTags]);
|
|
69196
69182
|
}
|
|
69197
|
-
|
|
69198
|
-
|
|
69199
|
-
|
|
69200
|
-
|
|
69201
|
-
|
|
69202
|
-
|
|
69203
|
-
|
|
69204
|
-
|
|
69183
|
+
};
|
|
69184
|
+
var FAILSAFE_SCHEMA = new Schema([
|
|
69185
|
+
strTag,
|
|
69186
|
+
seqTag,
|
|
69187
|
+
mapTag
|
|
69188
|
+
]);
|
|
69189
|
+
new Schema([
|
|
69190
|
+
...FAILSAFE_SCHEMA.tags,
|
|
69191
|
+
nullJsonTag,
|
|
69192
|
+
boolJsonTag,
|
|
69193
|
+
intJsonTag,
|
|
69194
|
+
floatJsonTag
|
|
69195
|
+
]);
|
|
69196
|
+
var CORE_SCHEMA = new Schema([
|
|
69197
|
+
...FAILSAFE_SCHEMA.tags,
|
|
69198
|
+
nullCoreTag,
|
|
69199
|
+
boolCoreTag,
|
|
69200
|
+
intCoreTag,
|
|
69201
|
+
floatCoreTag
|
|
69202
|
+
]);
|
|
69203
|
+
var YAML11_SCHEMA = new Schema([
|
|
69204
|
+
...FAILSAFE_SCHEMA.tags,
|
|
69205
|
+
nullYaml11Tag,
|
|
69206
|
+
boolYaml11Tag,
|
|
69207
|
+
intYaml11Tag,
|
|
69208
|
+
floatYaml11Tag,
|
|
69209
|
+
timestampTag,
|
|
69210
|
+
mergeTag,
|
|
69211
|
+
binaryTag,
|
|
69212
|
+
omapTag,
|
|
69213
|
+
pairsTag,
|
|
69214
|
+
setTag
|
|
69215
|
+
]);
|
|
69205
69216
|
//#endregion
|
|
69206
|
-
//#region
|
|
69207
|
-
|
|
69208
|
-
|
|
69209
|
-
|
|
69210
|
-
|
|
69211
|
-
|
|
69212
|
-
|
|
69213
|
-
|
|
69214
|
-
|
|
69215
|
-
|
|
69216
|
-
|
|
69217
|
-
|
|
69218
|
-
|
|
69219
|
-
|
|
69220
|
-
|
|
69221
|
-
|
|
69222
|
-
|
|
69223
|
-
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
|
69224
|
-
else return false;
|
|
69225
|
-
}
|
|
69226
|
-
return true;
|
|
69227
|
-
}
|
|
69228
|
-
function constructYamlOmap(data) {
|
|
69229
|
-
return data !== null ? data : [];
|
|
69217
|
+
//#region src/tag/mapping/real_map.ts
|
|
69218
|
+
defineMappingTag("tag:yaml.org,2002:map", {
|
|
69219
|
+
create: () => /* @__PURE__ */ new Map(),
|
|
69220
|
+
addPair: (container, key, value) => {
|
|
69221
|
+
container.set(key, value);
|
|
69222
|
+
return "";
|
|
69223
|
+
},
|
|
69224
|
+
has: (container, key) => container.has(key),
|
|
69225
|
+
keys: (container) => container.keys(),
|
|
69226
|
+
get: (container, key) => container.get(key),
|
|
69227
|
+
identify: (data) => data instanceof Map || isPlainObject(data),
|
|
69228
|
+
represent: (data) => {
|
|
69229
|
+
if (data instanceof Map) return data;
|
|
69230
|
+
const map = /* @__PURE__ */ new Map();
|
|
69231
|
+
const obj = data;
|
|
69232
|
+
for (const key of Object.keys(obj)) map.set(key, obj[key]);
|
|
69233
|
+
return map;
|
|
69230
69234
|
}
|
|
69231
|
-
|
|
69232
|
-
kind: "sequence",
|
|
69233
|
-
resolve: resolveYamlOmap,
|
|
69234
|
-
construct: constructYamlOmap
|
|
69235
|
-
});
|
|
69236
|
-
}));
|
|
69235
|
+
});
|
|
69237
69236
|
//#endregion
|
|
69238
|
-
//#region
|
|
69239
|
-
|
|
69240
|
-
|
|
69241
|
-
|
|
69242
|
-
|
|
69243
|
-
|
|
69244
|
-
|
|
69245
|
-
const result = new Array(object.length);
|
|
69246
|
-
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
69247
|
-
const pair = object[index];
|
|
69248
|
-
if (_toString.call(pair) !== "[object Object]") return false;
|
|
69249
|
-
const keys = Object.keys(pair);
|
|
69250
|
-
if (keys.length !== 1) return false;
|
|
69251
|
-
result[index] = [keys[0], pair[keys[0]]];
|
|
69237
|
+
//#region src/tag/mapping/legacy_map.ts
|
|
69238
|
+
function normalizeKey(key) {
|
|
69239
|
+
if (Array.isArray(key)) {
|
|
69240
|
+
const array = Array.prototype.slice.call(key);
|
|
69241
|
+
for (let index = 0; index < array.length; index++) {
|
|
69242
|
+
if (Array.isArray(array[index])) return null;
|
|
69243
|
+
if (typeof array[index] === "object" && Object.prototype.toString.call(array[index]) === "[object Object]") array[index] = "[object Object]";
|
|
69252
69244
|
}
|
|
69253
|
-
return
|
|
69245
|
+
return String(array);
|
|
69254
69246
|
}
|
|
69255
|
-
|
|
69256
|
-
|
|
69257
|
-
|
|
69258
|
-
|
|
69259
|
-
|
|
69260
|
-
|
|
69261
|
-
|
|
69262
|
-
|
|
69263
|
-
|
|
69264
|
-
return
|
|
69265
|
-
}
|
|
69266
|
-
|
|
69267
|
-
|
|
69268
|
-
|
|
69269
|
-
|
|
69270
|
-
|
|
69271
|
-
|
|
69247
|
+
if (typeof key === "object" && Object.prototype.toString.call(key) === "[object Object]") return "[object Object]";
|
|
69248
|
+
return String(key);
|
|
69249
|
+
}
|
|
69250
|
+
defineMappingTag("tag:yaml.org,2002:map", {
|
|
69251
|
+
create: () => ({}),
|
|
69252
|
+
identify: isPlainObject,
|
|
69253
|
+
represent: (o) => {
|
|
69254
|
+
const map = /* @__PURE__ */ new Map();
|
|
69255
|
+
for (const key of Object.keys(o)) map.set(key, o[key]);
|
|
69256
|
+
return map;
|
|
69257
|
+
},
|
|
69258
|
+
addPair: (container, key, value) => {
|
|
69259
|
+
const normalizedKey = normalizeKey(key);
|
|
69260
|
+
if (normalizedKey === null) return "nested arrays are not supported inside keys";
|
|
69261
|
+
if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
|
|
69262
|
+
value,
|
|
69263
|
+
enumerable: true,
|
|
69264
|
+
configurable: true,
|
|
69265
|
+
writable: true
|
|
69266
|
+
});
|
|
69267
|
+
else container[normalizedKey] = value;
|
|
69268
|
+
return "";
|
|
69269
|
+
},
|
|
69270
|
+
has: (container, key) => {
|
|
69271
|
+
const normalizedKey = normalizeKey(key);
|
|
69272
|
+
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
69273
|
+
},
|
|
69274
|
+
keys: (container) => Object.keys(container),
|
|
69275
|
+
get: (container, key) => container[String(key)]
|
|
69276
|
+
});
|
|
69272
69277
|
//#endregion
|
|
69273
|
-
//#region
|
|
69274
|
-
var
|
|
69275
|
-
|
|
69276
|
-
|
|
69277
|
-
|
|
69278
|
-
|
|
69279
|
-
|
|
69280
|
-
|
|
69281
|
-
|
|
69282
|
-
|
|
69283
|
-
|
|
69278
|
+
//#region src/common/snippet.ts
|
|
69279
|
+
var DEFAULT_SNIPPET_OPTIONS = {
|
|
69280
|
+
maxLength: 79,
|
|
69281
|
+
indent: 1,
|
|
69282
|
+
linesBefore: 3,
|
|
69283
|
+
linesAfter: 2
|
|
69284
|
+
};
|
|
69285
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
69286
|
+
let head = "";
|
|
69287
|
+
let tail = "";
|
|
69288
|
+
const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
69289
|
+
if (position - lineStart > maxHalfLength) {
|
|
69290
|
+
head = " ... ";
|
|
69291
|
+
lineStart = position - maxHalfLength + head.length;
|
|
69284
69292
|
}
|
|
69285
|
-
|
|
69286
|
-
|
|
69293
|
+
if (lineEnd - position > maxHalfLength) {
|
|
69294
|
+
tail = " ...";
|
|
69295
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
69287
69296
|
}
|
|
69288
|
-
|
|
69289
|
-
|
|
69290
|
-
|
|
69291
|
-
|
|
69292
|
-
|
|
69293
|
-
|
|
69294
|
-
|
|
69295
|
-
|
|
69296
|
-
|
|
69297
|
-
|
|
69298
|
-
|
|
69299
|
-
|
|
69300
|
-
|
|
69301
|
-
|
|
69302
|
-
|
|
69303
|
-
|
|
69304
|
-
|
|
69305
|
-
|
|
69306
|
-
|
|
69307
|
-
|
|
69308
|
-
|
|
69309
|
-
|
|
69310
|
-
|
|
69311
|
-
var YAMLException = require_exception();
|
|
69312
|
-
var makeSnippet = require_snippet();
|
|
69313
|
-
var DEFAULT_SCHEMA = require_default();
|
|
69314
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
69315
|
-
var CONTEXT_FLOW_IN = 1;
|
|
69316
|
-
var CONTEXT_FLOW_OUT = 2;
|
|
69317
|
-
var CONTEXT_BLOCK_IN = 3;
|
|
69318
|
-
var CONTEXT_BLOCK_OUT = 4;
|
|
69319
|
-
var CHOMPING_CLIP = 1;
|
|
69320
|
-
var CHOMPING_STRIP = 2;
|
|
69321
|
-
var CHOMPING_KEEP = 3;
|
|
69322
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
69323
|
-
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
69324
|
-
var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
|
|
69325
|
-
var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
|
|
69326
|
-
var PATTERN_TAG_URI = /^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;
|
|
69327
|
-
function _class(obj) {
|
|
69328
|
-
return Object.prototype.toString.call(obj);
|
|
69297
|
+
return {
|
|
69298
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
|
|
69299
|
+
pos: position - lineStart + head.length
|
|
69300
|
+
};
|
|
69301
|
+
}
|
|
69302
|
+
function padStart(string, max) {
|
|
69303
|
+
return " ".repeat(Math.max(max - string.length, 0)) + string;
|
|
69304
|
+
}
|
|
69305
|
+
function makeSnippet(mark, options) {
|
|
69306
|
+
if (!mark.buffer) return null;
|
|
69307
|
+
const opts = {
|
|
69308
|
+
...DEFAULT_SNIPPET_OPTIONS,
|
|
69309
|
+
...options
|
|
69310
|
+
};
|
|
69311
|
+
const re = /\r?\n|\r|\0/g;
|
|
69312
|
+
const lineStarts = [0];
|
|
69313
|
+
const lineEnds = [];
|
|
69314
|
+
let match;
|
|
69315
|
+
let foundLineNo = -1;
|
|
69316
|
+
while (match = re.exec(mark.buffer)) {
|
|
69317
|
+
lineEnds.push(match.index);
|
|
69318
|
+
lineStarts.push(match.index + match[0].length);
|
|
69319
|
+
if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
|
|
69329
69320
|
}
|
|
69330
|
-
|
|
69331
|
-
|
|
69321
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
69322
|
+
let result = "";
|
|
69323
|
+
const lineNoLength = Math.min(mark.line + opts.linesAfter, lineEnds.length).toString().length;
|
|
69324
|
+
const maxLineLength = opts.maxLength - (opts.indent + lineNoLength + 3);
|
|
69325
|
+
for (let i = 1; i <= opts.linesBefore; i++) {
|
|
69326
|
+
if (foundLineNo - i < 0) break;
|
|
69327
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
69328
|
+
result = `${" ".repeat(opts.indent)}${padStart((mark.line - i + 1).toString(), lineNoLength)} | ${line.str}\n${result}`;
|
|
69332
69329
|
}
|
|
69333
|
-
|
|
69334
|
-
|
|
69330
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
69331
|
+
result += `${" ".repeat(opts.indent)}${padStart((mark.line + 1).toString(), lineNoLength)} | ${line.str}\n`;
|
|
69332
|
+
result += `${"-".repeat(opts.indent + lineNoLength + 3 + line.pos)}^\n`;
|
|
69333
|
+
for (let i = 1; i <= opts.linesAfter; i++) {
|
|
69334
|
+
if (foundLineNo + i >= lineEnds.length) break;
|
|
69335
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
69336
|
+
result += `${" ".repeat(opts.indent)}${padStart((mark.line + i + 1).toString(), lineNoLength)} | ${line.str}\n`;
|
|
69335
69337
|
}
|
|
69336
|
-
|
|
69337
|
-
|
|
69338
|
+
return result.replace(/\n$/, "");
|
|
69339
|
+
}
|
|
69340
|
+
//#endregion
|
|
69341
|
+
//#region src/common/exception.ts
|
|
69342
|
+
function formatError(exception, compact) {
|
|
69343
|
+
let where = "";
|
|
69344
|
+
if (!exception.mark) return exception.reason;
|
|
69345
|
+
if (exception.mark.name) where += `in "${exception.mark.name}" `;
|
|
69346
|
+
where += `(${exception.mark.line + 1}:${exception.mark.column + 1})`;
|
|
69347
|
+
if (!compact && exception.mark.snippet) where += `\n\n${exception.mark.snippet}`;
|
|
69348
|
+
return `${exception.reason} ${where}`;
|
|
69349
|
+
}
|
|
69350
|
+
var YAMLException = class extends Error {
|
|
69351
|
+
reason;
|
|
69352
|
+
mark;
|
|
69353
|
+
constructor(reason, mark) {
|
|
69354
|
+
super();
|
|
69355
|
+
this.name = "YAMLException";
|
|
69356
|
+
this.reason = reason;
|
|
69357
|
+
this.mark = mark;
|
|
69358
|
+
this.message = formatError(this, false);
|
|
69359
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
69338
69360
|
}
|
|
69339
|
-
|
|
69340
|
-
return
|
|
69361
|
+
toString(compact) {
|
|
69362
|
+
return `${this.name}: ${formatError(this, compact)}`;
|
|
69341
69363
|
}
|
|
69342
|
-
|
|
69343
|
-
|
|
69344
|
-
|
|
69345
|
-
|
|
69346
|
-
|
|
69364
|
+
};
|
|
69365
|
+
function throwErrorAt(source, position, message, filename = "") {
|
|
69366
|
+
let line = 0;
|
|
69367
|
+
let lineStart = 0;
|
|
69368
|
+
for (let index = 0; index < position; index++) {
|
|
69369
|
+
const ch = source.charCodeAt(index);
|
|
69370
|
+
if (ch === 10) {
|
|
69371
|
+
line++;
|
|
69372
|
+
lineStart = index + 1;
|
|
69373
|
+
} else if (ch === 13) {
|
|
69374
|
+
line++;
|
|
69375
|
+
if (source.charCodeAt(index + 1) === 10) index++;
|
|
69376
|
+
lineStart = index + 1;
|
|
69377
|
+
}
|
|
69347
69378
|
}
|
|
69348
|
-
|
|
69349
|
-
|
|
69350
|
-
|
|
69351
|
-
|
|
69352
|
-
|
|
69379
|
+
const mark = {
|
|
69380
|
+
name: filename,
|
|
69381
|
+
buffer: source,
|
|
69382
|
+
position,
|
|
69383
|
+
line,
|
|
69384
|
+
column: position - lineStart
|
|
69385
|
+
};
|
|
69386
|
+
mark.snippet = makeSnippet(mark);
|
|
69387
|
+
throw new YAMLException(message, mark);
|
|
69388
|
+
}
|
|
69389
|
+
//#endregion
|
|
69390
|
+
//#region src/parser/parser_scalar.ts
|
|
69391
|
+
var NO_RANGE$3 = -1;
|
|
69392
|
+
function simpleEscapeSequence(c) {
|
|
69393
|
+
switch (c) {
|
|
69394
|
+
case 48: return "\0";
|
|
69395
|
+
case 97: return "\x07";
|
|
69396
|
+
case 98: return "\b";
|
|
69397
|
+
case 116: return " ";
|
|
69398
|
+
case 9: return " ";
|
|
69399
|
+
case 110: return "\n";
|
|
69400
|
+
case 118: return "\v";
|
|
69401
|
+
case 102: return "\f";
|
|
69402
|
+
case 114: return "\r";
|
|
69403
|
+
case 101: return "\x1B";
|
|
69404
|
+
case 32: return " ";
|
|
69405
|
+
case 34: return "\"";
|
|
69406
|
+
case 47: return "/";
|
|
69407
|
+
case 92: return "\\";
|
|
69408
|
+
case 78: return "
";
|
|
69409
|
+
case 95: return "\xA0";
|
|
69410
|
+
case 76: return "\u2028";
|
|
69411
|
+
case 80: return "\u2029";
|
|
69412
|
+
default: return "";
|
|
69353
69413
|
}
|
|
69354
|
-
|
|
69355
|
-
|
|
69356
|
-
|
|
69414
|
+
}
|
|
69415
|
+
var simpleEscapeCheck = new Array(256);
|
|
69416
|
+
var simpleEscapeMap = new Array(256);
|
|
69417
|
+
for (let i = 0; i < 256; i++) {
|
|
69418
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
69419
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
69420
|
+
}
|
|
69421
|
+
function charFromCodepoint(c) {
|
|
69422
|
+
if (c <= 65535) return String.fromCharCode(c);
|
|
69423
|
+
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
69424
|
+
}
|
|
69425
|
+
function fromHexCode$1(c) {
|
|
69426
|
+
if (c >= 48 && c <= 57) return c - 48;
|
|
69427
|
+
return (c | 32) - 97 + 10;
|
|
69428
|
+
}
|
|
69429
|
+
function escapedHexLen$1(c) {
|
|
69430
|
+
if (c === 120) return 2;
|
|
69431
|
+
if (c === 117) return 4;
|
|
69432
|
+
return 8;
|
|
69433
|
+
}
|
|
69434
|
+
function skipFoldedBreaks(input, position, end) {
|
|
69435
|
+
let breaks = 0;
|
|
69436
|
+
while (position < end) {
|
|
69437
|
+
const ch = input.charCodeAt(position);
|
|
69438
|
+
if (ch === 10) {
|
|
69439
|
+
breaks++;
|
|
69440
|
+
position++;
|
|
69441
|
+
} else if (ch === 13) {
|
|
69442
|
+
breaks++;
|
|
69443
|
+
position++;
|
|
69444
|
+
if (input.charCodeAt(position) === 10) position++;
|
|
69445
|
+
} else if (ch === 32 || ch === 9) position++;
|
|
69446
|
+
else break;
|
|
69357
69447
|
}
|
|
69358
|
-
|
|
69359
|
-
|
|
69360
|
-
|
|
69361
|
-
|
|
69362
|
-
|
|
69363
|
-
|
|
69364
|
-
|
|
69365
|
-
|
|
69366
|
-
|
|
69367
|
-
|
|
69368
|
-
|
|
69369
|
-
|
|
69370
|
-
|
|
69371
|
-
|
|
69372
|
-
|
|
69373
|
-
|
|
69374
|
-
|
|
69375
|
-
|
|
69376
|
-
|
|
69377
|
-
|
|
69378
|
-
|
|
69448
|
+
return {
|
|
69449
|
+
position,
|
|
69450
|
+
breaks
|
|
69451
|
+
};
|
|
69452
|
+
}
|
|
69453
|
+
function foldedBreaks(count) {
|
|
69454
|
+
if (count === 1) return " ";
|
|
69455
|
+
return "\n".repeat(count - 1);
|
|
69456
|
+
}
|
|
69457
|
+
function getPlainValue(input, start, end) {
|
|
69458
|
+
let result = "";
|
|
69459
|
+
let position = start;
|
|
69460
|
+
let captureStart = start;
|
|
69461
|
+
let captureEnd = start;
|
|
69462
|
+
while (position < end) {
|
|
69463
|
+
const ch = input.charCodeAt(position);
|
|
69464
|
+
if (ch === 10 || ch === 13) {
|
|
69465
|
+
result += input.slice(captureStart, captureEnd);
|
|
69466
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
69467
|
+
result += foldedBreaks(fold.breaks);
|
|
69468
|
+
position = captureStart = captureEnd = fold.position;
|
|
69469
|
+
} else {
|
|
69470
|
+
position++;
|
|
69471
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
69379
69472
|
}
|
|
69380
69473
|
}
|
|
69381
|
-
|
|
69382
|
-
|
|
69383
|
-
|
|
69474
|
+
return result + input.slice(captureStart, captureEnd);
|
|
69475
|
+
}
|
|
69476
|
+
function getSingleQuotedValue(input, start, end) {
|
|
69477
|
+
let result = "";
|
|
69478
|
+
let position = start;
|
|
69479
|
+
let captureStart = start;
|
|
69480
|
+
let captureEnd = start;
|
|
69481
|
+
while (position < end) {
|
|
69482
|
+
const ch = input.charCodeAt(position);
|
|
69483
|
+
if (ch === 39) {
|
|
69484
|
+
result += input.slice(captureStart, position) + "'";
|
|
69485
|
+
position += 2;
|
|
69486
|
+
captureStart = captureEnd = position;
|
|
69487
|
+
} else if (ch === 10 || ch === 13) {
|
|
69488
|
+
result += input.slice(captureStart, captureEnd);
|
|
69489
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
69490
|
+
result += foldedBreaks(fold.breaks);
|
|
69491
|
+
position = captureStart = captureEnd = fold.position;
|
|
69492
|
+
} else {
|
|
69493
|
+
position++;
|
|
69494
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
69495
|
+
}
|
|
69384
69496
|
}
|
|
69385
|
-
|
|
69386
|
-
|
|
69387
|
-
|
|
69388
|
-
|
|
69389
|
-
|
|
69390
|
-
|
|
69391
|
-
|
|
69392
|
-
|
|
69497
|
+
return result + input.slice(captureStart, end);
|
|
69498
|
+
}
|
|
69499
|
+
function getDoubleQuotedValue(input, start, end) {
|
|
69500
|
+
let result = "";
|
|
69501
|
+
let position = start;
|
|
69502
|
+
let captureStart = start;
|
|
69503
|
+
let captureEnd = start;
|
|
69504
|
+
while (position < end) {
|
|
69505
|
+
const ch = input.charCodeAt(position);
|
|
69506
|
+
if (ch === 92) {
|
|
69507
|
+
result += input.slice(captureStart, position);
|
|
69508
|
+
position++;
|
|
69509
|
+
const escaped = input.charCodeAt(position);
|
|
69510
|
+
if (escaped === 10 || escaped === 13) position = skipFoldedBreaks(input, position, end).position;
|
|
69511
|
+
else if (escaped < 256 && simpleEscapeCheck[escaped]) {
|
|
69512
|
+
result += simpleEscapeMap[escaped];
|
|
69513
|
+
position++;
|
|
69514
|
+
} else {
|
|
69515
|
+
let hexLength = escapedHexLen$1(escaped);
|
|
69516
|
+
let hexResult = 0;
|
|
69517
|
+
for (; hexLength > 0; hexLength--) {
|
|
69518
|
+
position++;
|
|
69519
|
+
const digit = fromHexCode$1(input.charCodeAt(position));
|
|
69520
|
+
hexResult = (hexResult << 4) + digit;
|
|
69521
|
+
}
|
|
69522
|
+
result += charFromCodepoint(hexResult);
|
|
69523
|
+
position++;
|
|
69524
|
+
}
|
|
69525
|
+
captureStart = captureEnd = position;
|
|
69526
|
+
} else if (ch === 10 || ch === 13) {
|
|
69527
|
+
result += input.slice(captureStart, captureEnd);
|
|
69528
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
69529
|
+
result += foldedBreaks(fold.breaks);
|
|
69530
|
+
position = captureStart = captureEnd = fold.position;
|
|
69531
|
+
} else {
|
|
69532
|
+
position++;
|
|
69533
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
69534
|
+
}
|
|
69393
69535
|
}
|
|
69394
|
-
|
|
69395
|
-
|
|
69396
|
-
|
|
69397
|
-
|
|
69398
|
-
|
|
69536
|
+
return result + input.slice(captureStart, end);
|
|
69537
|
+
}
|
|
69538
|
+
function getBlockValue(input, start, end, indent, chomping, folded) {
|
|
69539
|
+
const textIndent = indent < 0 ? 0 : indent;
|
|
69540
|
+
const region = input.slice(start, end).replace(/\r\n?/g, "\n");
|
|
69541
|
+
const lines = region === "" ? [] : (region.endsWith("\n") ? region.slice(0, -1) : region).split("\n");
|
|
69542
|
+
let result = "";
|
|
69543
|
+
let didReadContent = false;
|
|
69544
|
+
let emptyLines = 0;
|
|
69545
|
+
let atMoreIndented = false;
|
|
69546
|
+
for (const line of lines) {
|
|
69547
|
+
let column = 0;
|
|
69548
|
+
while (column < textIndent && line.charCodeAt(column) === 32) column++;
|
|
69549
|
+
if (indent < 0 || column >= line.length) {
|
|
69550
|
+
emptyLines++;
|
|
69551
|
+
continue;
|
|
69552
|
+
}
|
|
69553
|
+
const content = line.slice(textIndent);
|
|
69554
|
+
const first = content.charCodeAt(0);
|
|
69555
|
+
if (folded) if (first === 32 || first === 9) {
|
|
69556
|
+
atMoreIndented = true;
|
|
69557
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
69558
|
+
} else if (atMoreIndented) {
|
|
69559
|
+
atMoreIndented = false;
|
|
69560
|
+
result += "\n".repeat(emptyLines + 1);
|
|
69561
|
+
} else if (emptyLines === 0) {
|
|
69562
|
+
if (didReadContent) result += " ";
|
|
69563
|
+
} else result += "\n".repeat(emptyLines);
|
|
69564
|
+
else result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
69565
|
+
result += content;
|
|
69566
|
+
didReadContent = true;
|
|
69567
|
+
emptyLines = 0;
|
|
69399
69568
|
}
|
|
69400
|
-
|
|
69401
|
-
|
|
69402
|
-
|
|
69403
|
-
this.schema = options["schema"] || DEFAULT_SCHEMA;
|
|
69404
|
-
this.onWarning = options["onWarning"] || null;
|
|
69405
|
-
this.legacy = options["legacy"] || false;
|
|
69406
|
-
this.json = options["json"] || false;
|
|
69407
|
-
this.listener = options["listener"] || null;
|
|
69408
|
-
this.maxDepth = typeof options["maxDepth"] === "number" ? options["maxDepth"] : 100;
|
|
69409
|
-
this.maxMergeSeqLength = typeof options["maxMergeSeqLength"] === "number" ? options["maxMergeSeqLength"] : 20;
|
|
69410
|
-
this.implicitTypes = this.schema.compiledImplicit;
|
|
69411
|
-
this.typeMap = this.schema.compiledTypeMap;
|
|
69412
|
-
this.length = input.length;
|
|
69413
|
-
this.position = 0;
|
|
69414
|
-
this.line = 0;
|
|
69415
|
-
this.lineStart = 0;
|
|
69416
|
-
this.lineIndent = 0;
|
|
69417
|
-
this.depth = 0;
|
|
69418
|
-
this.firstTabInLine = -1;
|
|
69419
|
-
this.documents = [];
|
|
69420
|
-
this.anchorMapTransactions = [];
|
|
69569
|
+
if (chomping === 3) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
69570
|
+
else if (chomping !== 2) {
|
|
69571
|
+
if (didReadContent) result += "\n";
|
|
69421
69572
|
}
|
|
69422
|
-
|
|
69423
|
-
|
|
69424
|
-
|
|
69425
|
-
|
|
69426
|
-
|
|
69427
|
-
|
|
69428
|
-
|
|
69429
|
-
|
|
69430
|
-
|
|
69431
|
-
return
|
|
69573
|
+
return result;
|
|
69574
|
+
}
|
|
69575
|
+
function getScalarValue(input, scalar) {
|
|
69576
|
+
if (scalar.valueStart === NO_RANGE$3) return "";
|
|
69577
|
+
const { valueStart, valueEnd } = scalar;
|
|
69578
|
+
if (scalar.fast) return input.slice(valueStart, valueEnd);
|
|
69579
|
+
switch (scalar.style) {
|
|
69580
|
+
case 2: return getSingleQuotedValue(input, valueStart, valueEnd);
|
|
69581
|
+
case 3: return getDoubleQuotedValue(input, valueStart, valueEnd);
|
|
69582
|
+
case 4: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false);
|
|
69583
|
+
case 5: return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true);
|
|
69584
|
+
default: return getPlainValue(input, valueStart, valueEnd);
|
|
69432
69585
|
}
|
|
69433
|
-
|
|
69434
|
-
|
|
69586
|
+
}
|
|
69587
|
+
//#endregion
|
|
69588
|
+
//#region src/common/tagname.ts
|
|
69589
|
+
var DEFAULT_TAG_HANDLERS = {
|
|
69590
|
+
"!": "!",
|
|
69591
|
+
"!!": "tag:yaml.org,2002:"
|
|
69592
|
+
};
|
|
69593
|
+
function tagNameFull(rawTag, tagHandlers) {
|
|
69594
|
+
if (rawTag.startsWith("!<") && rawTag.endsWith(">")) return decodeURIComponent(rawTag.slice(2, -1));
|
|
69595
|
+
const handleEnd = rawTag.indexOf("!", 1);
|
|
69596
|
+
const handle = handleEnd === -1 ? "!" : rawTag.slice(0, handleEnd + 1);
|
|
69597
|
+
const prefix = tagHandlers?.[handle] ?? DEFAULT_TAG_HANDLERS[handle] ?? handle;
|
|
69598
|
+
return decodeURIComponent(prefix) + decodeURIComponent(rawTag.slice(handle.length));
|
|
69599
|
+
}
|
|
69600
|
+
//#endregion
|
|
69601
|
+
//#region src/parser/constructor.ts
|
|
69602
|
+
var NO_RANGE$2 = -1;
|
|
69603
|
+
var DEFAULT_CONSTRUCTOR_OPTIONS = {
|
|
69604
|
+
filename: "",
|
|
69605
|
+
schema: CORE_SCHEMA,
|
|
69606
|
+
json: false,
|
|
69607
|
+
maxTotalMergeKeys: 1e4,
|
|
69608
|
+
maxAliases: -1
|
|
69609
|
+
};
|
|
69610
|
+
function eventPosition$1(event) {
|
|
69611
|
+
if ("tagStart" in event && event.tagStart !== NO_RANGE$2) return event.tagStart;
|
|
69612
|
+
if ("anchorStart" in event && event.anchorStart !== NO_RANGE$2) return event.anchorStart;
|
|
69613
|
+
if ("valueStart" in event && event.valueStart !== NO_RANGE$2) return event.valueStart;
|
|
69614
|
+
if ("start" in event) return event.start;
|
|
69615
|
+
return 0;
|
|
69616
|
+
}
|
|
69617
|
+
function throwError$1(state, message) {
|
|
69618
|
+
throwErrorAt(state.source, state.position, message, state.filename);
|
|
69619
|
+
}
|
|
69620
|
+
function finalizeCollection(state, position, tag, carrier) {
|
|
69621
|
+
try {
|
|
69622
|
+
return tag.finalize(carrier);
|
|
69623
|
+
} catch (error) {
|
|
69624
|
+
if (error instanceof YAMLException) throw error;
|
|
69625
|
+
throwErrorAt(state.source, position, error instanceof Error ? error.message : String(error), state.filename);
|
|
69435
69626
|
}
|
|
69436
|
-
|
|
69437
|
-
|
|
69627
|
+
}
|
|
69628
|
+
function lookupTag(exact, prefix, tagName) {
|
|
69629
|
+
const exactTag = exact[tagName];
|
|
69630
|
+
if (exactTag) return exactTag;
|
|
69631
|
+
for (const tag of prefix) if (tagName.startsWith(tag.tagName)) return tag;
|
|
69632
|
+
}
|
|
69633
|
+
function findExplicitTag(state, exact, prefix, tagName, nodeKind) {
|
|
69634
|
+
const tag = lookupTag(exact, prefix, tagName);
|
|
69635
|
+
if (tag) return tag;
|
|
69636
|
+
throwError$1(state, `unknown ${nodeKind} tag !<${tagName}>`);
|
|
69637
|
+
}
|
|
69638
|
+
function constructScalar(state, event) {
|
|
69639
|
+
const source = getScalarValue(state.source, event);
|
|
69640
|
+
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
69641
|
+
const strTag = state.schema.defaultScalarTag;
|
|
69642
|
+
if (rawTag !== "") {
|
|
69643
|
+
if (rawTag === "!") return {
|
|
69644
|
+
value: source,
|
|
69645
|
+
tag: strTag
|
|
69646
|
+
};
|
|
69647
|
+
const tagName = tagNameFull(rawTag, state.tagHandlers);
|
|
69648
|
+
const scalarTag = lookupTag(state.schema.exact.scalar, state.schema.prefix.scalar, tagName);
|
|
69649
|
+
if (scalarTag) {
|
|
69650
|
+
const result = scalarTag.resolve(source, true, tagName);
|
|
69651
|
+
if (result === NOT_RESOLVED) throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
69652
|
+
return {
|
|
69653
|
+
value: result,
|
|
69654
|
+
tag: scalarTag
|
|
69655
|
+
};
|
|
69656
|
+
}
|
|
69657
|
+
const collectionTagDef = lookupTag(state.schema.exact.mapping, state.schema.prefix.mapping, tagName) ?? lookupTag(state.schema.exact.sequence, state.schema.prefix.sequence, tagName);
|
|
69658
|
+
if (collectionTagDef) {
|
|
69659
|
+
if (source !== "") throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
69660
|
+
const carrier = collectionTagDef.create(tagName);
|
|
69661
|
+
return {
|
|
69662
|
+
value: collectionTagDef.carrierIsResult ? carrier : finalizeCollection(state, state.position, collectionTagDef, carrier),
|
|
69663
|
+
tag: collectionTagDef
|
|
69664
|
+
};
|
|
69665
|
+
}
|
|
69666
|
+
throwError$1(state, `unknown scalar tag !<${tagName}>`);
|
|
69438
69667
|
}
|
|
69439
|
-
|
|
69440
|
-
const
|
|
69441
|
-
|
|
69442
|
-
const
|
|
69443
|
-
if (
|
|
69444
|
-
|
|
69445
|
-
|
|
69668
|
+
if (event.style === 1) {
|
|
69669
|
+
const candidates = state.schema.implicitScalarByFirstChar.get(source.charAt(0)) ?? state.schema.implicitScalarAnyFirstChar;
|
|
69670
|
+
for (const tag of candidates) {
|
|
69671
|
+
const result = tag.resolve(source, false, tag.tagName);
|
|
69672
|
+
if (result !== NOT_RESOLVED) return {
|
|
69673
|
+
value: result,
|
|
69674
|
+
tag
|
|
69446
69675
|
};
|
|
69447
69676
|
}
|
|
69448
|
-
state.anchorMap[name] = value;
|
|
69449
69677
|
}
|
|
69450
|
-
|
|
69451
|
-
|
|
69678
|
+
return {
|
|
69679
|
+
value: strTag.resolve(source, false, strTag.tagName),
|
|
69680
|
+
tag: strTag
|
|
69681
|
+
};
|
|
69682
|
+
}
|
|
69683
|
+
function collectionTag(state, event, exact, prefix, defaultTagName, nodeKind) {
|
|
69684
|
+
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
69685
|
+
const tagName = rawTag === "" || rawTag === "!" ? defaultTagName : tagNameFull(rawTag, state.tagHandlers);
|
|
69686
|
+
return {
|
|
69687
|
+
tagName,
|
|
69688
|
+
tag: findExplicitTag(state, exact, prefix, tagName, nodeKind)
|
|
69689
|
+
};
|
|
69690
|
+
}
|
|
69691
|
+
function isMappingTag(tag) {
|
|
69692
|
+
return tag.nodeKind === "mapping";
|
|
69693
|
+
}
|
|
69694
|
+
function mergeKeys(state, frame, source, sourceTag) {
|
|
69695
|
+
for (const sourceKey of sourceTag.keys(source)) {
|
|
69696
|
+
if (state.maxTotalMergeKeys !== -1 && ++state.totalMergeKeys > state.maxTotalMergeKeys) throwError$1(state, `merge keys exceeded maxTotalMergeKeys (${state.maxTotalMergeKeys})`);
|
|
69697
|
+
if (frame.tag.has(frame.value, sourceKey)) continue;
|
|
69698
|
+
const err = frame.tag.addPair(frame.value, sourceKey, sourceTag.get(source, sourceKey));
|
|
69699
|
+
if (err) throwError$1(state, err);
|
|
69700
|
+
(frame.overridable ??= /* @__PURE__ */ new Set()).add(sourceKey);
|
|
69452
69701
|
}
|
|
69453
|
-
|
|
69454
|
-
|
|
69455
|
-
|
|
69456
|
-
|
|
69457
|
-
|
|
69458
|
-
|
|
69459
|
-
|
|
69460
|
-
|
|
69461
|
-
|
|
69462
|
-
|
|
69702
|
+
}
|
|
69703
|
+
function mergeSource(state, frame, source, sourceTag) {
|
|
69704
|
+
state.position = frame.keyPosition;
|
|
69705
|
+
if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag);
|
|
69706
|
+
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) for (const element of source) mergeKeys(state, frame, element, frame.tag);
|
|
69707
|
+
else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
69708
|
+
}
|
|
69709
|
+
function addMappingValue(state, frame, key, value, tag) {
|
|
69710
|
+
state.position = frame.keyPosition;
|
|
69711
|
+
if (key === MERGE_KEY) {
|
|
69712
|
+
mergeSource(state, frame, value, tag);
|
|
69713
|
+
return;
|
|
69463
69714
|
}
|
|
69464
|
-
|
|
69465
|
-
|
|
69466
|
-
|
|
69467
|
-
|
|
69468
|
-
|
|
69469
|
-
|
|
69470
|
-
|
|
69715
|
+
if (!state.json && frame.tag.has(frame.value, key) && !frame.overridable?.has(key)) throwError$1(state, "duplicated mapping key");
|
|
69716
|
+
const err = frame.tag.addPair(frame.value, key, value);
|
|
69717
|
+
if (err) throwError$1(state, err);
|
|
69718
|
+
frame.overridable?.delete(key);
|
|
69719
|
+
}
|
|
69720
|
+
function addValue(state, value, tag) {
|
|
69721
|
+
const frame = state.frames[state.frames.length - 1];
|
|
69722
|
+
if (frame.kind === "document") {
|
|
69723
|
+
frame.value = value;
|
|
69724
|
+
frame.hasValue = true;
|
|
69725
|
+
} else if (frame.kind === "sequence") {
|
|
69726
|
+
if (frame.merge) {
|
|
69727
|
+
if (!isMappingTag(tag)) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
69471
69728
|
}
|
|
69729
|
+
const err = frame.tag.addItem(frame.value, value, frame.index++);
|
|
69730
|
+
if (err) throwError$1(state, err);
|
|
69731
|
+
} else if (frame.hasKey) {
|
|
69732
|
+
const key = frame.key;
|
|
69733
|
+
frame.key = void 0;
|
|
69734
|
+
frame.hasKey = false;
|
|
69735
|
+
addMappingValue(state, frame, key, value, tag);
|
|
69736
|
+
} else {
|
|
69737
|
+
frame.key = value;
|
|
69738
|
+
frame.keyPosition = state.position;
|
|
69739
|
+
frame.hasKey = true;
|
|
69472
69740
|
}
|
|
69473
|
-
|
|
69474
|
-
|
|
69475
|
-
|
|
69476
|
-
|
|
69477
|
-
|
|
69478
|
-
|
|
69479
|
-
|
|
69480
|
-
tag: state.tag,
|
|
69481
|
-
anchor: state.anchor,
|
|
69482
|
-
kind: state.kind,
|
|
69483
|
-
result: state.result
|
|
69741
|
+
}
|
|
69742
|
+
function storeAnchor(state, event, value, tag, isValueFinal) {
|
|
69743
|
+
if (event.anchorStart !== NO_RANGE$2) {
|
|
69744
|
+
const anchor = {
|
|
69745
|
+
value,
|
|
69746
|
+
tag,
|
|
69747
|
+
isValueFinal
|
|
69484
69748
|
};
|
|
69749
|
+
state.anchors.set(state.source.slice(event.anchorStart, event.anchorEnd), anchor);
|
|
69750
|
+
return anchor;
|
|
69485
69751
|
}
|
|
69486
|
-
|
|
69487
|
-
|
|
69488
|
-
|
|
69489
|
-
|
|
69490
|
-
|
|
69491
|
-
|
|
69492
|
-
|
|
69493
|
-
|
|
69494
|
-
|
|
69495
|
-
|
|
69496
|
-
|
|
69497
|
-
|
|
69498
|
-
|
|
69499
|
-
|
|
69500
|
-
|
|
69501
|
-
const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
69502
|
-
if (match === null) throwError(state, "ill-formed argument of the YAML directive");
|
|
69503
|
-
const major = parseInt(match[1], 10);
|
|
69504
|
-
const minor = parseInt(match[2], 10);
|
|
69505
|
-
if (major !== 1) throwError(state, "unacceptable YAML version of the document");
|
|
69506
|
-
state.version = args[0];
|
|
69507
|
-
state.checkLineBreaks = minor < 2;
|
|
69508
|
-
if (minor !== 1 && minor !== 2) throwWarning(state, "unsupported YAML version of the document");
|
|
69509
|
-
},
|
|
69510
|
-
TAG: function handleTagDirective(state, name, args) {
|
|
69511
|
-
let prefix;
|
|
69512
|
-
if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
|
|
69513
|
-
const handle = args[0];
|
|
69514
|
-
prefix = args[1];
|
|
69515
|
-
if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
69516
|
-
if (_hasOwnProperty.call(state.tagMap, handle)) throwError(state, "there is a previously declared suffix for \"" + handle + "\" tag handle");
|
|
69517
|
-
if (!PATTERN_TAG_URI.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
69518
|
-
try {
|
|
69519
|
-
prefix = decodeURIComponent(prefix);
|
|
69520
|
-
} catch (err) {
|
|
69521
|
-
throwError(state, "tag prefix is malformed: " + prefix);
|
|
69522
|
-
}
|
|
69523
|
-
state.tagMap[handle] = prefix;
|
|
69524
|
-
}
|
|
69752
|
+
return null;
|
|
69753
|
+
}
|
|
69754
|
+
function constructFromEvents(events, options) {
|
|
69755
|
+
const state = {
|
|
69756
|
+
...DEFAULT_CONSTRUCTOR_OPTIONS,
|
|
69757
|
+
...options,
|
|
69758
|
+
events,
|
|
69759
|
+
documents: [],
|
|
69760
|
+
eventIndex: 0,
|
|
69761
|
+
position: 0,
|
|
69762
|
+
frames: [],
|
|
69763
|
+
anchors: /* @__PURE__ */ new Map(),
|
|
69764
|
+
tagHandlers: Object.create(null),
|
|
69765
|
+
totalMergeKeys: 0,
|
|
69766
|
+
aliasCount: 0
|
|
69525
69767
|
};
|
|
69526
|
-
|
|
69527
|
-
|
|
69528
|
-
|
|
69529
|
-
|
|
69530
|
-
|
|
69531
|
-
|
|
69768
|
+
while (state.eventIndex < state.events.length) {
|
|
69769
|
+
const event = state.events[state.eventIndex++];
|
|
69770
|
+
state.position = eventPosition$1(event);
|
|
69771
|
+
switch (event.type) {
|
|
69772
|
+
case 1:
|
|
69773
|
+
state.anchors = /* @__PURE__ */ new Map();
|
|
69774
|
+
state.aliasCount = 0;
|
|
69775
|
+
state.tagHandlers = Object.create(null);
|
|
69776
|
+
for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix;
|
|
69777
|
+
state.frames.push({
|
|
69778
|
+
kind: "document",
|
|
69779
|
+
position: state.position,
|
|
69780
|
+
value: void 0,
|
|
69781
|
+
hasValue: false
|
|
69782
|
+
});
|
|
69783
|
+
break;
|
|
69784
|
+
case 4: {
|
|
69785
|
+
const { value, tag } = constructScalar(state, event);
|
|
69786
|
+
storeAnchor(state, event, value, tag, true);
|
|
69787
|
+
addValue(state, value, tag);
|
|
69788
|
+
break;
|
|
69532
69789
|
}
|
|
69533
|
-
|
|
69534
|
-
|
|
69535
|
-
|
|
69536
|
-
|
|
69537
|
-
|
|
69538
|
-
|
|
69539
|
-
|
|
69540
|
-
|
|
69541
|
-
|
|
69542
|
-
|
|
69543
|
-
|
|
69544
|
-
|
|
69790
|
+
case 2: {
|
|
69791
|
+
const definition = collectionTag(state, event, state.schema.exact.sequence, state.schema.prefix.sequence, "tag:yaml.org,2002:seq", "sequence");
|
|
69792
|
+
const value = definition.tag.create(definition.tagName);
|
|
69793
|
+
const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult);
|
|
69794
|
+
const parent = state.frames[state.frames.length - 1];
|
|
69795
|
+
const merge = parent !== void 0 && parent.kind === "mapping" && parent.hasKey && parent.key === MERGE_KEY;
|
|
69796
|
+
state.frames.push({
|
|
69797
|
+
kind: "sequence",
|
|
69798
|
+
position: state.position,
|
|
69799
|
+
value,
|
|
69800
|
+
tag: definition.tag,
|
|
69801
|
+
anchor,
|
|
69802
|
+
index: 0,
|
|
69803
|
+
merge
|
|
69804
|
+
});
|
|
69805
|
+
break;
|
|
69545
69806
|
}
|
|
69546
|
-
|
|
69547
|
-
|
|
69548
|
-
|
|
69549
|
-
|
|
69550
|
-
|
|
69551
|
-
|
|
69552
|
-
|
|
69553
|
-
|
|
69807
|
+
case 3: {
|
|
69808
|
+
const definition = collectionTag(state, event, state.schema.exact.mapping, state.schema.prefix.mapping, "tag:yaml.org,2002:map", "mapping");
|
|
69809
|
+
const value = definition.tag.create(definition.tagName);
|
|
69810
|
+
const anchor = storeAnchor(state, event, value, definition.tag, definition.tag.carrierIsResult);
|
|
69811
|
+
state.frames.push({
|
|
69812
|
+
kind: "mapping",
|
|
69813
|
+
position: state.position,
|
|
69814
|
+
value,
|
|
69815
|
+
tag: definition.tag,
|
|
69816
|
+
anchor,
|
|
69817
|
+
key: void 0,
|
|
69818
|
+
keyPosition: state.position,
|
|
69819
|
+
hasKey: false,
|
|
69820
|
+
overridable: null
|
|
69821
|
+
});
|
|
69822
|
+
break;
|
|
69554
69823
|
}
|
|
69555
|
-
|
|
69556
|
-
|
|
69557
|
-
|
|
69558
|
-
|
|
69559
|
-
|
|
69560
|
-
|
|
69561
|
-
|
|
69562
|
-
|
|
69563
|
-
const src = valueNode[index];
|
|
69564
|
-
if (seen.has(src)) continue;
|
|
69565
|
-
seen.add(src);
|
|
69566
|
-
mergeMappings(state, _result, src, overridableKeys);
|
|
69824
|
+
case 5: {
|
|
69825
|
+
if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`);
|
|
69826
|
+
const name = state.source.slice(event.anchorStart, event.anchorEnd);
|
|
69827
|
+
const anchor = state.anchors.get(name);
|
|
69828
|
+
if (!anchor) throwError$1(state, `unidentified alias "${name}"`);
|
|
69829
|
+
if (!anchor.isValueFinal) throwError$1(state, `recursive alias "${name}" is not supported for tag ${anchor.tag.tagName} because it uses finalize()`);
|
|
69830
|
+
addValue(state, anchor.value, anchor.tag);
|
|
69831
|
+
break;
|
|
69567
69832
|
}
|
|
69568
|
-
|
|
69569
|
-
|
|
69570
|
-
|
|
69571
|
-
|
|
69572
|
-
|
|
69573
|
-
|
|
69574
|
-
|
|
69833
|
+
case 6: {
|
|
69834
|
+
const frame = state.frames.pop();
|
|
69835
|
+
if (frame.kind === "document") state.documents.push(frame.value);
|
|
69836
|
+
else {
|
|
69837
|
+
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
69838
|
+
if (frame.anchor) {
|
|
69839
|
+
frame.anchor.value = value;
|
|
69840
|
+
frame.anchor.isValueFinal = true;
|
|
69841
|
+
}
|
|
69842
|
+
addValue(state, value, frame.tag);
|
|
69843
|
+
}
|
|
69844
|
+
break;
|
|
69575
69845
|
}
|
|
69576
|
-
setProperty(_result, keyNode, valueNode);
|
|
69577
|
-
delete overridableKeys[keyNode];
|
|
69578
69846
|
}
|
|
69579
|
-
return _result;
|
|
69580
69847
|
}
|
|
69581
|
-
|
|
69582
|
-
|
|
69583
|
-
|
|
69584
|
-
|
|
69585
|
-
|
|
69586
|
-
|
|
69587
|
-
|
|
69588
|
-
|
|
69589
|
-
|
|
69590
|
-
|
|
69848
|
+
return state.documents;
|
|
69849
|
+
}
|
|
69850
|
+
//#endregion
|
|
69851
|
+
//#region src/parser/parser.ts
|
|
69852
|
+
var NO_RANGE$1 = -1;
|
|
69853
|
+
var HAS_OWN = Object.prototype.hasOwnProperty;
|
|
69854
|
+
var CONTEXT_FLOW_IN = 1;
|
|
69855
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
69856
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
69857
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
69858
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
69859
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
|
|
69860
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
|
|
69861
|
+
var NS_URI_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`;
|
|
69862
|
+
var NS_TAG_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`;
|
|
69863
|
+
var PATTERN_TAG_URI = new RegExp(`^(?:${NS_URI_CHAR})*$`);
|
|
69864
|
+
var PATTERN_TAG_SUFFIX = new RegExp(`^(?:${NS_TAG_CHAR})+$`);
|
|
69865
|
+
var PATTERN_TAG_PREFIX = new RegExp(`^(?:!(?:${NS_URI_CHAR})*|${NS_TAG_CHAR}(?:${NS_URI_CHAR})*)$`);
|
|
69866
|
+
var DEFAULT_PARSER_OPTIONS = {
|
|
69867
|
+
filename: "",
|
|
69868
|
+
maxDepth: 100
|
|
69869
|
+
};
|
|
69870
|
+
function addDocumentEvent(state, explicitStart, explicitEnd) {
|
|
69871
|
+
state.events.push({
|
|
69872
|
+
type: 1,
|
|
69873
|
+
explicitStart,
|
|
69874
|
+
explicitEnd,
|
|
69875
|
+
directives: state.directives
|
|
69876
|
+
});
|
|
69877
|
+
}
|
|
69878
|
+
function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
69879
|
+
state.events.push({
|
|
69880
|
+
type: 2,
|
|
69881
|
+
start,
|
|
69882
|
+
anchorStart,
|
|
69883
|
+
anchorEnd,
|
|
69884
|
+
tagStart,
|
|
69885
|
+
tagEnd,
|
|
69886
|
+
style
|
|
69887
|
+
});
|
|
69888
|
+
}
|
|
69889
|
+
function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
69890
|
+
state.events.push({
|
|
69891
|
+
type: 3,
|
|
69892
|
+
start,
|
|
69893
|
+
anchorStart,
|
|
69894
|
+
anchorEnd,
|
|
69895
|
+
tagStart,
|
|
69896
|
+
tagEnd,
|
|
69897
|
+
style
|
|
69898
|
+
});
|
|
69899
|
+
}
|
|
69900
|
+
function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = 1, indent = -1, fast = false) {
|
|
69901
|
+
state.events.push({
|
|
69902
|
+
type: 4,
|
|
69903
|
+
valueStart,
|
|
69904
|
+
valueEnd,
|
|
69905
|
+
anchorStart,
|
|
69906
|
+
anchorEnd,
|
|
69907
|
+
tagStart,
|
|
69908
|
+
tagEnd,
|
|
69909
|
+
style,
|
|
69910
|
+
chomping,
|
|
69911
|
+
indent,
|
|
69912
|
+
fast
|
|
69913
|
+
});
|
|
69914
|
+
}
|
|
69915
|
+
function addAliasEvent(state, anchorStart, anchorEnd) {
|
|
69916
|
+
state.events.push({
|
|
69917
|
+
type: 5,
|
|
69918
|
+
anchorStart,
|
|
69919
|
+
anchorEnd
|
|
69920
|
+
});
|
|
69921
|
+
}
|
|
69922
|
+
function addPopEvent(state) {
|
|
69923
|
+
state.events.push({ type: 6 });
|
|
69924
|
+
}
|
|
69925
|
+
function addEmptyScalarEvent(state) {
|
|
69926
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, 1);
|
|
69927
|
+
}
|
|
69928
|
+
function emptyProperties() {
|
|
69929
|
+
return {
|
|
69930
|
+
anchorStart: NO_RANGE$1,
|
|
69931
|
+
anchorEnd: NO_RANGE$1,
|
|
69932
|
+
tagStart: NO_RANGE$1,
|
|
69933
|
+
tagEnd: NO_RANGE$1
|
|
69934
|
+
};
|
|
69935
|
+
}
|
|
69936
|
+
function snapshotState(state) {
|
|
69937
|
+
return {
|
|
69938
|
+
position: state.position,
|
|
69939
|
+
line: state.line,
|
|
69940
|
+
lineStart: state.lineStart,
|
|
69941
|
+
lineIndent: state.lineIndent,
|
|
69942
|
+
firstTabInLine: state.firstTabInLine,
|
|
69943
|
+
eventsLength: state.events.length
|
|
69944
|
+
};
|
|
69945
|
+
}
|
|
69946
|
+
function restoreState(state, snapshot) {
|
|
69947
|
+
state.position = snapshot.position;
|
|
69948
|
+
state.line = snapshot.line;
|
|
69949
|
+
state.lineStart = snapshot.lineStart;
|
|
69950
|
+
state.lineIndent = snapshot.lineIndent;
|
|
69951
|
+
state.firstTabInLine = snapshot.firstTabInLine;
|
|
69952
|
+
state.events.length = snapshot.eventsLength;
|
|
69953
|
+
}
|
|
69954
|
+
function throwError(state, message) {
|
|
69955
|
+
throwErrorAt(state.input.slice(0, state.length), state.position, message, state.filename);
|
|
69956
|
+
}
|
|
69957
|
+
function isEol(c) {
|
|
69958
|
+
return c === 10 || c === 13;
|
|
69959
|
+
}
|
|
69960
|
+
function isWhiteSpace(c) {
|
|
69961
|
+
return c === 9 || c === 32;
|
|
69962
|
+
}
|
|
69963
|
+
function isWsOrEol(c) {
|
|
69964
|
+
return isWhiteSpace(c) || isEol(c);
|
|
69965
|
+
}
|
|
69966
|
+
function isWsOrEolOrEnd(c) {
|
|
69967
|
+
return c === 0 || isWsOrEol(c);
|
|
69968
|
+
}
|
|
69969
|
+
function isFlowIndicator(c) {
|
|
69970
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
69971
|
+
}
|
|
69972
|
+
function fromDecimalCode(c) {
|
|
69973
|
+
return c >= 48 && c <= 57 ? c - 48 : -1;
|
|
69974
|
+
}
|
|
69975
|
+
function fromHexCode(c) {
|
|
69976
|
+
if (c >= 48 && c <= 57) return c - 48;
|
|
69977
|
+
const lc = c | 32;
|
|
69978
|
+
if (lc >= 97 && lc <= 102) return lc - 97 + 10;
|
|
69979
|
+
return -1;
|
|
69980
|
+
}
|
|
69981
|
+
function escapedHexLen(c) {
|
|
69982
|
+
if (c === 120) return 2;
|
|
69983
|
+
if (c === 117) return 4;
|
|
69984
|
+
if (c === 85) return 8;
|
|
69985
|
+
return 0;
|
|
69986
|
+
}
|
|
69987
|
+
function isSimpleEscape(c) {
|
|
69988
|
+
return c === 48 || c === 97 || c === 98 || c === 116 || c === 9 || c === 110 || c === 118 || c === 102 || c === 114 || c === 101 || c === 32 || c === 34 || c === 47 || c === 92 || c === 78 || c === 95 || c === 76 || c === 80;
|
|
69989
|
+
}
|
|
69990
|
+
function consumeLineBreak(state) {
|
|
69991
|
+
if (state.input.charCodeAt(state.position) === 10) state.position++;
|
|
69992
|
+
else {
|
|
69993
|
+
state.position++;
|
|
69994
|
+
if (state.input.charCodeAt(state.position) === 10) state.position++;
|
|
69591
69995
|
}
|
|
69592
|
-
|
|
69593
|
-
|
|
69594
|
-
|
|
69595
|
-
|
|
69596
|
-
|
|
69597
|
-
|
|
69598
|
-
|
|
69599
|
-
|
|
69600
|
-
|
|
69601
|
-
|
|
69602
|
-
|
|
69603
|
-
|
|
69604
|
-
|
|
69605
|
-
|
|
69606
|
-
lineBreaks++;
|
|
69607
|
-
state.lineIndent = 0;
|
|
69608
|
-
while (ch === 32) {
|
|
69609
|
-
state.lineIndent++;
|
|
69610
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69611
|
-
}
|
|
69612
|
-
} else break;
|
|
69996
|
+
state.line++;
|
|
69997
|
+
state.lineStart = state.position;
|
|
69998
|
+
state.lineIndent = 0;
|
|
69999
|
+
state.firstTabInLine = -1;
|
|
70000
|
+
}
|
|
70001
|
+
function skipSeparationSpace(state, allowComments) {
|
|
70002
|
+
let lineBreaks = 0;
|
|
70003
|
+
let ch = state.input.charCodeAt(state.position);
|
|
70004
|
+
let hasSeparation = state.position === state.lineStart || isWsOrEol(state.input.charCodeAt(state.position - 1));
|
|
70005
|
+
while (ch !== 0) {
|
|
70006
|
+
while (isWhiteSpace(ch)) {
|
|
70007
|
+
hasSeparation = true;
|
|
70008
|
+
if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
|
|
70009
|
+
ch = state.input.charCodeAt(++state.position);
|
|
69613
70010
|
}
|
|
69614
|
-
if (
|
|
69615
|
-
|
|
69616
|
-
|
|
69617
|
-
|
|
69618
|
-
|
|
69619
|
-
|
|
69620
|
-
|
|
69621
|
-
|
|
69622
|
-
|
|
69623
|
-
|
|
70011
|
+
if (allowComments && hasSeparation && ch === 35) do
|
|
70012
|
+
ch = state.input.charCodeAt(++state.position);
|
|
70013
|
+
while (!isEol(ch) && ch !== 0);
|
|
70014
|
+
if (!isEol(ch)) break;
|
|
70015
|
+
consumeLineBreak(state);
|
|
70016
|
+
lineBreaks++;
|
|
70017
|
+
hasSeparation = true;
|
|
70018
|
+
ch = state.input.charCodeAt(state.position);
|
|
70019
|
+
while (ch === 32) {
|
|
70020
|
+
state.lineIndent++;
|
|
70021
|
+
ch = state.input.charCodeAt(++state.position);
|
|
69624
70022
|
}
|
|
69625
|
-
return false;
|
|
69626
70023
|
}
|
|
69627
|
-
|
|
69628
|
-
|
|
69629
|
-
|
|
70024
|
+
return lineBreaks;
|
|
70025
|
+
}
|
|
70026
|
+
function testDocumentSeparator(state, position = state.position) {
|
|
70027
|
+
const ch = state.input.charCodeAt(position);
|
|
70028
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(position + 1) && ch === state.input.charCodeAt(position + 2)) {
|
|
70029
|
+
const following = state.input.charCodeAt(position + 3);
|
|
70030
|
+
return following === 0 || isWsOrEol(following);
|
|
69630
70031
|
}
|
|
69631
|
-
|
|
69632
|
-
|
|
69633
|
-
|
|
69634
|
-
|
|
69635
|
-
|
|
69636
|
-
|
|
69637
|
-
|
|
69638
|
-
|
|
69639
|
-
|
|
69640
|
-
|
|
69641
|
-
|
|
69642
|
-
|
|
69643
|
-
|
|
69644
|
-
|
|
69645
|
-
|
|
69646
|
-
|
|
69647
|
-
|
|
69648
|
-
|
|
69649
|
-
|
|
69650
|
-
|
|
69651
|
-
|
|
69652
|
-
|
|
69653
|
-
|
|
69654
|
-
|
|
69655
|
-
if (isWsOrEol(state.input.charCodeAt(state.position - 1))) break;
|
|
69656
|
-
} else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && isFlowIndicator(ch)) break;
|
|
69657
|
-
else if (isEol(ch)) {
|
|
69658
|
-
_line = state.line;
|
|
69659
|
-
_lineStart = state.lineStart;
|
|
69660
|
-
_lineIndent = state.lineIndent;
|
|
69661
|
-
skipSeparationSpace(state, false, -1);
|
|
69662
|
-
if (state.lineIndent >= nodeIndent) {
|
|
69663
|
-
hasPendingContent = true;
|
|
69664
|
-
ch = state.input.charCodeAt(state.position);
|
|
69665
|
-
continue;
|
|
69666
|
-
} else {
|
|
69667
|
-
state.position = captureEnd;
|
|
69668
|
-
state.line = _line;
|
|
69669
|
-
state.lineStart = _lineStart;
|
|
69670
|
-
state.lineIndent = _lineIndent;
|
|
69671
|
-
break;
|
|
69672
|
-
}
|
|
69673
|
-
}
|
|
69674
|
-
if (hasPendingContent) {
|
|
69675
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
69676
|
-
writeFoldedLines(state, state.line - _line);
|
|
69677
|
-
captureStart = captureEnd = state.position;
|
|
69678
|
-
hasPendingContent = false;
|
|
69679
|
-
}
|
|
69680
|
-
if (!isWhiteSpace(ch)) captureEnd = state.position + 1;
|
|
69681
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69682
|
-
}
|
|
69683
|
-
captureSegment(state, captureStart, captureEnd, false);
|
|
69684
|
-
if (state.result) return true;
|
|
69685
|
-
state.kind = _kind;
|
|
69686
|
-
state.result = _result;
|
|
69687
|
-
return false;
|
|
70032
|
+
return false;
|
|
70033
|
+
}
|
|
70034
|
+
function skipUntilLineEnd(state) {
|
|
70035
|
+
let ch = state.input.charCodeAt(state.position);
|
|
70036
|
+
while (ch !== 0 && !isEol(ch)) ch = state.input.charCodeAt(++state.position);
|
|
70037
|
+
}
|
|
70038
|
+
function checkPrintable(state, start, end) {
|
|
70039
|
+
if (PATTERN_NON_PRINTABLE.test(state.input.slice(start, end))) throwError(state, "the stream contains non-printable characters");
|
|
70040
|
+
}
|
|
70041
|
+
function readTagProperty(state, props, inFlow) {
|
|
70042
|
+
if (state.input.charCodeAt(state.position) !== 33) return false;
|
|
70043
|
+
if (props.tagStart !== NO_RANGE$1) throwError(state, "duplication of a tag property");
|
|
70044
|
+
const start = state.position;
|
|
70045
|
+
let isVerbatim = false;
|
|
70046
|
+
let isNamed = false;
|
|
70047
|
+
let tagHandle = "!";
|
|
70048
|
+
let ch = state.input.charCodeAt(++state.position);
|
|
70049
|
+
if (ch === 60) {
|
|
70050
|
+
isVerbatim = true;
|
|
70051
|
+
ch = state.input.charCodeAt(++state.position);
|
|
70052
|
+
} else if (ch === 33) {
|
|
70053
|
+
isNamed = true;
|
|
70054
|
+
tagHandle = "!!";
|
|
70055
|
+
ch = state.input.charCodeAt(++state.position);
|
|
69688
70056
|
}
|
|
69689
|
-
|
|
69690
|
-
|
|
69691
|
-
|
|
69692
|
-
|
|
69693
|
-
if (ch !==
|
|
69694
|
-
state.
|
|
69695
|
-
state.result = "";
|
|
70057
|
+
let suffixStart = state.position;
|
|
70058
|
+
let tagName;
|
|
70059
|
+
if (isVerbatim) {
|
|
70060
|
+
while (ch !== 0 && ch !== 62) ch = state.input.charCodeAt(++state.position);
|
|
70061
|
+
if (ch !== 62) throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
70062
|
+
tagName = state.input.slice(suffixStart, state.position);
|
|
69696
70063
|
state.position++;
|
|
69697
|
-
|
|
69698
|
-
while (
|
|
69699
|
-
|
|
70064
|
+
} else {
|
|
70065
|
+
while (ch !== 0 && !isWsOrEol(ch) && !(inFlow && isFlowIndicator(ch))) {
|
|
70066
|
+
if (ch === 33) if (!isNamed) {
|
|
70067
|
+
tagHandle = state.input.slice(suffixStart - 1, state.position + 1);
|
|
70068
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
|
|
70069
|
+
isNamed = true;
|
|
70070
|
+
suffixStart = state.position + 1;
|
|
70071
|
+
} else throwError(state, "tag suffix cannot contain exclamation marks");
|
|
69700
70072
|
ch = state.input.charCodeAt(++state.position);
|
|
69701
|
-
|
|
69702
|
-
|
|
69703
|
-
|
|
69704
|
-
|
|
69705
|
-
|
|
69706
|
-
|
|
69707
|
-
|
|
69708
|
-
|
|
69709
|
-
|
|
69710
|
-
|
|
69711
|
-
|
|
70073
|
+
}
|
|
70074
|
+
tagName = state.input.slice(suffixStart, state.position);
|
|
70075
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
70076
|
+
}
|
|
70077
|
+
if (tagName && !(isVerbatim ? PATTERN_TAG_URI.test(tagName) : PATTERN_TAG_SUFFIX.test(tagName))) throwError(state, `tag name cannot contain such characters: ${tagName}`);
|
|
70078
|
+
if (!isVerbatim && tagHandle !== "!" && tagHandle !== "!!" && !HAS_OWN.call(state.tagHandlers, tagHandle)) throwError(state, `undeclared tag handle "${tagHandle}"`);
|
|
70079
|
+
props.tagStart = start;
|
|
70080
|
+
props.tagEnd = state.position;
|
|
70081
|
+
return true;
|
|
70082
|
+
}
|
|
70083
|
+
function readAnchorProperty(state, props) {
|
|
70084
|
+
if (state.input.charCodeAt(state.position) !== 38) return false;
|
|
70085
|
+
if (props.anchorStart !== NO_RANGE$1) throwError(state, "duplication of an anchor property");
|
|
70086
|
+
state.position++;
|
|
70087
|
+
const start = state.position;
|
|
70088
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
|
|
70089
|
+
if (state.position === start) throwError(state, "name of an anchor node must contain at least one character");
|
|
70090
|
+
props.anchorStart = start;
|
|
70091
|
+
props.anchorEnd = state.position;
|
|
70092
|
+
return true;
|
|
70093
|
+
}
|
|
70094
|
+
function readAlias(state, props) {
|
|
70095
|
+
if (state.input.charCodeAt(state.position) !== 42) return false;
|
|
70096
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) throwError(state, "alias node should not have any properties");
|
|
70097
|
+
state.position++;
|
|
70098
|
+
const start = state.position;
|
|
70099
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
|
|
70100
|
+
if (state.position === start) throwError(state, "name of an alias node must contain at least one character");
|
|
70101
|
+
addAliasEvent(state, start, state.position);
|
|
70102
|
+
return true;
|
|
70103
|
+
}
|
|
70104
|
+
function readFlowScalarBreak(state, nodeIndent) {
|
|
70105
|
+
skipSeparationSpace(state, false);
|
|
70106
|
+
if (state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
|
|
70107
|
+
}
|
|
70108
|
+
function readSingleQuotedScalar(state, nodeIndent, props) {
|
|
70109
|
+
if (state.input.charCodeAt(state.position) !== 39) return false;
|
|
70110
|
+
state.position++;
|
|
70111
|
+
const start = state.position;
|
|
70112
|
+
let simple = true;
|
|
70113
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
70114
|
+
const ch = state.input.charCodeAt(state.position);
|
|
70115
|
+
if (ch === 39) {
|
|
70116
|
+
if (state.input.charCodeAt(state.position + 1) === 39) {
|
|
70117
|
+
simple = false;
|
|
70118
|
+
state.position += 2;
|
|
70119
|
+
continue;
|
|
70120
|
+
}
|
|
70121
|
+
const end = state.position;
|
|
69712
70122
|
state.position++;
|
|
69713
|
-
|
|
70123
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2, 1, -1, simple);
|
|
70124
|
+
return true;
|
|
69714
70125
|
}
|
|
69715
|
-
|
|
70126
|
+
if (isEol(ch)) {
|
|
70127
|
+
simple = false;
|
|
70128
|
+
readFlowScalarBreak(state, nodeIndent);
|
|
70129
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
70130
|
+
else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
|
|
70131
|
+
else state.position++;
|
|
69716
70132
|
}
|
|
69717
|
-
|
|
69718
|
-
|
|
69719
|
-
|
|
69720
|
-
|
|
69721
|
-
|
|
69722
|
-
|
|
69723
|
-
|
|
69724
|
-
|
|
69725
|
-
state.position
|
|
69726
|
-
|
|
69727
|
-
|
|
69728
|
-
captureSegment(state, captureStart, state.position, true);
|
|
70133
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
70134
|
+
}
|
|
70135
|
+
function readDoubleQuotedScalar(state, nodeIndent, props) {
|
|
70136
|
+
if (state.input.charCodeAt(state.position) !== 34) return false;
|
|
70137
|
+
state.position++;
|
|
70138
|
+
const start = state.position;
|
|
70139
|
+
let simple = true;
|
|
70140
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
70141
|
+
const ch = state.input.charCodeAt(state.position);
|
|
70142
|
+
if (ch === 34) {
|
|
70143
|
+
const end = state.position;
|
|
69729
70144
|
state.position++;
|
|
70145
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 3, 1, -1, simple);
|
|
69730
70146
|
return true;
|
|
69731
|
-
}
|
|
69732
|
-
|
|
69733
|
-
|
|
69734
|
-
|
|
69735
|
-
|
|
69736
|
-
|
|
69737
|
-
|
|
69738
|
-
|
|
69739
|
-
|
|
69740
|
-
|
|
69741
|
-
|
|
69742
|
-
|
|
69743
|
-
if ((tmp = fromHexCode(ch)) >= 0) hexResult = (hexResult << 4) + tmp;
|
|
69744
|
-
else throwError(state, "expected hexadecimal character");
|
|
70147
|
+
}
|
|
70148
|
+
if (ch === 92) {
|
|
70149
|
+
simple = false;
|
|
70150
|
+
const escaped = state.input.charCodeAt(++state.position);
|
|
70151
|
+
if (isEol(escaped)) readFlowScalarBreak(state, nodeIndent);
|
|
70152
|
+
else if (isSimpleEscape(escaped)) state.position++;
|
|
70153
|
+
else {
|
|
70154
|
+
let hexLength = escapedHexLen(escaped);
|
|
70155
|
+
if (hexLength === 0) throwError(state, "unknown escape sequence");
|
|
70156
|
+
while (hexLength-- > 0) {
|
|
70157
|
+
state.position++;
|
|
70158
|
+
if (fromHexCode(state.input.charCodeAt(state.position)) < 0) throwError(state, "expected hexadecimal character");
|
|
69745
70159
|
}
|
|
69746
|
-
state.result += charFromCodepoint(hexResult);
|
|
69747
70160
|
state.position++;
|
|
69748
|
-
}
|
|
69749
|
-
captureStart = captureEnd = state.position;
|
|
70161
|
+
}
|
|
69750
70162
|
} else if (isEol(ch)) {
|
|
69751
|
-
|
|
69752
|
-
|
|
69753
|
-
captureStart = captureEnd = state.position;
|
|
70163
|
+
simple = false;
|
|
70164
|
+
readFlowScalarBreak(state, nodeIndent);
|
|
69754
70165
|
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
69755
|
-
else
|
|
70166
|
+
else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
|
|
70167
|
+
else state.position++;
|
|
70168
|
+
}
|
|
70169
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
70170
|
+
}
|
|
70171
|
+
function readBlockScalar(state, parentIndent, props) {
|
|
70172
|
+
const ch = state.input.charCodeAt(state.position);
|
|
70173
|
+
let chomping = 1;
|
|
70174
|
+
let indent = -1;
|
|
70175
|
+
let detectedIndent = false;
|
|
70176
|
+
if (ch !== 124 && ch !== 62) return false;
|
|
70177
|
+
const style = ch === 124 ? 4 : 5;
|
|
70178
|
+
state.position++;
|
|
70179
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
70180
|
+
const current = state.input.charCodeAt(state.position);
|
|
70181
|
+
const digit = fromDecimalCode(current);
|
|
70182
|
+
if (current === 43 || current === 45) {
|
|
70183
|
+
if (chomping !== 1) throwError(state, "repeat of a chomping mode identifier");
|
|
70184
|
+
chomping = current === 43 ? 3 : 2;
|
|
69756
70185
|
state.position++;
|
|
69757
|
-
|
|
69758
|
-
|
|
69759
|
-
|
|
70186
|
+
} else if (digit >= 0) {
|
|
70187
|
+
if (digit === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
70188
|
+
if (detectedIndent) throwError(state, "repeat of an indentation width identifier");
|
|
70189
|
+
indent = parentIndent + digit - 1;
|
|
70190
|
+
detectedIndent = true;
|
|
70191
|
+
state.position++;
|
|
70192
|
+
} else break;
|
|
69760
70193
|
}
|
|
69761
|
-
|
|
69762
|
-
|
|
69763
|
-
|
|
69764
|
-
|
|
69765
|
-
let _pos;
|
|
69766
|
-
const _tag = state.tag;
|
|
69767
|
-
let _result;
|
|
69768
|
-
const _anchor = state.anchor;
|
|
69769
|
-
let terminator;
|
|
69770
|
-
let isPair;
|
|
69771
|
-
let isExplicitPair;
|
|
69772
|
-
let isMapping;
|
|
69773
|
-
const overridableKeys = Object.create(null);
|
|
69774
|
-
let keyNode;
|
|
69775
|
-
let keyTag;
|
|
69776
|
-
let valueNode;
|
|
69777
|
-
let ch = state.input.charCodeAt(state.position);
|
|
69778
|
-
if (ch === 91) {
|
|
69779
|
-
terminator = 93;
|
|
69780
|
-
isMapping = false;
|
|
69781
|
-
_result = [];
|
|
69782
|
-
} else if (ch === 123) {
|
|
69783
|
-
terminator = 125;
|
|
69784
|
-
isMapping = true;
|
|
69785
|
-
_result = {};
|
|
69786
|
-
} else return false;
|
|
69787
|
-
if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
|
|
69788
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69789
|
-
while (ch !== 0) {
|
|
69790
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
69791
|
-
ch = state.input.charCodeAt(state.position);
|
|
69792
|
-
if (ch === terminator) {
|
|
69793
|
-
state.position++;
|
|
69794
|
-
state.tag = _tag;
|
|
69795
|
-
state.anchor = _anchor;
|
|
69796
|
-
state.kind = isMapping ? "mapping" : "sequence";
|
|
69797
|
-
state.result = _result;
|
|
69798
|
-
return true;
|
|
69799
|
-
} else if (!readNext) throwError(state, "missed comma between flow collection entries");
|
|
69800
|
-
else if (ch === 44) throwError(state, "expected the node content, but found ','");
|
|
69801
|
-
keyTag = keyNode = valueNode = null;
|
|
69802
|
-
isPair = isExplicitPair = false;
|
|
69803
|
-
if (ch === 63) {
|
|
69804
|
-
if (isWsOrEol(state.input.charCodeAt(state.position + 1))) {
|
|
69805
|
-
isPair = isExplicitPair = true;
|
|
69806
|
-
state.position++;
|
|
69807
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
69808
|
-
}
|
|
69809
|
-
}
|
|
69810
|
-
_line = state.line;
|
|
69811
|
-
_lineStart = state.lineStart;
|
|
69812
|
-
_pos = state.position;
|
|
69813
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
69814
|
-
keyTag = state.tag;
|
|
69815
|
-
keyNode = state.result;
|
|
69816
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
69817
|
-
ch = state.input.charCodeAt(state.position);
|
|
69818
|
-
if ((isExplicitPair || state.line === _line) && ch === 58) {
|
|
69819
|
-
isPair = true;
|
|
69820
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69821
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
69822
|
-
composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
69823
|
-
valueNode = state.result;
|
|
69824
|
-
}
|
|
69825
|
-
if (isMapping) storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
|
69826
|
-
else if (isPair) _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
|
69827
|
-
else _result.push(keyNode);
|
|
69828
|
-
skipSeparationSpace(state, true, nodeIndent);
|
|
69829
|
-
ch = state.input.charCodeAt(state.position);
|
|
69830
|
-
if (ch === 44) {
|
|
69831
|
-
readNext = true;
|
|
69832
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69833
|
-
} else readNext = false;
|
|
69834
|
-
}
|
|
69835
|
-
throwError(state, "unexpected end of the stream within a flow collection");
|
|
70194
|
+
let hadWhitespace = false;
|
|
70195
|
+
while (isWhiteSpace(state.input.charCodeAt(state.position))) {
|
|
70196
|
+
hadWhitespace = true;
|
|
70197
|
+
state.position++;
|
|
69836
70198
|
}
|
|
69837
|
-
|
|
69838
|
-
|
|
69839
|
-
|
|
69840
|
-
|
|
69841
|
-
|
|
69842
|
-
|
|
69843
|
-
|
|
69844
|
-
|
|
69845
|
-
|
|
69846
|
-
let
|
|
69847
|
-
|
|
69848
|
-
|
|
69849
|
-
|
|
69850
|
-
|
|
69851
|
-
|
|
69852
|
-
|
|
69853
|
-
|
|
69854
|
-
if (ch === 43 || ch === 45) if (CHOMPING_CLIP === chomping) chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
69855
|
-
else throwError(state, "repeat of a chomping mode identifier");
|
|
69856
|
-
else if ((tmp = fromDecimalCode(ch)) >= 0) if (tmp === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
69857
|
-
else if (!detectedIndent) {
|
|
69858
|
-
textIndent = nodeIndent + tmp - 1;
|
|
69859
|
-
detectedIndent = true;
|
|
69860
|
-
} else throwError(state, "repeat of an indentation width identifier");
|
|
69861
|
-
else break;
|
|
69862
|
-
}
|
|
69863
|
-
if (isWhiteSpace(ch)) {
|
|
69864
|
-
do
|
|
69865
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69866
|
-
while (isWhiteSpace(ch));
|
|
69867
|
-
if (ch === 35) do
|
|
69868
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69869
|
-
while (!isEol(ch) && ch !== 0);
|
|
70199
|
+
if (hadWhitespace && state.input.charCodeAt(state.position) === 35) skipUntilLineEnd(state);
|
|
70200
|
+
if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
|
|
70201
|
+
else if (state.input.charCodeAt(state.position) !== 0) throwError(state, "a line break is expected");
|
|
70202
|
+
let contentIndent = detectedIndent ? indent : -1;
|
|
70203
|
+
let maxLeadingIndent = 0;
|
|
70204
|
+
const valueStart = state.position;
|
|
70205
|
+
let valueEnd = state.position;
|
|
70206
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
70207
|
+
const linePosition = state.position;
|
|
70208
|
+
let column = 0;
|
|
70209
|
+
while (state.input.charCodeAt(linePosition + column) === 32) column++;
|
|
70210
|
+
const first = state.input.charCodeAt(linePosition + column);
|
|
70211
|
+
if (first === 0) {
|
|
70212
|
+
if (contentIndent >= 0) {
|
|
70213
|
+
if (column > contentIndent) valueEnd = linePosition + column;
|
|
70214
|
+
} else if (column > 0) valueEnd = linePosition + column;
|
|
70215
|
+
break;
|
|
69870
70216
|
}
|
|
69871
|
-
|
|
69872
|
-
|
|
69873
|
-
|
|
69874
|
-
|
|
69875
|
-
|
|
69876
|
-
state.lineIndent++;
|
|
69877
|
-
ch = state.input.charCodeAt(++state.position);
|
|
69878
|
-
}
|
|
69879
|
-
if (!detectedIndent && state.lineIndent > textIndent) textIndent = state.lineIndent;
|
|
69880
|
-
if (isEol(ch)) {
|
|
69881
|
-
emptyLines++;
|
|
69882
|
-
continue;
|
|
69883
|
-
}
|
|
69884
|
-
if (!detectedIndent && textIndent === 0) throwError(state, "missing indentation for block scalar");
|
|
69885
|
-
if (state.lineIndent < textIndent) {
|
|
69886
|
-
if (chomping === CHOMPING_KEEP) state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
69887
|
-
else if (chomping === CHOMPING_CLIP) {
|
|
69888
|
-
if (didReadContent) state.result += "\n";
|
|
69889
|
-
}
|
|
69890
|
-
break;
|
|
69891
|
-
}
|
|
69892
|
-
if (folding) if (isWhiteSpace(ch)) {
|
|
69893
|
-
atMoreIndented = true;
|
|
69894
|
-
state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
69895
|
-
} else if (atMoreIndented) {
|
|
69896
|
-
atMoreIndented = false;
|
|
69897
|
-
state.result += common.repeat("\n", emptyLines + 1);
|
|
69898
|
-
} else if (emptyLines === 0) {
|
|
69899
|
-
if (didReadContent) state.result += " ";
|
|
69900
|
-
} else state.result += common.repeat("\n", emptyLines);
|
|
69901
|
-
else state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
|
69902
|
-
didReadContent = true;
|
|
69903
|
-
detectedIndent = true;
|
|
69904
|
-
emptyLines = 0;
|
|
69905
|
-
const captureStart = state.position;
|
|
69906
|
-
while (!isEol(ch) && ch !== 0) ch = state.input.charCodeAt(++state.position);
|
|
69907
|
-
captureSegment(state, captureStart, state.position, false);
|
|
69908
|
-
}
|
|
69909
|
-
return true;
|
|
69910
|
-
}
|
|
69911
|
-
function readBlockSequence(state, nodeIndent) {
|
|
69912
|
-
const _tag = state.tag;
|
|
69913
|
-
const _anchor = state.anchor;
|
|
69914
|
-
const _result = [];
|
|
69915
|
-
let detected = false;
|
|
69916
|
-
if (state.firstTabInLine !== -1) return false;
|
|
69917
|
-
if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
|
|
69918
|
-
let ch = state.input.charCodeAt(state.position);
|
|
69919
|
-
while (ch !== 0) {
|
|
69920
|
-
if (state.firstTabInLine !== -1) {
|
|
69921
|
-
state.position = state.firstTabInLine;
|
|
70217
|
+
if (linePosition === state.lineStart && testDocumentSeparator(state, linePosition)) break;
|
|
70218
|
+
if (!detectedIndent && contentIndent === -1 && isEol(first)) maxLeadingIndent = Math.max(maxLeadingIndent, column);
|
|
70219
|
+
if (!detectedIndent && contentIndent === -1 && !isEol(first)) {
|
|
70220
|
+
if (first === 9 && column < parentIndent) {
|
|
70221
|
+
state.position = linePosition + column;
|
|
69922
70222
|
throwError(state, "tab characters must not be used in indentation");
|
|
69923
70223
|
}
|
|
69924
|
-
if (
|
|
69925
|
-
|
|
69926
|
-
|
|
69927
|
-
state.position++;
|
|
69928
|
-
if (skipSeparationSpace(state, true, -1)) {
|
|
69929
|
-
if (state.lineIndent <= nodeIndent) {
|
|
69930
|
-
_result.push(null);
|
|
69931
|
-
ch = state.input.charCodeAt(state.position);
|
|
69932
|
-
continue;
|
|
69933
|
-
}
|
|
70224
|
+
if (column < maxLeadingIndent) {
|
|
70225
|
+
state.position = linePosition + column;
|
|
70226
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
69934
70227
|
}
|
|
69935
|
-
const _line = state.line;
|
|
69936
|
-
composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
69937
|
-
_result.push(state.result);
|
|
69938
|
-
skipSeparationSpace(state, true, -1);
|
|
69939
|
-
ch = state.input.charCodeAt(state.position);
|
|
69940
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a sequence entry");
|
|
69941
|
-
else if (state.lineIndent < nodeIndent) break;
|
|
69942
70228
|
}
|
|
69943
|
-
if (
|
|
69944
|
-
state.
|
|
69945
|
-
state.
|
|
69946
|
-
|
|
69947
|
-
state.result = _result;
|
|
69948
|
-
return true;
|
|
70229
|
+
if (contentIndent === -1 && first !== 0 && !isEol(first) && column < parentIndent) {
|
|
70230
|
+
state.lineIndent = column;
|
|
70231
|
+
state.position = linePosition + column;
|
|
70232
|
+
break;
|
|
69949
70233
|
}
|
|
69950
|
-
|
|
69951
|
-
|
|
69952
|
-
|
|
69953
|
-
|
|
69954
|
-
|
|
69955
|
-
|
|
69956
|
-
let _keyPos;
|
|
69957
|
-
const _tag = state.tag;
|
|
69958
|
-
const _anchor = state.anchor;
|
|
69959
|
-
const _result = {};
|
|
69960
|
-
const overridableKeys = Object.create(null);
|
|
69961
|
-
let keyTag = null;
|
|
69962
|
-
let keyNode = null;
|
|
69963
|
-
let valueNode = null;
|
|
69964
|
-
let atExplicitKey = false;
|
|
69965
|
-
let detected = false;
|
|
69966
|
-
if (state.firstTabInLine !== -1) return false;
|
|
69967
|
-
if (state.anchor !== null) storeAnchor(state, state.anchor, _result);
|
|
69968
|
-
let ch = state.input.charCodeAt(state.position);
|
|
69969
|
-
while (ch !== 0) {
|
|
69970
|
-
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
69971
|
-
state.position = state.firstTabInLine;
|
|
69972
|
-
throwError(state, "tab characters must not be used in indentation");
|
|
69973
|
-
}
|
|
69974
|
-
const following = state.input.charCodeAt(state.position + 1);
|
|
69975
|
-
const _line = state.line;
|
|
69976
|
-
if ((ch === 63 || ch === 58) && isWsOrEol(following)) {
|
|
69977
|
-
if (ch === 63) {
|
|
69978
|
-
if (atExplicitKey) {
|
|
69979
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
69980
|
-
keyTag = keyNode = valueNode = null;
|
|
69981
|
-
}
|
|
69982
|
-
detected = true;
|
|
69983
|
-
atExplicitKey = true;
|
|
69984
|
-
allowCompact = true;
|
|
69985
|
-
} else if (atExplicitKey) {
|
|
69986
|
-
atExplicitKey = false;
|
|
69987
|
-
allowCompact = true;
|
|
69988
|
-
} else throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
69989
|
-
state.position += 1;
|
|
69990
|
-
ch = following;
|
|
69991
|
-
} else {
|
|
69992
|
-
_keyLine = state.line;
|
|
69993
|
-
_keyLineStart = state.lineStart;
|
|
69994
|
-
_keyPos = state.position;
|
|
69995
|
-
if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
|
|
69996
|
-
if (state.line === _line) {
|
|
69997
|
-
ch = state.input.charCodeAt(state.position);
|
|
69998
|
-
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
69999
|
-
if (ch === 58) {
|
|
70000
|
-
ch = state.input.charCodeAt(++state.position);
|
|
70001
|
-
if (!isWsOrEol(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
70002
|
-
if (atExplicitKey) {
|
|
70003
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
70004
|
-
keyTag = keyNode = valueNode = null;
|
|
70005
|
-
}
|
|
70006
|
-
detected = true;
|
|
70007
|
-
atExplicitKey = false;
|
|
70008
|
-
allowCompact = false;
|
|
70009
|
-
keyTag = state.tag;
|
|
70010
|
-
keyNode = state.result;
|
|
70011
|
-
} else if (detected) throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
|
70012
|
-
else {
|
|
70013
|
-
state.tag = _tag;
|
|
70014
|
-
state.anchor = _anchor;
|
|
70015
|
-
return true;
|
|
70016
|
-
}
|
|
70017
|
-
} else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
70018
|
-
else {
|
|
70019
|
-
state.tag = _tag;
|
|
70020
|
-
state.anchor = _anchor;
|
|
70021
|
-
return true;
|
|
70022
|
-
}
|
|
70023
|
-
}
|
|
70024
|
-
if (state.line === _line || state.lineIndent > nodeIndent) {
|
|
70025
|
-
if (atExplicitKey) {
|
|
70026
|
-
_keyLine = state.line;
|
|
70027
|
-
_keyLineStart = state.lineStart;
|
|
70028
|
-
_keyPos = state.position;
|
|
70029
|
-
}
|
|
70030
|
-
if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) if (atExplicitKey) keyNode = state.result;
|
|
70031
|
-
else valueNode = state.result;
|
|
70032
|
-
if (!atExplicitKey) {
|
|
70033
|
-
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
|
70034
|
-
keyTag = keyNode = valueNode = null;
|
|
70035
|
-
}
|
|
70036
|
-
skipSeparationSpace(state, true, -1);
|
|
70037
|
-
ch = state.input.charCodeAt(state.position);
|
|
70038
|
-
}
|
|
70039
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
|
|
70040
|
-
else if (state.lineIndent < nodeIndent) break;
|
|
70234
|
+
if (!detectedIndent && first !== 0 && !isEol(first) && contentIndent === -1) contentIndent = column;
|
|
70235
|
+
const requiredIndent = contentIndent === -1 ? parentIndent + 1 : contentIndent;
|
|
70236
|
+
if (first !== 0 && !isEol(first) && column < requiredIndent) {
|
|
70237
|
+
state.lineIndent = column;
|
|
70238
|
+
state.position = linePosition + column;
|
|
70239
|
+
break;
|
|
70041
70240
|
}
|
|
70042
|
-
|
|
70043
|
-
|
|
70044
|
-
|
|
70045
|
-
state
|
|
70046
|
-
|
|
70047
|
-
state.result = _result;
|
|
70241
|
+
skipUntilLineEnd(state);
|
|
70242
|
+
valueEnd = state.position;
|
|
70243
|
+
if (isEol(state.input.charCodeAt(state.position))) {
|
|
70244
|
+
consumeLineBreak(state);
|
|
70245
|
+
valueEnd = state.position;
|
|
70048
70246
|
}
|
|
70049
|
-
return detected;
|
|
70050
70247
|
}
|
|
70051
|
-
|
|
70052
|
-
|
|
70053
|
-
|
|
70054
|
-
|
|
70055
|
-
|
|
70056
|
-
|
|
70057
|
-
|
|
70058
|
-
|
|
70059
|
-
|
|
70060
|
-
|
|
70061
|
-
|
|
70062
|
-
|
|
70063
|
-
|
|
70064
|
-
|
|
70065
|
-
|
|
70066
|
-
|
|
70067
|
-
|
|
70068
|
-
|
|
70069
|
-
|
|
70070
|
-
|
|
70071
|
-
|
|
70072
|
-
|
|
70073
|
-
|
|
70074
|
-
|
|
70075
|
-
|
|
70076
|
-
|
|
70077
|
-
} else {
|
|
70078
|
-
|
|
70079
|
-
|
|
70080
|
-
|
|
70081
|
-
|
|
70082
|
-
|
|
70083
|
-
|
|
70084
|
-
|
|
70085
|
-
|
|
70248
|
+
checkPrintable(state, valueStart, valueEnd);
|
|
70249
|
+
addScalarEvent(state, valueStart, valueEnd, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, style, chomping, contentIndent);
|
|
70250
|
+
return true;
|
|
70251
|
+
}
|
|
70252
|
+
function canStartPlainScalar(state, nodeContext) {
|
|
70253
|
+
const ch = state.input.charCodeAt(state.position);
|
|
70254
|
+
const inFlow = nodeContext === CONTEXT_FLOW_IN;
|
|
70255
|
+
if (ch === 0 || isWsOrEol(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96 || inFlow && isFlowIndicator(ch)) return false;
|
|
70256
|
+
if (ch === 63 || ch === 45) {
|
|
70257
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
70258
|
+
if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) return false;
|
|
70259
|
+
}
|
|
70260
|
+
return true;
|
|
70261
|
+
}
|
|
70262
|
+
function readPlainScalar(state, nodeIndent, nodeContext, props) {
|
|
70263
|
+
if (!canStartPlainScalar(state, nodeContext)) return false;
|
|
70264
|
+
const start = state.position;
|
|
70265
|
+
let end = state.position;
|
|
70266
|
+
let ch = state.input.charCodeAt(state.position);
|
|
70267
|
+
const inFlow = nodeContext === CONTEXT_FLOW_IN;
|
|
70268
|
+
let multiline = false;
|
|
70269
|
+
while (ch !== 0) {
|
|
70270
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) break;
|
|
70271
|
+
if (ch === 58) {
|
|
70272
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
70273
|
+
if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) break;
|
|
70274
|
+
} else if (ch === 35) {
|
|
70275
|
+
if (isWsOrEol(state.input.charCodeAt(state.position - 1))) break;
|
|
70276
|
+
} else if (inFlow && isFlowIndicator(ch)) break;
|
|
70277
|
+
else if (isEol(ch)) {
|
|
70278
|
+
const savedPosition = state.position;
|
|
70279
|
+
const savedLine = state.line;
|
|
70280
|
+
const savedLineStart = state.lineStart;
|
|
70281
|
+
const savedLineIndent = state.lineIndent;
|
|
70282
|
+
skipSeparationSpace(state, false);
|
|
70283
|
+
if (state.lineIndent >= nodeIndent) {
|
|
70284
|
+
multiline = true;
|
|
70285
|
+
ch = state.input.charCodeAt(state.position);
|
|
70286
|
+
continue;
|
|
70086
70287
|
}
|
|
70087
|
-
|
|
70088
|
-
|
|
70089
|
-
|
|
70090
|
-
|
|
70091
|
-
|
|
70092
|
-
tagName = decodeURIComponent(tagName);
|
|
70093
|
-
} catch (err) {
|
|
70094
|
-
throwError(state, "tag name is malformed: " + tagName);
|
|
70288
|
+
state.position = savedPosition;
|
|
70289
|
+
state.line = savedLine;
|
|
70290
|
+
state.lineStart = savedLineStart;
|
|
70291
|
+
state.lineIndent = savedLineIndent;
|
|
70292
|
+
break;
|
|
70095
70293
|
}
|
|
70096
|
-
if (
|
|
70097
|
-
else if (_hasOwnProperty.call(state.tagMap, tagHandle)) state.tag = state.tagMap[tagHandle] + tagName;
|
|
70098
|
-
else if (tagHandle === "!") state.tag = "!" + tagName;
|
|
70099
|
-
else if (tagHandle === "!!") state.tag = "tag:yaml.org,2002:" + tagName;
|
|
70100
|
-
else throwError(state, "undeclared tag handle \"" + tagHandle + "\"");
|
|
70101
|
-
return true;
|
|
70102
|
-
}
|
|
70103
|
-
function readAnchorProperty(state) {
|
|
70104
|
-
let ch = state.input.charCodeAt(state.position);
|
|
70105
|
-
if (ch !== 38) return false;
|
|
70106
|
-
if (state.anchor !== null) throwError(state, "duplication of an anchor property");
|
|
70294
|
+
if (!isWhiteSpace(ch)) end = state.position + 1;
|
|
70107
70295
|
ch = state.input.charCodeAt(++state.position);
|
|
70108
|
-
const _position = state.position;
|
|
70109
|
-
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) ch = state.input.charCodeAt(++state.position);
|
|
70110
|
-
if (state.position === _position) throwError(state, "name of an anchor node must contain at least one character");
|
|
70111
|
-
state.anchor = state.input.slice(_position, state.position);
|
|
70112
|
-
return true;
|
|
70113
70296
|
}
|
|
70114
|
-
|
|
70297
|
+
if (end === start) return false;
|
|
70298
|
+
checkPrintable(state, start, end);
|
|
70299
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1, 1, -1, !multiline);
|
|
70300
|
+
return true;
|
|
70301
|
+
}
|
|
70302
|
+
function skipFlowSeparationSpace(state, nodeIndent) {
|
|
70303
|
+
const startLine = state.line;
|
|
70304
|
+
skipSeparationSpace(state, true);
|
|
70305
|
+
if (state.line > startLine && state.lineIndent < nodeIndent || state.firstTabInLine !== -1 && state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
|
|
70306
|
+
}
|
|
70307
|
+
function readFlowCollection(state, nodeIndent, props) {
|
|
70308
|
+
const ch = state.input.charCodeAt(state.position);
|
|
70309
|
+
const isMapping = ch === 123;
|
|
70310
|
+
const start = state.position;
|
|
70311
|
+
let readNext = true;
|
|
70312
|
+
if (ch !== 91 && ch !== 123) return false;
|
|
70313
|
+
const terminator = isMapping ? 125 : 93;
|
|
70314
|
+
if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2);
|
|
70315
|
+
else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 2);
|
|
70316
|
+
state.position++;
|
|
70317
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
70318
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
70115
70319
|
let ch = state.input.charCodeAt(state.position);
|
|
70116
|
-
if (ch
|
|
70117
|
-
|
|
70118
|
-
|
|
70119
|
-
while (ch !== 0 && !isWsOrEol(ch) && !isFlowIndicator(ch)) ch = state.input.charCodeAt(++state.position);
|
|
70120
|
-
if (state.position === _position) throwError(state, "name of an alias node must contain at least one character");
|
|
70121
|
-
const alias = state.input.slice(_position, state.position);
|
|
70122
|
-
if (!_hasOwnProperty.call(state.anchorMap, alias)) throwError(state, "unidentified alias \"" + alias + "\"");
|
|
70123
|
-
state.result = state.anchorMap[alias];
|
|
70124
|
-
skipSeparationSpace(state, true, -1);
|
|
70125
|
-
return true;
|
|
70126
|
-
}
|
|
70127
|
-
function tryReadBlockMappingFromProperty(state, propertyStart, nodeIndent, flowIndent) {
|
|
70128
|
-
const fallbackState = snapshotState(state);
|
|
70129
|
-
beginAnchorTransaction(state);
|
|
70130
|
-
restoreState(state, propertyStart);
|
|
70131
|
-
state.tag = null;
|
|
70132
|
-
state.anchor = null;
|
|
70133
|
-
state.kind = null;
|
|
70134
|
-
state.result = null;
|
|
70135
|
-
if (readBlockMapping(state, nodeIndent, flowIndent) && state.kind === "mapping") {
|
|
70136
|
-
commitAnchorTransaction(state);
|
|
70320
|
+
if (ch === terminator) {
|
|
70321
|
+
state.position++;
|
|
70322
|
+
addPopEvent(state);
|
|
70137
70323
|
return true;
|
|
70324
|
+
} else if (!readNext) throwError(state, "missed comma between flow collection entries");
|
|
70325
|
+
else if (ch === 44) throwError(state, "expected the node content, but found ','");
|
|
70326
|
+
let isPair = false;
|
|
70327
|
+
let isExplicitPair = false;
|
|
70328
|
+
if (ch === 63 && isWsOrEol(state.input.charCodeAt(state.position + 1))) {
|
|
70329
|
+
isPair = isExplicitPair = true;
|
|
70330
|
+
state.position += 1;
|
|
70331
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
70138
70332
|
}
|
|
70139
|
-
|
|
70140
|
-
|
|
70141
|
-
|
|
70142
|
-
|
|
70143
|
-
|
|
70144
|
-
|
|
70145
|
-
|
|
70146
|
-
|
|
70147
|
-
|
|
70148
|
-
|
|
70149
|
-
|
|
70150
|
-
|
|
70151
|
-
|
|
70152
|
-
|
|
70153
|
-
|
|
70154
|
-
|
|
70155
|
-
|
|
70156
|
-
|
|
70157
|
-
|
|
70158
|
-
|
|
70159
|
-
|
|
70160
|
-
|
|
70161
|
-
|
|
70162
|
-
|
|
70163
|
-
|
|
70164
|
-
|
|
70165
|
-
|
|
70166
|
-
|
|
70167
|
-
|
|
70333
|
+
const entryLine = state.line;
|
|
70334
|
+
const entryStart = snapshotState(state);
|
|
70335
|
+
const keyWasRead = parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
70336
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
70337
|
+
ch = state.input.charCodeAt(state.position);
|
|
70338
|
+
if ((isMapping || isExplicitPair || state.line === entryLine) && ch === 58) {
|
|
70339
|
+
isPair = true;
|
|
70340
|
+
state.position++;
|
|
70341
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
70342
|
+
if (!isMapping) {
|
|
70343
|
+
restoreState(state, entryStart);
|
|
70344
|
+
addMappingEvent(state, entryStart.position, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, 2);
|
|
70345
|
+
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
70346
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
70347
|
+
state.position++;
|
|
70348
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
70349
|
+
} else if (!keyWasRead) addEmptyScalarEvent(state);
|
|
70350
|
+
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
70351
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
70352
|
+
if (!isMapping) addPopEvent(state);
|
|
70353
|
+
} else if (isMapping && isPair) {
|
|
70354
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
70355
|
+
addEmptyScalarEvent(state);
|
|
70356
|
+
} else if (isMapping) addEmptyScalarEvent(state);
|
|
70357
|
+
else if (isPair) {
|
|
70358
|
+
restoreState(state, entryStart);
|
|
70359
|
+
addMappingEvent(state, entryStart.position, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, 2);
|
|
70360
|
+
parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
70361
|
+
addEmptyScalarEvent(state);
|
|
70362
|
+
addPopEvent(state);
|
|
70168
70363
|
}
|
|
70169
|
-
|
|
70170
|
-
|
|
70171
|
-
|
|
70172
|
-
|
|
70173
|
-
|
|
70174
|
-
|
|
70175
|
-
|
|
70176
|
-
|
|
70177
|
-
|
|
70178
|
-
|
|
70179
|
-
|
|
70180
|
-
|
|
70181
|
-
|
|
70364
|
+
ch = state.input.charCodeAt(state.position);
|
|
70365
|
+
if (ch === 44) {
|
|
70366
|
+
readNext = true;
|
|
70367
|
+
state.position++;
|
|
70368
|
+
} else readNext = false;
|
|
70369
|
+
}
|
|
70370
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
70371
|
+
}
|
|
70372
|
+
function readBlockSequence(state, nodeIndent, props) {
|
|
70373
|
+
if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 45 || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) return false;
|
|
70374
|
+
addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
70375
|
+
while (state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {
|
|
70376
|
+
if (state.firstTabInLine !== -1) {
|
|
70377
|
+
state.position = state.firstTabInLine;
|
|
70378
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
70182
70379
|
}
|
|
70183
|
-
|
|
70184
|
-
|
|
70185
|
-
|
|
70186
|
-
|
|
70187
|
-
|
|
70188
|
-
|
|
70189
|
-
|
|
70190
|
-
|
|
70191
|
-
|
|
70192
|
-
|
|
70193
|
-
|
|
70194
|
-
|
|
70195
|
-
|
|
70196
|
-
|
|
70197
|
-
|
|
70198
|
-
|
|
70199
|
-
|
|
70200
|
-
|
|
70201
|
-
|
|
70202
|
-
|
|
70380
|
+
const entryLine = state.line;
|
|
70381
|
+
state.position++;
|
|
70382
|
+
const hadBreak = skipSeparationSpace(state, true) > 0;
|
|
70383
|
+
if (state.firstTabInLine !== -1 && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
|
|
70384
|
+
if (hadBreak && state.lineIndent <= nodeIndent) addEmptyScalarEvent(state);
|
|
70385
|
+
else parseNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
70386
|
+
skipSeparationSpace(state, true);
|
|
70387
|
+
if (state.lineIndent < nodeIndent || state.position >= state.length) break;
|
|
70388
|
+
if (state.lineIndent > nodeIndent) throwError(state, "bad indentation of a sequence entry");
|
|
70389
|
+
if (state.line === entryLine && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
|
|
70390
|
+
}
|
|
70391
|
+
addPopEvent(state);
|
|
70392
|
+
return true;
|
|
70393
|
+
}
|
|
70394
|
+
function readBlockMapping(state, nodeIndent, flowIndent, props) {
|
|
70395
|
+
let atExplicitKey = false;
|
|
70396
|
+
let detected = false;
|
|
70397
|
+
let mappingOpened = false;
|
|
70398
|
+
let pendingExplicitKey = false;
|
|
70399
|
+
if (state.firstTabInLine !== -1) return false;
|
|
70400
|
+
let ch = state.input.charCodeAt(state.position);
|
|
70401
|
+
while (ch !== 0) {
|
|
70402
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
70403
|
+
state.position = state.firstTabInLine;
|
|
70404
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
70203
70405
|
}
|
|
70204
|
-
|
|
70205
|
-
|
|
70206
|
-
|
|
70207
|
-
if (
|
|
70208
|
-
|
|
70209
|
-
|
|
70210
|
-
if (type.resolve(state.result)) {
|
|
70211
|
-
state.result = type.construct(state.result);
|
|
70212
|
-
state.tag = type.tag;
|
|
70213
|
-
if (state.anchor !== null) storeAnchor(state, state.anchor, state.result);
|
|
70214
|
-
break;
|
|
70215
|
-
}
|
|
70406
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
70407
|
+
const entryLine = state.line;
|
|
70408
|
+
if ((ch === 63 || ch === 58) && isWsOrEolOrEnd(following)) {
|
|
70409
|
+
if (!mappingOpened) {
|
|
70410
|
+
addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
70411
|
+
mappingOpened = true;
|
|
70216
70412
|
}
|
|
70217
|
-
|
|
70218
|
-
|
|
70413
|
+
if (ch === 63) {
|
|
70414
|
+
if (atExplicitKey) addEmptyScalarEvent(state);
|
|
70415
|
+
detected = true;
|
|
70416
|
+
atExplicitKey = true;
|
|
70417
|
+
} else if (atExplicitKey) atExplicitKey = false;
|
|
70219
70418
|
else {
|
|
70220
|
-
|
|
70221
|
-
|
|
70222
|
-
|
|
70223
|
-
type = typeList[typeIndex];
|
|
70224
|
-
break;
|
|
70225
|
-
}
|
|
70419
|
+
addEmptyScalarEvent(state);
|
|
70420
|
+
detected = true;
|
|
70421
|
+
atExplicitKey = false;
|
|
70226
70422
|
}
|
|
70227
|
-
|
|
70228
|
-
|
|
70229
|
-
|
|
70230
|
-
|
|
70231
|
-
|
|
70232
|
-
|
|
70423
|
+
state.position += 1;
|
|
70424
|
+
pendingExplicitKey = true;
|
|
70425
|
+
} else {
|
|
70426
|
+
if (atExplicitKey) {
|
|
70427
|
+
addEmptyScalarEvent(state);
|
|
70428
|
+
atExplicitKey = false;
|
|
70233
70429
|
}
|
|
70234
|
-
|
|
70235
|
-
|
|
70236
|
-
|
|
70237
|
-
|
|
70238
|
-
}
|
|
70239
|
-
function readDocument(state) {
|
|
70240
|
-
const documentStart = state.position;
|
|
70241
|
-
let hasDirectives = false;
|
|
70242
|
-
let ch;
|
|
70243
|
-
state.version = null;
|
|
70244
|
-
state.checkLineBreaks = state.legacy;
|
|
70245
|
-
state.tagMap = Object.create(null);
|
|
70246
|
-
state.anchorMap = Object.create(null);
|
|
70247
|
-
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
70248
|
-
skipSeparationSpace(state, true, -1);
|
|
70249
|
-
ch = state.input.charCodeAt(state.position);
|
|
70250
|
-
if (state.lineIndent > 0 || ch !== 37) break;
|
|
70251
|
-
hasDirectives = true;
|
|
70252
|
-
ch = state.input.charCodeAt(++state.position);
|
|
70253
|
-
let _position = state.position;
|
|
70254
|
-
while (ch !== 0 && !isWsOrEol(ch)) ch = state.input.charCodeAt(++state.position);
|
|
70255
|
-
const directiveName = state.input.slice(_position, state.position);
|
|
70256
|
-
const directiveArgs = [];
|
|
70257
|
-
if (directiveName.length < 1) throwError(state, "directive name must not be less than one character in length");
|
|
70258
|
-
while (ch !== 0) {
|
|
70430
|
+
const beforeKey = snapshotState(state);
|
|
70431
|
+
if (!parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
|
|
70432
|
+
if (state.line === entryLine) {
|
|
70433
|
+
ch = state.input.charCodeAt(state.position);
|
|
70259
70434
|
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
70260
|
-
if (ch ===
|
|
70261
|
-
|
|
70262
|
-
|
|
70263
|
-
|
|
70264
|
-
|
|
70435
|
+
if (ch === 58) {
|
|
70436
|
+
ch = state.input.charCodeAt(++state.position);
|
|
70437
|
+
if (!isWsOrEolOrEnd(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
70438
|
+
if (!mappingOpened) {
|
|
70439
|
+
restoreState(state, beforeKey);
|
|
70440
|
+
addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
70441
|
+
mappingOpened = true;
|
|
70442
|
+
parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true);
|
|
70443
|
+
ch = state.input.charCodeAt(state.position);
|
|
70444
|
+
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
70445
|
+
state.position++;
|
|
70446
|
+
}
|
|
70447
|
+
detected = true;
|
|
70448
|
+
atExplicitKey = false;
|
|
70449
|
+
pendingExplicitKey = false;
|
|
70450
|
+
} else if (detected) throwError(state, "expected ':' after a mapping key");
|
|
70451
|
+
else {
|
|
70452
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
|
|
70453
|
+
restoreState(state, beforeKey);
|
|
70454
|
+
return false;
|
|
70455
|
+
}
|
|
70456
|
+
return true;
|
|
70457
|
+
}
|
|
70458
|
+
} else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
70459
|
+
else {
|
|
70460
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
|
|
70461
|
+
restoreState(state, beforeKey);
|
|
70462
|
+
return false;
|
|
70265
70463
|
}
|
|
70266
|
-
|
|
70267
|
-
_position = state.position;
|
|
70268
|
-
while (ch !== 0 && !isWsOrEol(ch)) ch = state.input.charCodeAt(++state.position);
|
|
70269
|
-
directiveArgs.push(state.input.slice(_position, state.position));
|
|
70464
|
+
return true;
|
|
70270
70465
|
}
|
|
70271
|
-
if (ch !== 0) readLineBreak(state);
|
|
70272
|
-
if (_hasOwnProperty.call(directiveHandlers, directiveName)) directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
70273
|
-
else throwWarning(state, "unknown document directive \"" + directiveName + "\"");
|
|
70274
70466
|
}
|
|
70275
|
-
|
|
70276
|
-
if (
|
|
70277
|
-
|
|
70278
|
-
|
|
70279
|
-
|
|
70280
|
-
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
70281
|
-
skipSeparationSpace(state, true, -1);
|
|
70282
|
-
if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
|
70283
|
-
state.documents.push(state.result);
|
|
70284
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
70285
|
-
if (state.input.charCodeAt(state.position) === 46) {
|
|
70286
|
-
state.position += 3;
|
|
70287
|
-
skipSeparationSpace(state, true, -1);
|
|
70467
|
+
if (parseNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, pendingExplicitKey)) pendingExplicitKey = false;
|
|
70468
|
+
if (!atExplicitKey) {
|
|
70469
|
+
if (pendingExplicitKey) {
|
|
70470
|
+
addEmptyScalarEvent(state);
|
|
70471
|
+
pendingExplicitKey = false;
|
|
70288
70472
|
}
|
|
70289
|
-
return;
|
|
70290
|
-
}
|
|
70291
|
-
if (state.position < state.length - 1) throwError(state, "end of the stream or a document separator is expected");
|
|
70292
|
-
}
|
|
70293
|
-
function loadDocuments(input, options) {
|
|
70294
|
-
input = String(input);
|
|
70295
|
-
options = options || {};
|
|
70296
|
-
if (input.length !== 0) {
|
|
70297
|
-
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) input += "\n";
|
|
70298
|
-
if (input.charCodeAt(0) === 65279) input = input.slice(1);
|
|
70299
|
-
}
|
|
70300
|
-
const state = new State(input, options);
|
|
70301
|
-
const nullpos = input.indexOf("\0");
|
|
70302
|
-
if (nullpos !== -1) {
|
|
70303
|
-
state.position = nullpos;
|
|
70304
|
-
throwError(state, "null byte is not allowed in input");
|
|
70305
|
-
}
|
|
70306
|
-
state.input += "\0";
|
|
70307
|
-
while (state.input.charCodeAt(state.position) === 32) {
|
|
70308
|
-
state.lineIndent += 1;
|
|
70309
|
-
state.position += 1;
|
|
70310
|
-
}
|
|
70311
|
-
while (state.position < state.length - 1) readDocument(state);
|
|
70312
|
-
return state.documents;
|
|
70313
|
-
}
|
|
70314
|
-
function loadAll(input, iterator, options) {
|
|
70315
|
-
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
|
|
70316
|
-
options = iterator;
|
|
70317
|
-
iterator = null;
|
|
70318
|
-
}
|
|
70319
|
-
const documents = loadDocuments(input, options);
|
|
70320
|
-
if (typeof iterator !== "function") return documents;
|
|
70321
|
-
for (let index = 0, length = documents.length; index < length; index += 1) iterator(documents[index]);
|
|
70322
|
-
}
|
|
70323
|
-
function load(input, options) {
|
|
70324
|
-
const documents = loadDocuments(input, options);
|
|
70325
|
-
if (documents.length === 0) return;
|
|
70326
|
-
else if (documents.length === 1) return documents[0];
|
|
70327
|
-
throw new YAMLException("expected a single document in the stream, but found more");
|
|
70328
|
-
}
|
|
70329
|
-
module.exports.loadAll = loadAll;
|
|
70330
|
-
module.exports.load = load;
|
|
70331
|
-
}));
|
|
70332
|
-
//#endregion
|
|
70333
|
-
//#region lib/dumper.js
|
|
70334
|
-
var require_dumper = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
70335
|
-
var common = require_common();
|
|
70336
|
-
var YAMLException = require_exception();
|
|
70337
|
-
var DEFAULT_SCHEMA = require_default();
|
|
70338
|
-
var _toString = Object.prototype.toString;
|
|
70339
|
-
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
70340
|
-
var CHAR_BOM = 65279;
|
|
70341
|
-
var CHAR_TAB = 9;
|
|
70342
|
-
var CHAR_LINE_FEED = 10;
|
|
70343
|
-
var CHAR_CARRIAGE_RETURN = 13;
|
|
70344
|
-
var CHAR_SPACE = 32;
|
|
70345
|
-
var CHAR_EXCLAMATION = 33;
|
|
70346
|
-
var CHAR_DOUBLE_QUOTE = 34;
|
|
70347
|
-
var CHAR_SHARP = 35;
|
|
70348
|
-
var CHAR_PERCENT = 37;
|
|
70349
|
-
var CHAR_AMPERSAND = 38;
|
|
70350
|
-
var CHAR_SINGLE_QUOTE = 39;
|
|
70351
|
-
var CHAR_ASTERISK = 42;
|
|
70352
|
-
var CHAR_COMMA = 44;
|
|
70353
|
-
var CHAR_MINUS = 45;
|
|
70354
|
-
var CHAR_COLON = 58;
|
|
70355
|
-
var CHAR_EQUALS = 61;
|
|
70356
|
-
var CHAR_GREATER_THAN = 62;
|
|
70357
|
-
var CHAR_QUESTION = 63;
|
|
70358
|
-
var CHAR_COMMERCIAL_AT = 64;
|
|
70359
|
-
var CHAR_LEFT_SQUARE_BRACKET = 91;
|
|
70360
|
-
var CHAR_RIGHT_SQUARE_BRACKET = 93;
|
|
70361
|
-
var CHAR_GRAVE_ACCENT = 96;
|
|
70362
|
-
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
70363
|
-
var CHAR_VERTICAL_LINE = 124;
|
|
70364
|
-
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
70365
|
-
var ESCAPE_SEQUENCES = {};
|
|
70366
|
-
ESCAPE_SEQUENCES[0] = "\\0";
|
|
70367
|
-
ESCAPE_SEQUENCES[7] = "\\a";
|
|
70368
|
-
ESCAPE_SEQUENCES[8] = "\\b";
|
|
70369
|
-
ESCAPE_SEQUENCES[9] = "\\t";
|
|
70370
|
-
ESCAPE_SEQUENCES[10] = "\\n";
|
|
70371
|
-
ESCAPE_SEQUENCES[11] = "\\v";
|
|
70372
|
-
ESCAPE_SEQUENCES[12] = "\\f";
|
|
70373
|
-
ESCAPE_SEQUENCES[13] = "\\r";
|
|
70374
|
-
ESCAPE_SEQUENCES[27] = "\\e";
|
|
70375
|
-
ESCAPE_SEQUENCES[34] = "\\\"";
|
|
70376
|
-
ESCAPE_SEQUENCES[92] = "\\\\";
|
|
70377
|
-
ESCAPE_SEQUENCES[133] = "\\N";
|
|
70378
|
-
ESCAPE_SEQUENCES[160] = "\\_";
|
|
70379
|
-
ESCAPE_SEQUENCES[8232] = "\\L";
|
|
70380
|
-
ESCAPE_SEQUENCES[8233] = "\\P";
|
|
70381
|
-
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
70382
|
-
"y",
|
|
70383
|
-
"Y",
|
|
70384
|
-
"yes",
|
|
70385
|
-
"Yes",
|
|
70386
|
-
"YES",
|
|
70387
|
-
"on",
|
|
70388
|
-
"On",
|
|
70389
|
-
"ON",
|
|
70390
|
-
"n",
|
|
70391
|
-
"N",
|
|
70392
|
-
"no",
|
|
70393
|
-
"No",
|
|
70394
|
-
"NO",
|
|
70395
|
-
"off",
|
|
70396
|
-
"Off",
|
|
70397
|
-
"OFF"
|
|
70398
|
-
];
|
|
70399
|
-
var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
|
|
70400
|
-
function compileStyleMap(schema, map) {
|
|
70401
|
-
if (map === null) return {};
|
|
70402
|
-
const result = {};
|
|
70403
|
-
const keys = Object.keys(map);
|
|
70404
|
-
for (let index = 0, length = keys.length; index < length; index += 1) {
|
|
70405
|
-
let tag = keys[index];
|
|
70406
|
-
let style = String(map[tag]);
|
|
70407
|
-
if (tag.slice(0, 2) === "!!") tag = "tag:yaml.org,2002:" + tag.slice(2);
|
|
70408
|
-
const type = schema.compiledTypeMap["fallback"][tag];
|
|
70409
|
-
if (type && _hasOwnProperty.call(type.styleAliases, style)) style = type.styleAliases[style];
|
|
70410
|
-
result[tag] = style;
|
|
70411
70473
|
}
|
|
70412
|
-
|
|
70413
|
-
|
|
70414
|
-
|
|
70415
|
-
|
|
70416
|
-
let length;
|
|
70417
|
-
const string = character.toString(16).toUpperCase();
|
|
70418
|
-
if (character <= 255) {
|
|
70419
|
-
handle = "x";
|
|
70420
|
-
length = 2;
|
|
70421
|
-
} else if (character <= 65535) {
|
|
70422
|
-
handle = "u";
|
|
70423
|
-
length = 4;
|
|
70424
|
-
} else if (character <= 4294967295) {
|
|
70425
|
-
handle = "U";
|
|
70426
|
-
length = 8;
|
|
70427
|
-
} else throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
|
|
70428
|
-
return "\\" + handle + common.repeat("0", length - string.length) + string;
|
|
70474
|
+
skipSeparationSpace(state, true);
|
|
70475
|
+
ch = state.input.charCodeAt(state.position);
|
|
70476
|
+
if ((state.line === entryLine || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
|
|
70477
|
+
else if (state.lineIndent < nodeIndent) break;
|
|
70429
70478
|
}
|
|
70430
|
-
|
|
70431
|
-
|
|
70432
|
-
|
|
70433
|
-
|
|
70434
|
-
|
|
70435
|
-
|
|
70436
|
-
|
|
70437
|
-
|
|
70438
|
-
|
|
70439
|
-
|
|
70440
|
-
|
|
70441
|
-
|
|
70442
|
-
|
|
70443
|
-
|
|
70444
|
-
|
|
70445
|
-
|
|
70446
|
-
|
|
70447
|
-
|
|
70448
|
-
|
|
70449
|
-
|
|
70450
|
-
|
|
70451
|
-
this.duplicates = [];
|
|
70452
|
-
this.usedDuplicates = null;
|
|
70453
|
-
}
|
|
70454
|
-
function indentString(string, spaces) {
|
|
70455
|
-
const ind = common.repeat(" ", spaces);
|
|
70456
|
-
let position = 0;
|
|
70457
|
-
let result = "";
|
|
70458
|
-
const length = string.length;
|
|
70459
|
-
while (position < length) {
|
|
70460
|
-
let line;
|
|
70461
|
-
const next = string.indexOf("\n", position);
|
|
70462
|
-
if (next === -1) {
|
|
70463
|
-
line = string.slice(position);
|
|
70464
|
-
position = length;
|
|
70465
|
-
} else {
|
|
70466
|
-
line = string.slice(position, next + 1);
|
|
70467
|
-
position = next + 1;
|
|
70468
|
-
}
|
|
70469
|
-
if (line.length && line !== "\n") result += ind;
|
|
70470
|
-
result += line;
|
|
70471
|
-
}
|
|
70472
|
-
return result;
|
|
70479
|
+
if (!detected) return false;
|
|
70480
|
+
if (atExplicitKey) addEmptyScalarEvent(state);
|
|
70481
|
+
if (mappingOpened) addPopEvent(state);
|
|
70482
|
+
return true;
|
|
70483
|
+
}
|
|
70484
|
+
function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact, allowPropertyMapping = true) {
|
|
70485
|
+
if (state.depth >= state.maxDepth) throwError(state, `nesting exceeded maxDepth (${state.maxDepth})`);
|
|
70486
|
+
state.depth++;
|
|
70487
|
+
let indentStatus = 1;
|
|
70488
|
+
let atNewLine = false;
|
|
70489
|
+
let hasContent = false;
|
|
70490
|
+
let propertyStart = null;
|
|
70491
|
+
const props = emptyProperties();
|
|
70492
|
+
let allowBlockScalars = nodeContext === CONTEXT_BLOCK_OUT || nodeContext === CONTEXT_BLOCK_IN;
|
|
70493
|
+
let allowBlockCollections = allowBlockScalars;
|
|
70494
|
+
const allowBlockStyles = allowBlockScalars;
|
|
70495
|
+
if (allowToSeek && skipSeparationSpace(state, true)) {
|
|
70496
|
+
atNewLine = true;
|
|
70497
|
+
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
70498
|
+
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
70499
|
+
else indentStatus = -1;
|
|
70473
70500
|
}
|
|
70474
|
-
|
|
70475
|
-
|
|
70476
|
-
}
|
|
70477
|
-
function testImplicitResolving(state, str) {
|
|
70478
|
-
for (let index = 0, length = state.implicitTypes.length; index < length; index += 1) if (state.implicitTypes[index].resolve(str)) return true;
|
|
70501
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
70502
|
+
state.depth--;
|
|
70479
70503
|
return false;
|
|
70480
70504
|
}
|
|
70481
|
-
|
|
70482
|
-
|
|
70483
|
-
|
|
70484
|
-
|
|
70485
|
-
|
|
70486
|
-
|
|
70487
|
-
|
|
70488
|
-
|
|
70489
|
-
|
|
70490
|
-
|
|
70491
|
-
const cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
|
|
70492
|
-
const cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
|
|
70493
|
-
return (inblock ? cIsNsCharOrWhitespace : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar;
|
|
70494
|
-
}
|
|
70495
|
-
function isPlainSafeFirst(c) {
|
|
70496
|
-
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
70497
|
-
}
|
|
70498
|
-
function isPlainSafeLast(c) {
|
|
70499
|
-
return !isWhitespace(c) && c !== CHAR_COLON;
|
|
70500
|
-
}
|
|
70501
|
-
function codePointAt(string, pos) {
|
|
70502
|
-
const first = string.charCodeAt(pos);
|
|
70503
|
-
let second;
|
|
70504
|
-
if (first >= 55296 && first <= 56319 && pos + 1 < string.length) {
|
|
70505
|
-
second = string.charCodeAt(pos + 1);
|
|
70506
|
-
if (second >= 56320 && second <= 57343) return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
70507
|
-
}
|
|
70508
|
-
return first;
|
|
70509
|
-
}
|
|
70510
|
-
function needIndentIndicator(string) {
|
|
70511
|
-
return /^\n* /.test(string);
|
|
70512
|
-
}
|
|
70513
|
-
var STYLE_PLAIN = 1;
|
|
70514
|
-
var STYLE_SINGLE = 2;
|
|
70515
|
-
var STYLE_LITERAL = 3;
|
|
70516
|
-
var STYLE_FOLDED = 4;
|
|
70517
|
-
var STYLE_DOUBLE = 5;
|
|
70518
|
-
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
|
|
70519
|
-
let i;
|
|
70520
|
-
let char = 0;
|
|
70521
|
-
let prevChar = null;
|
|
70522
|
-
let hasLineBreak = false;
|
|
70523
|
-
let hasFoldableLine = false;
|
|
70524
|
-
const shouldTrackWidth = lineWidth !== -1;
|
|
70525
|
-
let previousLineBreak = -1;
|
|
70526
|
-
let plain = isPlainSafeFirst(codePointAt(string, 0)) && isPlainSafeLast(codePointAt(string, string.length - 1));
|
|
70527
|
-
if (singleLineOnly || forceQuotes) for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
70528
|
-
char = codePointAt(string, i);
|
|
70529
|
-
if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
70530
|
-
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
70531
|
-
prevChar = char;
|
|
70532
|
-
}
|
|
70533
|
-
else {
|
|
70534
|
-
for (i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
70535
|
-
char = codePointAt(string, i);
|
|
70536
|
-
if (char === CHAR_LINE_FEED) {
|
|
70537
|
-
hasLineBreak = true;
|
|
70538
|
-
if (shouldTrackWidth) {
|
|
70539
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
70540
|
-
previousLineBreak = i;
|
|
70541
|
-
}
|
|
70542
|
-
} else if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
70543
|
-
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
70544
|
-
prevChar = char;
|
|
70545
|
-
}
|
|
70546
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1] !== " ";
|
|
70547
|
-
}
|
|
70548
|
-
if (!hasLineBreak && !hasFoldableLine) {
|
|
70549
|
-
if (plain && !forceQuotes && !testAmbiguousType(string)) return STYLE_PLAIN;
|
|
70550
|
-
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
70551
|
-
}
|
|
70552
|
-
if (indentPerLevel > 9 && needIndentIndicator(string)) return STYLE_DOUBLE;
|
|
70553
|
-
if (!forceQuotes) return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
70554
|
-
return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
|
|
70555
|
-
}
|
|
70556
|
-
function writeScalar(state, string, level, iskey, inblock) {
|
|
70557
|
-
state.dump = function() {
|
|
70558
|
-
if (string.length === 0) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"\"" : "''";
|
|
70559
|
-
if (!state.noCompatMode) {
|
|
70560
|
-
if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) return state.quotingType === QUOTING_TYPE_DOUBLE ? "\"" + string + "\"" : "'" + string + "'";
|
|
70561
|
-
}
|
|
70562
|
-
const indent = state.indent * Math.max(1, level);
|
|
70563
|
-
const lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
70564
|
-
const singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
|
|
70565
|
-
function testAmbiguity(string) {
|
|
70566
|
-
return testImplicitResolving(state, string);
|
|
70567
|
-
}
|
|
70568
|
-
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {
|
|
70569
|
-
case STYLE_PLAIN: return string;
|
|
70570
|
-
case STYLE_SINGLE: return "'" + string.replace(/'/g, "''") + "'";
|
|
70571
|
-
case STYLE_LITERAL: return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString(string, indent));
|
|
70572
|
-
case STYLE_FOLDED: return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
70573
|
-
case STYLE_DOUBLE: return "\"" + escapeString(string) + "\"";
|
|
70574
|
-
default: throw new YAMLException("impossible error: invalid scalar style");
|
|
70575
|
-
}
|
|
70576
|
-
}();
|
|
70577
|
-
}
|
|
70578
|
-
function blockHeader(string, indentPerLevel) {
|
|
70579
|
-
const indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : "";
|
|
70580
|
-
const clip = string[string.length - 1] === "\n";
|
|
70581
|
-
return indentIndicator + (clip && (string[string.length - 2] === "\n" || string === "\n") ? "+" : clip ? "" : "-") + "\n";
|
|
70582
|
-
}
|
|
70583
|
-
function dropEndingNewline(string) {
|
|
70584
|
-
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
70585
|
-
}
|
|
70586
|
-
function foldString(string, width) {
|
|
70587
|
-
const lineRe = /(\n+)([^\n]*)/g;
|
|
70588
|
-
let result = function() {
|
|
70589
|
-
let nextLF = string.indexOf("\n");
|
|
70590
|
-
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
70591
|
-
lineRe.lastIndex = nextLF;
|
|
70592
|
-
return foldLine(string.slice(0, nextLF), width);
|
|
70593
|
-
}();
|
|
70594
|
-
let prevMoreIndented = string[0] === "\n" || string[0] === " ";
|
|
70595
|
-
let moreIndented;
|
|
70596
|
-
let match;
|
|
70597
|
-
while (match = lineRe.exec(string)) {
|
|
70598
|
-
const prefix = match[1];
|
|
70599
|
-
const line = match[2];
|
|
70600
|
-
moreIndented = line[0] === " ";
|
|
70601
|
-
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
70602
|
-
prevMoreIndented = moreIndented;
|
|
70603
|
-
}
|
|
70604
|
-
return result;
|
|
70605
|
-
}
|
|
70606
|
-
function foldLine(line, width) {
|
|
70607
|
-
if (line === "" || line[0] === " ") return line;
|
|
70608
|
-
const breakRe = / [^ ]/g;
|
|
70609
|
-
let match;
|
|
70610
|
-
let start = 0;
|
|
70611
|
-
let end;
|
|
70612
|
-
let curr = 0;
|
|
70613
|
-
let next = 0;
|
|
70614
|
-
let result = "";
|
|
70615
|
-
while (match = breakRe.exec(line)) {
|
|
70616
|
-
next = match.index;
|
|
70617
|
-
if (next - start > width) {
|
|
70618
|
-
end = curr > start ? curr : next;
|
|
70619
|
-
result += "\n" + line.slice(start, end);
|
|
70620
|
-
start = end + 1;
|
|
70621
|
-
}
|
|
70622
|
-
curr = next;
|
|
70623
|
-
}
|
|
70624
|
-
result += "\n";
|
|
70625
|
-
if (line.length - start > width && curr > start) result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
|
|
70626
|
-
else result += line.slice(start);
|
|
70627
|
-
return result.slice(1);
|
|
70628
|
-
}
|
|
70629
|
-
function escapeString(string) {
|
|
70630
|
-
let result = "";
|
|
70631
|
-
let char = 0;
|
|
70632
|
-
for (let i = 0; i < string.length; char >= 65536 ? i += 2 : i++) {
|
|
70633
|
-
char = codePointAt(string, i);
|
|
70634
|
-
const escapeSeq = ESCAPE_SEQUENCES[char];
|
|
70635
|
-
if (!escapeSeq && isPrintable(char)) {
|
|
70636
|
-
result += string[i];
|
|
70637
|
-
if (char >= 65536) result += string[i + 1];
|
|
70638
|
-
} else result += escapeSeq || encodeHex(char);
|
|
70639
|
-
}
|
|
70640
|
-
return result;
|
|
70641
|
-
}
|
|
70642
|
-
function writeFlowSequence(state, level, object) {
|
|
70643
|
-
let _result = "";
|
|
70644
|
-
const _tag = state.tag;
|
|
70645
|
-
for (let index = 0, length = object.length; index < length; index += 1) {
|
|
70646
|
-
let value = object[index];
|
|
70647
|
-
if (state.replacer) value = state.replacer.call(object, String(index), value);
|
|
70648
|
-
if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
|
|
70649
|
-
if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
|
|
70650
|
-
_result += state.dump;
|
|
70505
|
+
if (indentStatus === 1) while (true) {
|
|
70506
|
+
const ch = state.input.charCodeAt(state.position);
|
|
70507
|
+
const propertyState = snapshotState(state);
|
|
70508
|
+
if (atNewLine && indentStatus !== 1 && (ch === 33 || ch === 38)) break;
|
|
70509
|
+
if (atNewLine && allowBlockStyles && (props.tagStart !== NO_RANGE$1 || props.anchorStart !== NO_RANGE$1) && (ch === 33 || ch === 38)) {
|
|
70510
|
+
const fallbackState = snapshotState(state);
|
|
70511
|
+
const flowIndent = parentIndent + 1;
|
|
70512
|
+
if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === 3) {
|
|
70513
|
+
state.depth--;
|
|
70514
|
+
return true;
|
|
70651
70515
|
}
|
|
70516
|
+
restoreState(state, fallbackState);
|
|
70652
70517
|
}
|
|
70653
|
-
|
|
70654
|
-
state
|
|
70518
|
+
if (atNewLine && (ch === 33 && props.tagStart !== NO_RANGE$1 || ch === 38 && props.anchorStart !== NO_RANGE$1)) break;
|
|
70519
|
+
if (!readTagProperty(state, props, nodeContext === CONTEXT_FLOW_IN) && !readAnchorProperty(state, props)) break;
|
|
70520
|
+
if (propertyStart === null) propertyStart = propertyState;
|
|
70521
|
+
if (skipSeparationSpace(state, true)) {
|
|
70522
|
+
atNewLine = true;
|
|
70523
|
+
allowBlockCollections = allowBlockStyles;
|
|
70524
|
+
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
70525
|
+
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
70526
|
+
else indentStatus = -1;
|
|
70527
|
+
} else allowBlockCollections = false;
|
|
70655
70528
|
}
|
|
70656
|
-
|
|
70657
|
-
|
|
70658
|
-
const
|
|
70659
|
-
|
|
70660
|
-
|
|
70661
|
-
|
|
70662
|
-
|
|
70663
|
-
|
|
70664
|
-
|
|
70665
|
-
|
|
70666
|
-
|
|
70529
|
+
if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
|
|
70530
|
+
if (indentStatus === 1 || nodeContext === CONTEXT_BLOCK_OUT) {
|
|
70531
|
+
const flowIndent = nodeContext === CONTEXT_FLOW_IN || nodeContext === CONTEXT_FLOW_OUT ? parentIndent : parentIndent + 1;
|
|
70532
|
+
const blockIndent = state.position - state.lineStart;
|
|
70533
|
+
if (indentStatus === 1) if (allowBlockCollections && (readBlockSequence(state, blockIndent, props) || readBlockMapping(state, blockIndent, flowIndent, props)) || readFlowCollection(state, flowIndent, props)) hasContent = true;
|
|
70534
|
+
else {
|
|
70535
|
+
const ch = state.input.charCodeAt(state.position);
|
|
70536
|
+
if (propertyStart !== null && allowPropertyMapping && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62) {
|
|
70537
|
+
const fallbackState = snapshotState(state);
|
|
70538
|
+
const propertyIndent = propertyStart.position - propertyStart.lineStart;
|
|
70539
|
+
restoreState(state, propertyStart);
|
|
70540
|
+
if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === 3) hasContent = true;
|
|
70541
|
+
else restoreState(state, fallbackState);
|
|
70667
70542
|
}
|
|
70543
|
+
if (!hasContent && (allowBlockScalars && readBlockScalar(state, flowIndent, props) || readSingleQuotedScalar(state, flowIndent, props) || readDoubleQuotedScalar(state, flowIndent, props) || readAlias(state, props) || readPlainScalar(state, flowIndent, nodeContext, props))) hasContent = true;
|
|
70668
70544
|
}
|
|
70669
|
-
|
|
70670
|
-
state.dump = _result || "[]";
|
|
70545
|
+
else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent, props);
|
|
70671
70546
|
}
|
|
70672
|
-
|
|
70673
|
-
|
|
70674
|
-
|
|
70675
|
-
|
|
70676
|
-
for (let index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
70677
|
-
let pairBuffer = "";
|
|
70678
|
-
if (_result !== "") pairBuffer += ", ";
|
|
70679
|
-
if (state.condenseFlow) pairBuffer += "\"";
|
|
70680
|
-
const objectKey = objectKeyList[index];
|
|
70681
|
-
let objectValue = object[objectKey];
|
|
70682
|
-
if (state.replacer) objectValue = state.replacer.call(object, objectKey, objectValue);
|
|
70683
|
-
if (!writeNode(state, level, objectKey, false, false)) continue;
|
|
70684
|
-
if (state.dump.length > 1024) pairBuffer += "? ";
|
|
70685
|
-
pairBuffer += state.dump + (state.condenseFlow ? "\"" : "") + ":" + (state.condenseFlow ? "" : " ");
|
|
70686
|
-
if (!writeNode(state, level, objectValue, false, false)) continue;
|
|
70687
|
-
pairBuffer += state.dump;
|
|
70688
|
-
_result += pairBuffer;
|
|
70689
|
-
}
|
|
70690
|
-
state.tag = _tag;
|
|
70691
|
-
state.dump = "{" + _result + "}";
|
|
70547
|
+
allowBlockScalars = allowBlockScalars && !hasContent;
|
|
70548
|
+
if (!hasContent && (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1 || allowBlockScalars)) {
|
|
70549
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, 1);
|
|
70550
|
+
hasContent = true;
|
|
70692
70551
|
}
|
|
70693
|
-
|
|
70694
|
-
|
|
70695
|
-
|
|
70696
|
-
|
|
70697
|
-
|
|
70698
|
-
|
|
70699
|
-
|
|
70700
|
-
|
|
70701
|
-
|
|
70702
|
-
|
|
70703
|
-
|
|
70704
|
-
|
|
70705
|
-
|
|
70706
|
-
|
|
70707
|
-
|
|
70708
|
-
|
|
70709
|
-
|
|
70710
|
-
pairBuffer += state.dump;
|
|
70711
|
-
if (explicitPair) pairBuffer += generateNextLine(state, level);
|
|
70712
|
-
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) continue;
|
|
70713
|
-
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) pairBuffer += ":";
|
|
70714
|
-
else pairBuffer += ": ";
|
|
70715
|
-
pairBuffer += state.dump;
|
|
70716
|
-
_result += pairBuffer;
|
|
70717
|
-
}
|
|
70718
|
-
state.tag = _tag;
|
|
70719
|
-
state.dump = _result || "{}";
|
|
70552
|
+
state.depth--;
|
|
70553
|
+
return hasContent || props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1;
|
|
70554
|
+
}
|
|
70555
|
+
function readDirective(state) {
|
|
70556
|
+
if (state.lineIndent > 0 || state.input.charCodeAt(state.position) !== 37) return false;
|
|
70557
|
+
state.position++;
|
|
70558
|
+
const nameStart = state.position;
|
|
70559
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
|
|
70560
|
+
const name = state.input.slice(nameStart, state.position);
|
|
70561
|
+
const args = [];
|
|
70562
|
+
if (name.length === 0) throwError(state, "directive name must not be less than one character in length");
|
|
70563
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isEol(state.input.charCodeAt(state.position))) {
|
|
70564
|
+
while (isWhiteSpace(state.input.charCodeAt(state.position))) state.position++;
|
|
70565
|
+
if (state.input.charCodeAt(state.position) === 35 || isEol(state.input.charCodeAt(state.position)) || state.input.charCodeAt(state.position) === 0) break;
|
|
70566
|
+
const start = state.position;
|
|
70567
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
|
|
70568
|
+
args.push(state.input.slice(start, state.position));
|
|
70720
70569
|
}
|
|
70721
|
-
|
|
70722
|
-
|
|
70723
|
-
|
|
70724
|
-
|
|
70725
|
-
|
|
70726
|
-
|
|
70727
|
-
|
|
70728
|
-
|
|
70729
|
-
|
|
70730
|
-
|
|
70731
|
-
|
|
70732
|
-
|
|
70733
|
-
|
|
70734
|
-
|
|
70735
|
-
|
|
70736
|
-
|
|
70737
|
-
|
|
70738
|
-
|
|
70739
|
-
|
|
70740
|
-
|
|
70570
|
+
if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
|
|
70571
|
+
if (name === "YAML") {
|
|
70572
|
+
if (state.directives.some((directive) => directive.kind === "yaml")) throwError(state, "duplication of %YAML directive");
|
|
70573
|
+
if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
|
|
70574
|
+
const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
70575
|
+
if (match === null) throwError(state, "ill-formed argument of the YAML directive");
|
|
70576
|
+
if (parseInt(match[1], 10) !== 1) throwError(state, "unacceptable YAML version of the document");
|
|
70577
|
+
state.directives.push({
|
|
70578
|
+
kind: "yaml",
|
|
70579
|
+
version: args[0]
|
|
70580
|
+
});
|
|
70581
|
+
} else if (name === "TAG") {
|
|
70582
|
+
if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
|
|
70583
|
+
const [handle, prefix] = args;
|
|
70584
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
70585
|
+
if (HAS_OWN.call(state.tagHandlers, handle)) throwError(state, `there is a previously declared suffix for "${handle}" tag handle`);
|
|
70586
|
+
if (!PATTERN_TAG_PREFIX.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
70587
|
+
state.tagHandlers[handle] = prefix;
|
|
70588
|
+
state.directives.push({
|
|
70589
|
+
kind: "tag",
|
|
70590
|
+
handle,
|
|
70591
|
+
prefix
|
|
70592
|
+
});
|
|
70741
70593
|
}
|
|
70742
|
-
|
|
70743
|
-
|
|
70744
|
-
|
|
70745
|
-
|
|
70746
|
-
|
|
70747
|
-
|
|
70748
|
-
|
|
70749
|
-
|
|
70750
|
-
|
|
70751
|
-
|
|
70752
|
-
if (objectOrArray) {
|
|
70753
|
-
duplicateIndex = state.duplicates.indexOf(object);
|
|
70754
|
-
duplicate = duplicateIndex !== -1;
|
|
70755
|
-
}
|
|
70756
|
-
if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) compact = false;
|
|
70757
|
-
if (duplicate && state.usedDuplicates[duplicateIndex]) state.dump = "*ref_" + duplicateIndex;
|
|
70758
|
-
else {
|
|
70759
|
-
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) state.usedDuplicates[duplicateIndex] = true;
|
|
70760
|
-
if (type === "[object Object]") if (block && Object.keys(state.dump).length !== 0) {
|
|
70761
|
-
writeBlockMapping(state, level, state.dump, compact);
|
|
70762
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
70763
|
-
} else {
|
|
70764
|
-
writeFlowMapping(state, level, state.dump);
|
|
70765
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
70766
|
-
}
|
|
70767
|
-
else if (type === "[object Array]") if (block && state.dump.length !== 0) {
|
|
70768
|
-
if (state.noArrayIndent && !isblockseq && level > 0) writeBlockSequence(state, level - 1, state.dump, compact);
|
|
70769
|
-
else writeBlockSequence(state, level, state.dump, compact);
|
|
70770
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + state.dump;
|
|
70771
|
-
} else {
|
|
70772
|
-
writeFlowSequence(state, level, state.dump);
|
|
70773
|
-
if (duplicate) state.dump = "&ref_" + duplicateIndex + " " + state.dump;
|
|
70774
|
-
}
|
|
70775
|
-
else if (type === "[object String]") {
|
|
70776
|
-
if (state.tag !== "?") writeScalar(state, state.dump, level, iskey, inblock);
|
|
70777
|
-
} else if (type === "[object Undefined]") return false;
|
|
70778
|
-
else {
|
|
70779
|
-
if (state.skipInvalid) return false;
|
|
70780
|
-
throw new YAMLException("unacceptable kind of an object to dump " + type);
|
|
70781
|
-
}
|
|
70782
|
-
if (state.tag !== null && state.tag !== "?") {
|
|
70783
|
-
let tagStr = encodeURI(state.tag[0] === "!" ? state.tag.slice(1) : state.tag).replace(/!/g, "%21");
|
|
70784
|
-
if (state.tag[0] === "!") tagStr = "!" + tagStr;
|
|
70785
|
-
else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") tagStr = "!!" + tagStr.slice(18);
|
|
70786
|
-
else tagStr = "!<" + tagStr + ">";
|
|
70787
|
-
state.dump = tagStr + " " + state.dump;
|
|
70788
|
-
}
|
|
70789
|
-
}
|
|
70790
|
-
return true;
|
|
70594
|
+
return true;
|
|
70595
|
+
}
|
|
70596
|
+
function readDocument(state) {
|
|
70597
|
+
state.directives = [];
|
|
70598
|
+
state.tagHandlers = Object.create(null);
|
|
70599
|
+
let hasDirectives = false;
|
|
70600
|
+
skipSeparationSpace(state, true);
|
|
70601
|
+
while (readDirective(state)) {
|
|
70602
|
+
hasDirectives = true;
|
|
70603
|
+
skipSeparationSpace(state, true);
|
|
70791
70604
|
}
|
|
70792
|
-
|
|
70793
|
-
|
|
70794
|
-
|
|
70795
|
-
|
|
70796
|
-
|
|
70797
|
-
|
|
70798
|
-
state.
|
|
70605
|
+
let explicitStart = false;
|
|
70606
|
+
let explicitEnd = false;
|
|
70607
|
+
let allowCompact = true;
|
|
70608
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 3))) {
|
|
70609
|
+
explicitStart = true;
|
|
70610
|
+
const markerLine = state.line;
|
|
70611
|
+
state.position += 3;
|
|
70612
|
+
skipSeparationSpace(state, true);
|
|
70613
|
+
allowCompact = state.line > markerLine;
|
|
70614
|
+
} else if (hasDirectives) throwError(state, "directives end mark is expected");
|
|
70615
|
+
const documentEventIndex = state.events.length;
|
|
70616
|
+
if (!explicitStart && state.position === state.lineStart && state.input.charCodeAt(state.position) === 46 && testDocumentSeparator(state)) {
|
|
70617
|
+
state.position += 3;
|
|
70618
|
+
skipSeparationSpace(state, true);
|
|
70619
|
+
return;
|
|
70799
70620
|
}
|
|
70800
|
-
|
|
70801
|
-
|
|
70802
|
-
|
|
70803
|
-
|
|
70804
|
-
|
|
70805
|
-
|
|
70806
|
-
|
|
70807
|
-
|
|
70808
|
-
|
|
70809
|
-
|
|
70810
|
-
for (let i = 0, length = objectKeyList.length; i < length; i += 1) inspectNode(object[objectKeyList[i]], objects, duplicatesIndexes);
|
|
70811
|
-
}
|
|
70812
|
-
}
|
|
70621
|
+
addDocumentEvent(state, explicitStart, false);
|
|
70622
|
+
if (!parseNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, allowCompact, allowCompact)) addEmptyScalarEvent(state);
|
|
70623
|
+
skipSeparationSpace(state, true);
|
|
70624
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
70625
|
+
explicitEnd = state.input.charCodeAt(state.position) === 46;
|
|
70626
|
+
if (explicitEnd) {
|
|
70627
|
+
const markerLine = state.line;
|
|
70628
|
+
state.position += 3;
|
|
70629
|
+
skipSeparationSpace(state, true);
|
|
70630
|
+
if (state.line === markerLine && state.position < state.length) throwError(state, "end of the stream or a document separator is expected");
|
|
70813
70631
|
}
|
|
70814
70632
|
}
|
|
70815
|
-
|
|
70816
|
-
|
|
70817
|
-
|
|
70818
|
-
|
|
70819
|
-
|
|
70820
|
-
|
|
70821
|
-
|
|
70822
|
-
|
|
70633
|
+
const documentEvent = state.events[documentEventIndex];
|
|
70634
|
+
if (documentEvent?.type === 1) documentEvent.explicitEnd = explicitEnd;
|
|
70635
|
+
addPopEvent(state);
|
|
70636
|
+
if (!explicitEnd && state.position < state.length && !(state.position === state.lineStart && testDocumentSeparator(state))) throwError(state, "end of the stream or a document separator is expected");
|
|
70637
|
+
}
|
|
70638
|
+
function parseEvents(input, options) {
|
|
70639
|
+
const length = input.length;
|
|
70640
|
+
const state = {
|
|
70641
|
+
...DEFAULT_PARSER_OPTIONS,
|
|
70642
|
+
...options,
|
|
70643
|
+
input: `${input}\0`,
|
|
70644
|
+
length,
|
|
70645
|
+
position: 0,
|
|
70646
|
+
line: 0,
|
|
70647
|
+
lineStart: 0,
|
|
70648
|
+
lineIndent: 0,
|
|
70649
|
+
firstTabInLine: -1,
|
|
70650
|
+
depth: 0,
|
|
70651
|
+
directives: [],
|
|
70652
|
+
tagHandlers: Object.create(null),
|
|
70653
|
+
events: []
|
|
70654
|
+
};
|
|
70655
|
+
const nullpos = input.indexOf("\0");
|
|
70656
|
+
if (nullpos !== -1) throwErrorAt(input, nullpos, "null byte is not allowed in input", state.filename);
|
|
70657
|
+
if (state.input.charCodeAt(state.position) === 65279) state.position++;
|
|
70658
|
+
while (state.position < state.length) {
|
|
70659
|
+
skipSeparationSpace(state, true);
|
|
70660
|
+
if (state.position >= state.length) break;
|
|
70661
|
+
const documentStart = state.position;
|
|
70662
|
+
readDocument(state);
|
|
70663
|
+
if (state.position === documentStart)
|
|
70664
|
+
/* c8 ignore next */
|
|
70665
|
+
throwError(state, "can not read a document");
|
|
70823
70666
|
}
|
|
70824
|
-
|
|
70825
|
-
}
|
|
70667
|
+
return state.events;
|
|
70668
|
+
}
|
|
70826
70669
|
//#endregion
|
|
70827
|
-
//#region
|
|
70828
|
-
var
|
|
70829
|
-
|
|
70830
|
-
|
|
70831
|
-
|
|
70832
|
-
|
|
70833
|
-
|
|
70834
|
-
|
|
70835
|
-
|
|
70836
|
-
module.exports.Type = require_type();
|
|
70837
|
-
module.exports.Schema = require_schema();
|
|
70838
|
-
module.exports.FAILSAFE_SCHEMA = require_failsafe();
|
|
70839
|
-
module.exports.JSON_SCHEMA = require_json();
|
|
70840
|
-
module.exports.CORE_SCHEMA = require_core();
|
|
70841
|
-
module.exports.DEFAULT_SCHEMA = require_default();
|
|
70842
|
-
module.exports.load = loader.load;
|
|
70843
|
-
module.exports.loadAll = loader.loadAll;
|
|
70844
|
-
module.exports.dump = dumper.dump;
|
|
70845
|
-
module.exports.YAMLException = require_exception();
|
|
70846
|
-
module.exports.types = {
|
|
70847
|
-
binary: require_binary(),
|
|
70848
|
-
float: require_float(),
|
|
70849
|
-
map: require_map(),
|
|
70850
|
-
null: require_null(),
|
|
70851
|
-
pairs: require_pairs(),
|
|
70852
|
-
set: require_set(),
|
|
70853
|
-
timestamp: require_timestamp(),
|
|
70854
|
-
bool: require_bool(),
|
|
70855
|
-
int: require_int(),
|
|
70856
|
-
merge: require_merge(),
|
|
70857
|
-
omap: require_omap(),
|
|
70858
|
-
seq: require_seq(),
|
|
70859
|
-
str: require_str()
|
|
70670
|
+
//#region src/load.ts
|
|
70671
|
+
var DEFAULT_LOAD_OPTIONS = {
|
|
70672
|
+
...DEFAULT_PARSER_OPTIONS,
|
|
70673
|
+
...DEFAULT_CONSTRUCTOR_OPTIONS
|
|
70674
|
+
};
|
|
70675
|
+
function loadDocuments(input, options = {}) {
|
|
70676
|
+
const opts = {
|
|
70677
|
+
...DEFAULT_LOAD_OPTIONS,
|
|
70678
|
+
...options
|
|
70860
70679
|
};
|
|
70861
|
-
|
|
70862
|
-
|
|
70863
|
-
|
|
70864
|
-
|
|
70865
|
-
|
|
70866
|
-
|
|
70680
|
+
const source = String(input);
|
|
70681
|
+
const PARSER_OPT_KEYS = Object.keys(DEFAULT_PARSER_OPTIONS);
|
|
70682
|
+
const CONSTRUCTOR_OPT_KEYS = Object.keys(DEFAULT_CONSTRUCTOR_OPTIONS);
|
|
70683
|
+
return constructFromEvents(parseEvents(source, pick(opts, PARSER_OPT_KEYS)), {
|
|
70684
|
+
...pick(opts, CONSTRUCTOR_OPT_KEYS),
|
|
70685
|
+
source
|
|
70686
|
+
});
|
|
70687
|
+
}
|
|
70688
|
+
function load(input, options) {
|
|
70689
|
+
const documents = loadDocuments(input, options);
|
|
70690
|
+
if (documents.length === 0) throw new YAMLException("expected a document, but the input is empty");
|
|
70691
|
+
if (documents.length === 1) return documents[0];
|
|
70692
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
70693
|
+
}
|
|
70694
|
+
//#endregion
|
|
70695
|
+
//#region src/dump.ts
|
|
70696
|
+
YAML11_SCHEMA.withTags({
|
|
70697
|
+
...intYaml11Tag,
|
|
70698
|
+
resolve: (source, isExplicit, tagName) => {
|
|
70699
|
+
const result = intYaml11Tag.resolve(source, isExplicit, tagName);
|
|
70700
|
+
return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
70701
|
+
}
|
|
70702
|
+
}, {
|
|
70703
|
+
...floatYaml11Tag,
|
|
70704
|
+
resolve: (source, isExplicit, tagName) => {
|
|
70705
|
+
const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
|
|
70706
|
+
return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
70707
|
+
}
|
|
70708
|
+
});
|
|
70867
70709
|
|
|
70868
70710
|
function autoTag() {
|
|
70869
70711
|
return transform;
|
|
@@ -70899,7 +70741,7 @@ function transform(tree, file) {
|
|
|
70899
70741
|
|
|
70900
70742
|
function tagFile(node, file) {
|
|
70901
70743
|
|
|
70902
|
-
const config =
|
|
70744
|
+
const config = load(node.value);
|
|
70903
70745
|
|
|
70904
70746
|
file.data.meta = Object.assign({
|
|
70905
70747
|
og: true,
|