js-yaml
Version:
YAML 1.2 parser and serializer
1 lines • 174 kB
Source Map (JSON)
{"version":3,"file":"js-yaml.mjs","names":["yaml"],"sources":["../lib/common.js","../lib/exception.js","../lib/snippet.js","../lib/type.js","../lib/schema.js","../lib/type/str.js","../lib/type/seq.js","../lib/type/map.js","../lib/schema/failsafe.js","../lib/type/null.js","../lib/type/bool.js","../lib/type/int.js","../lib/type/float.js","../lib/schema/json.js","../lib/schema/core.js","../lib/type/timestamp.js","../lib/type/merge.js","../lib/type/binary.js","../lib/type/omap.js","../lib/type/pairs.js","../lib/type/set.js","../lib/schema/default.js","../lib/loader.js","../lib/dumper.js","../index.js","../lib/index_vite_proxy.tmp.mjs"],"sourcesContent":["'use strict'\n\nfunction isNothing (subject) {\n return (typeof subject === 'undefined') || (subject === null)\n}\n\nfunction isObject (subject) {\n return (typeof subject === 'object') && (subject !== null)\n}\n\nfunction toArray (sequence) {\n if (Array.isArray(sequence)) return sequence\n else if (isNothing(sequence)) return []\n\n return [sequence]\n}\n\nfunction extend (target, source) {\n if (source) {\n const sourceKeys = Object.keys(source)\n\n for (let index = 0, length = sourceKeys.length; index < length; index += 1) {\n const key = sourceKeys[index]\n target[key] = source[key]\n }\n }\n\n return target\n}\n\nfunction repeat (string, count) {\n let result = ''\n\n for (let cycle = 0; cycle < count; cycle += 1) {\n result += string\n }\n\n return result\n}\n\nfunction isNegativeZero (number) {\n return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number)\n}\n\nmodule.exports.isNothing = isNothing\nmodule.exports.isObject = isObject\nmodule.exports.toArray = toArray\nmodule.exports.repeat = repeat\nmodule.exports.isNegativeZero = isNegativeZero\nmodule.exports.extend = extend\n","// YAML error class. http://stackoverflow.com/questions/8458984\n//\n'use strict'\n\nfunction formatError (exception, compact) {\n let where = ''\n const message = exception.reason || '(unknown reason)'\n\n if (!exception.mark) return message\n\n if (exception.mark.name) {\n where += 'in \"' + exception.mark.name + '\" '\n }\n\n where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')'\n\n if (!compact && exception.mark.snippet) {\n where += '\\n\\n' + exception.mark.snippet\n }\n\n return message + ' ' + where\n}\n\nfunction YAMLException (reason, mark) {\n // Super constructor\n Error.call(this)\n\n this.name = 'YAMLException'\n this.reason = reason\n this.mark = mark\n this.message = formatError(this, false)\n\n // Include stack trace in error object\n if (Error.captureStackTrace) {\n // Chrome and NodeJS\n Error.captureStackTrace(this, this.constructor)\n } else {\n // FF, IE 10+ and Safari 6+. Fallback for others\n this.stack = (new Error()).stack || ''\n }\n}\n\n// Inherit from Error\nYAMLException.prototype = Object.create(Error.prototype)\nYAMLException.prototype.constructor = YAMLException\n\nYAMLException.prototype.toString = function toString (compact) {\n return this.name + ': ' + formatError(this, compact)\n}\n\nmodule.exports = YAMLException\n","'use strict'\n\nconst common = require('./common')\n\n// get snippet for a single line, respecting maxLength\nfunction getLine (buffer, lineStart, lineEnd, position, maxLineLength) {\n let head = ''\n let tail = ''\n const maxHalfLength = Math.floor(maxLineLength / 2) - 1\n\n if (position - lineStart > maxHalfLength) {\n head = ' ... '\n lineStart = position - maxHalfLength + head.length\n }\n\n if (lineEnd - position > maxHalfLength) {\n tail = ' ...'\n lineEnd = position + maxHalfLength - tail.length\n }\n\n return {\n str: head + buffer.slice(lineStart, lineEnd).replace(/\\t/g, '→') + tail,\n pos: position - lineStart + head.length // relative position\n }\n}\n\nfunction padStart (string, max) {\n return common.repeat(' ', max - string.length) + string\n}\n\nfunction makeSnippet (mark, options) {\n options = Object.create(options || null)\n\n if (!mark.buffer) return null\n\n if (!options.maxLength) options.maxLength = 79\n if (typeof options.indent !== 'number') options.indent = 1\n if (typeof options.linesBefore !== 'number') options.linesBefore = 3\n if (typeof options.linesAfter !== 'number') options.linesAfter = 2\n\n const re = /\\r?\\n|\\r|\\0/g\n const lineStarts = [0]\n const lineEnds = []\n let match\n let foundLineNo = -1\n\n while ((match = re.exec(mark.buffer))) {\n lineEnds.push(match.index)\n lineStarts.push(match.index + match[0].length)\n\n if (mark.position <= match.index && foundLineNo < 0) {\n foundLineNo = lineStarts.length - 2\n }\n }\n\n if (foundLineNo < 0) foundLineNo = lineStarts.length - 1\n\n let result = ''\n const lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length\n const maxLineLength = options.maxLength - (options.indent + lineNoLength + 3)\n\n for (let i = 1; i <= options.linesBefore; i++) {\n if (foundLineNo - i < 0) break\n const line = getLine(\n mark.buffer,\n lineStarts[foundLineNo - i],\n lineEnds[foundLineNo - i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),\n maxLineLength\n )\n result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n' + result\n }\n\n const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength)\n result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n'\n result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\\n'\n\n for (let i = 1; i <= options.linesAfter; i++) {\n if (foundLineNo + i >= lineEnds.length) break\n const line = getLine(\n mark.buffer,\n lineStarts[foundLineNo + i],\n lineEnds[foundLineNo + i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),\n maxLineLength\n )\n result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n'\n }\n\n return result.replace(/\\n$/, '')\n}\n\nmodule.exports = makeSnippet\n","'use strict'\n\nconst YAMLException = require('./exception')\n\nconst TYPE_CONSTRUCTOR_OPTIONS = [\n 'kind',\n 'multi',\n 'resolve',\n 'construct',\n 'instanceOf',\n 'predicate',\n 'represent',\n 'representName',\n 'defaultStyle',\n 'styleAliases'\n]\n\nconst YAML_NODE_KINDS = [\n 'scalar',\n 'sequence',\n 'mapping'\n]\n\nfunction compileStyleAliases (map) {\n const result = {}\n\n if (map !== null) {\n Object.keys(map).forEach(function (style) {\n map[style].forEach(function (alias) {\n result[String(alias)] = style\n })\n })\n }\n\n return result\n}\n\nfunction Type (tag, options) {\n options = options || {}\n\n Object.keys(options).forEach(function (name) {\n if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {\n throw new YAMLException('Unknown option \"' + name + '\" is met in definition of \"' + tag + '\" YAML type.')\n }\n })\n\n // TODO: Add tag format check.\n this.options = options // keep original options in case user wants to extend this type later\n this.tag = tag\n this.kind = options['kind'] || null\n this.resolve = options['resolve'] || function () { return true }\n this.construct = options['construct'] || function (data) { return data }\n this.instanceOf = options['instanceOf'] || null\n this.predicate = options['predicate'] || null\n this.represent = options['represent'] || null\n this.representName = options['representName'] || null\n this.defaultStyle = options['defaultStyle'] || null\n this.multi = options['multi'] || false\n this.styleAliases = compileStyleAliases(options['styleAliases'] || null)\n\n if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {\n throw new YAMLException('Unknown kind \"' + this.kind + '\" is specified for \"' + tag + '\" YAML type.')\n }\n}\n\nmodule.exports = Type\n","'use strict'\n\nconst YAMLException = require('./exception')\nconst Type = require('./type')\n\nfunction compileList (schema, name) {\n const result = []\n\n schema[name].forEach(function (currentType) {\n let newIndex = result.length\n\n result.forEach(function (previousType, previousIndex) {\n if (previousType.tag === currentType.tag &&\n previousType.kind === currentType.kind &&\n previousType.multi === currentType.multi) {\n newIndex = previousIndex\n }\n })\n\n result[newIndex] = currentType\n })\n\n return result\n}\n\nfunction compileMap (/* lists... */) {\n const result = {\n scalar: {},\n sequence: {},\n mapping: {},\n fallback: {},\n multi: {\n scalar: [],\n sequence: [],\n mapping: [],\n fallback: []\n }\n }\n function collectType (type) {\n if (type.multi) {\n result.multi[type.kind].push(type)\n result.multi['fallback'].push(type)\n } else {\n result[type.kind][type.tag] = result['fallback'][type.tag] = type\n }\n }\n\n for (let index = 0, length = arguments.length; index < length; index += 1) {\n arguments[index].forEach(collectType)\n }\n return result\n}\n\nfunction Schema (definition) {\n return this.extend(definition)\n}\n\nSchema.prototype.extend = function extend (definition) {\n let implicit = []\n let explicit = []\n\n if (definition instanceof Type) {\n // Schema.extend(type)\n explicit.push(definition)\n } else if (Array.isArray(definition)) {\n // Schema.extend([ type1, type2, ... ])\n explicit = explicit.concat(definition)\n } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {\n // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })\n if (definition.implicit) implicit = implicit.concat(definition.implicit)\n if (definition.explicit) explicit = explicit.concat(definition.explicit)\n } else {\n throw new YAMLException('Schema.extend argument should be a Type, [ Type ], ' +\n 'or a schema definition ({ implicit: [...], explicit: [...] })')\n }\n\n implicit.forEach(function (type) {\n if (!(type instanceof Type)) {\n throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.')\n }\n\n if (type.loadKind && type.loadKind !== 'scalar') {\n throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.')\n }\n\n if (type.multi) {\n throw new YAMLException('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.')\n }\n })\n\n explicit.forEach(function (type) {\n if (!(type instanceof Type)) {\n throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.')\n }\n })\n\n const result = Object.create(Schema.prototype)\n\n result.implicit = (this.implicit || []).concat(implicit)\n result.explicit = (this.explicit || []).concat(explicit)\n\n result.compiledImplicit = compileList(result, 'implicit')\n result.compiledExplicit = compileList(result, 'explicit')\n result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit)\n\n return result\n}\n\nmodule.exports = Schema\n","'use strict'\n\nconst Type = require('../type')\n\nmodule.exports = new Type('tag:yaml.org,2002:str', {\n kind: 'scalar',\n construct: function (data) { return data !== null ? data : '' }\n})\n","'use strict'\n\nconst Type = require('../type')\n\nmodule.exports = new Type('tag:yaml.org,2002:seq', {\n kind: 'sequence',\n construct: function (data) { return data !== null ? data : [] }\n})\n","'use strict'\n\nconst Type = require('../type')\n\nmodule.exports = new Type('tag:yaml.org,2002:map', {\n kind: 'mapping',\n construct: function (data) { return data !== null ? data : {} }\n})\n","// Standard YAML's Failsafe schema.\n// http://www.yaml.org/spec/1.2/spec.html#id2802346\n\n'use strict'\n\nconst Schema = require('../schema')\n\nmodule.exports = new Schema({\n explicit: [\n require('../type/str'),\n require('../type/seq'),\n require('../type/map')\n ]\n})\n","'use strict'\n\nconst Type = require('../type')\n\nfunction resolveYamlNull (data) {\n if (data === null) return true\n\n const max = data.length\n\n return (max === 1 && data === '~') ||\n (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'))\n}\n\nfunction constructYamlNull () {\n return null\n}\n\nfunction isNull (object) {\n return object === null\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:null', {\n kind: 'scalar',\n resolve: resolveYamlNull,\n construct: constructYamlNull,\n predicate: isNull,\n represent: {\n canonical: function () { return '~' },\n lowercase: function () { return 'null' },\n uppercase: function () { return 'NULL' },\n camelcase: function () { return 'Null' },\n empty: function () { return '' }\n },\n defaultStyle: 'lowercase'\n})\n","'use strict'\n\nconst Type = require('../type')\n\nfunction resolveYamlBoolean (data) {\n if (data === null) return false\n\n const max = data.length\n\n return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||\n (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'))\n}\n\nfunction constructYamlBoolean (data) {\n return data === 'true' ||\n data === 'True' ||\n data === 'TRUE'\n}\n\nfunction isBoolean (object) {\n return Object.prototype.toString.call(object) === '[object Boolean]'\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:bool', {\n kind: 'scalar',\n resolve: resolveYamlBoolean,\n construct: constructYamlBoolean,\n predicate: isBoolean,\n represent: {\n lowercase: function (object) { return object ? 'true' : 'false' },\n uppercase: function (object) { return object ? 'TRUE' : 'FALSE' },\n camelcase: function (object) { return object ? 'True' : 'False' }\n },\n defaultStyle: 'lowercase'\n})\n","'use strict'\n\nconst common = require('../common')\nconst Type = require('../type')\n\nfunction isHexCode (c) {\n return ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) ||\n ((c >= 0x41/* A */) && (c <= 0x46/* F */)) ||\n ((c >= 0x61/* a */) && (c <= 0x66/* f */))\n}\n\nfunction isOctCode (c) {\n return ((c >= 0x30/* 0 */) && (c <= 0x37/* 7 */))\n}\n\nfunction isDecCode (c) {\n return ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */))\n}\n\nfunction resolveYamlInteger (data) {\n if (data === null) return false\n\n const max = data.length\n let index = 0\n let hasDigits = false\n\n if (!max) return false\n\n let ch = data[index]\n\n // sign\n if (ch === '-' || ch === '+') {\n ch = data[++index]\n }\n\n if (ch === '0') {\n // 0\n if (index + 1 === max) return true\n ch = data[++index]\n\n // base 2, base 8, base 16\n\n if (ch === 'b') {\n // base 2\n index++\n\n for (; index < max; index++) {\n ch = data[index]\n if (ch !== '0' && ch !== '1') return false\n hasDigits = true\n }\n return hasDigits && Number.isFinite(parseYamlInteger(data))\n }\n\n if (ch === 'x') {\n // base 16\n index++\n\n for (; index < max; index++) {\n if (!isHexCode(data.charCodeAt(index))) return false\n hasDigits = true\n }\n return hasDigits && Number.isFinite(parseYamlInteger(data))\n }\n\n if (ch === 'o') {\n // base 8\n index++\n\n for (; index < max; index++) {\n if (!isOctCode(data.charCodeAt(index))) return false\n hasDigits = true\n }\n return hasDigits && Number.isFinite(parseYamlInteger(data))\n }\n }\n\n // base 10 (except 0)\n\n for (; index < max; index++) {\n if (!isDecCode(data.charCodeAt(index))) {\n return false\n }\n hasDigits = true\n }\n\n if (!hasDigits) return false\n\n return Number.isFinite(parseYamlInteger(data))\n}\n\nfunction parseYamlInteger (data) {\n let value = data\n let sign = 1\n\n let ch = value[0]\n\n if (ch === '-' || ch === '+') {\n if (ch === '-') sign = -1\n value = value.slice(1)\n ch = value[0]\n }\n\n if (value === '0') return 0\n\n if (ch === '0') {\n if (value[1] === 'b') return sign * parseInt(value.slice(2), 2)\n if (value[1] === 'x') return sign * parseInt(value.slice(2), 16)\n if (value[1] === 'o') return sign * parseInt(value.slice(2), 8)\n }\n\n return sign * parseInt(value, 10)\n}\n\nfunction constructYamlInteger (data) {\n return parseYamlInteger(data)\n}\n\nfunction isInteger (object) {\n return (Object.prototype.toString.call(object)) === '[object Number]' &&\n (object % 1 === 0 && !common.isNegativeZero(object))\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:int', {\n kind: 'scalar',\n resolve: resolveYamlInteger,\n construct: constructYamlInteger,\n predicate: isInteger,\n represent: {\n binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1) },\n octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1) },\n decimal: function (obj) { return obj.toString(10) },\n hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1) }\n },\n defaultStyle: 'decimal',\n styleAliases: {\n binary: [2, 'bin'],\n octal: [8, 'oct'],\n decimal: [10, 'dec'],\n hexadecimal: [16, 'hex']\n }\n})\n","'use strict'\n\nconst common = require('../common')\nconst Type = require('../type')\n\nconst YAML_FLOAT_PATTERN = new RegExp(\n // 2.5e4, 2.5 and integers\n '^(?:[-+]?(?:[0-9]+)(?:\\\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?' +\n // .2e4, .2\n // special case, seems not from spec\n '|\\\\.[0-9]+(?:[eE][-+]?[0-9]+)?' +\n // .inf\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$')\n\nconst YAML_FLOAT_SPECIAL_PATTERN = new RegExp(\n '^(?:' +\n // .inf\n '[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$')\n\nfunction resolveYamlFloat (data) {\n if (data === null) return false\n\n if (!YAML_FLOAT_PATTERN.test(data)) {\n return false\n }\n\n if (Number.isFinite(parseFloat(data, 10))) {\n return true\n }\n\n return YAML_FLOAT_SPECIAL_PATTERN.test(data)\n}\n\nfunction constructYamlFloat (data) {\n let value = data.toLowerCase()\n const sign = value[0] === '-' ? -1 : 1\n\n if ('+-'.indexOf(value[0]) >= 0) {\n value = value.slice(1)\n }\n\n if (value === '.inf') {\n return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n } else if (value === '.nan') {\n return NaN\n }\n return sign * parseFloat(value, 10)\n}\n\nconst SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/\n\nfunction representYamlFloat (object, style) {\n if (isNaN(object)) {\n switch (style) {\n case 'lowercase': return '.nan'\n case 'uppercase': return '.NAN'\n case 'camelcase': return '.NaN'\n }\n } else if (Number.POSITIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '.inf'\n case 'uppercase': return '.INF'\n case 'camelcase': return '.Inf'\n }\n } else if (Number.NEGATIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '-.inf'\n case 'uppercase': return '-.INF'\n case 'camelcase': return '-.Inf'\n }\n } else if (common.isNegativeZero(object)) {\n return '-0.0'\n }\n\n const res = object.toString(10)\n\n // JS stringifier can build scientific format without dots: 5e-100,\n // while YAML requres dot: 5.e-100. Fix it with simple hack\n\n return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res\n}\n\nfunction isFloat (object) {\n return (Object.prototype.toString.call(object) === '[object Number]') &&\n (object % 1 !== 0 || common.isNegativeZero(object))\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:float', {\n kind: 'scalar',\n resolve: resolveYamlFloat,\n construct: constructYamlFloat,\n predicate: isFloat,\n represent: representYamlFloat,\n defaultStyle: 'lowercase'\n})\n","// Standard YAML's JSON schema.\n// http://www.yaml.org/spec/1.2/spec.html#id2803231\n//\n// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.\n// So, this schema is not such strict as defined in the YAML specification.\n// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.\n\n'use strict'\n\nmodule.exports = require('./failsafe').extend({\n implicit: [\n require('../type/null'),\n require('../type/bool'),\n require('../type/int'),\n require('../type/float')\n ]\n})\n","// Standard YAML's Core schema.\n// http://www.yaml.org/spec/1.2/spec.html#id2804923\n//\n// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.\n// So, Core schema has no distinctions from JSON schema is JS-YAML.\n\n'use strict'\n\nmodule.exports = require('./json')\n","'use strict'\n\nconst Type = require('../type')\n\nconst YAML_DATE_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9])' + // [2] month\n '-([0-9][0-9])$') // [3] day\n\nconst YAML_TIMESTAMP_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9]?)' + // [2] month\n '-([0-9][0-9]?)' + // [3] day\n '(?:[Tt]|[ \\\\t]+)' + // ...\n '([0-9][0-9]?)' + // [4] hour\n ':([0-9][0-9])' + // [5] minute\n ':([0-9][0-9])' + // [6] second\n '(?:\\\\.([0-9]*))?' + // [7] fraction\n '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tzHour\n '(?::([0-9][0-9]))?))?$') // [11] tzMinute\n\nfunction resolveYamlTimestamp (data) {\n if (data === null) return false\n if (YAML_DATE_REGEXP.exec(data) !== null) return true\n if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true\n return false\n}\n\nfunction constructYamlTimestamp (data) {\n let fraction = 0\n let delta = null\n\n let match = YAML_DATE_REGEXP.exec(data)\n if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data)\n\n if (match === null) throw new Error('Date resolve error')\n\n // match: [1] year [2] month [3] day\n\n const year = +(match[1])\n const month = +(match[2]) - 1 // JS month starts with 0\n const day = +(match[3])\n\n if (!match[4]) { // no hour\n return new Date(Date.UTC(year, month, day))\n }\n\n // match: [4] hour [5] minute [6] second [7] fraction\n\n const hour = +(match[4])\n const minute = +(match[5])\n const second = +(match[6])\n\n if (match[7]) {\n fraction = match[7].slice(0, 3)\n while (fraction.length < 3) { // milli-seconds\n fraction += '0'\n }\n fraction = +fraction\n }\n\n // match: [8] tz [9] tz_sign [10] tzHour [11] tzMinute\n\n if (match[9]) {\n const tzHour = +(match[10])\n const tzMinute = +(match[11] || 0)\n delta = (tzHour * 60 + tzMinute) * 60000 // delta in mili-seconds\n if (match[9] === '-') delta = -delta\n }\n\n const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction))\n\n if (delta) date.setTime(date.getTime() - delta)\n\n return date\n}\n\nfunction representYamlTimestamp (object /*, style */) {\n return object.toISOString()\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:timestamp', {\n kind: 'scalar',\n resolve: resolveYamlTimestamp,\n construct: constructYamlTimestamp,\n instanceOf: Date,\n represent: representYamlTimestamp\n})\n","'use strict'\n\nconst Type = require('../type')\n\nfunction resolveYamlMerge (data) {\n return data === '<<' || data === null\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:merge', {\n kind: 'scalar',\n resolve: resolveYamlMerge\n})\n","'use strict'\n\nconst Type = require('../type')\n\n// [ 64, 65, 66 ] -> [ padding, CR, LF ]\nconst BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\\n\\r'\n\nfunction resolveYamlBinary (data) {\n if (data === null) return false\n\n let bitlen = 0\n const max = data.length\n const map = BASE64_MAP\n\n // Convert one by one.\n for (let idx = 0; idx < max; idx++) {\n const code = map.indexOf(data.charAt(idx))\n\n // Skip CR/LF\n if (code > 64) continue\n\n // Fail on illegal characters\n if (code < 0) return false\n\n bitlen += 6\n }\n\n // If there are any bits left, source was corrupted\n return (bitlen % 8) === 0\n}\n\nfunction constructYamlBinary (data) {\n const input = data.replace(/[\\r\\n=]/g, '') // remove CR/LF & padding to simplify scan\n const max = input.length\n const map = BASE64_MAP\n let bits = 0\n const result = []\n\n // Collect by 6*4 bits (3 bytes)\n\n for (let idx = 0; idx < max; idx++) {\n if ((idx % 4 === 0) && idx) {\n result.push((bits >> 16) & 0xFF)\n result.push((bits >> 8) & 0xFF)\n result.push(bits & 0xFF)\n }\n\n bits = (bits << 6) | map.indexOf(input.charAt(idx))\n }\n\n // Dump tail\n\n const tailbits = (max % 4) * 6\n\n if (tailbits === 0) {\n result.push((bits >> 16) & 0xFF)\n result.push((bits >> 8) & 0xFF)\n result.push(bits & 0xFF)\n } else if (tailbits === 18) {\n result.push((bits >> 10) & 0xFF)\n result.push((bits >> 2) & 0xFF)\n } else if (tailbits === 12) {\n result.push((bits >> 4) & 0xFF)\n }\n\n return new Uint8Array(result)\n}\n\nfunction representYamlBinary (object /*, style */) {\n let result = ''\n let bits = 0\n const max = object.length\n const map = BASE64_MAP\n\n // Convert every three bytes to 4 ASCII characters.\n\n for (let idx = 0; idx < max; idx++) {\n if ((idx % 3 === 0) && idx) {\n result += map[(bits >> 18) & 0x3F]\n result += map[(bits >> 12) & 0x3F]\n result += map[(bits >> 6) & 0x3F]\n result += map[bits & 0x3F]\n }\n\n bits = (bits << 8) + object[idx]\n }\n\n // Dump tail\n\n const tail = max % 3\n\n if (tail === 0) {\n result += map[(bits >> 18) & 0x3F]\n result += map[(bits >> 12) & 0x3F]\n result += map[(bits >> 6) & 0x3F]\n result += map[bits & 0x3F]\n } else if (tail === 2) {\n result += map[(bits >> 10) & 0x3F]\n result += map[(bits >> 4) & 0x3F]\n result += map[(bits << 2) & 0x3F]\n result += map[64]\n } else if (tail === 1) {\n result += map[(bits >> 2) & 0x3F]\n result += map[(bits << 4) & 0x3F]\n result += map[64]\n result += map[64]\n }\n\n return result\n}\n\nfunction isBinary (obj) {\n return Object.prototype.toString.call(obj) === '[object Uint8Array]'\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:binary', {\n kind: 'scalar',\n resolve: resolveYamlBinary,\n construct: constructYamlBinary,\n predicate: isBinary,\n represent: representYamlBinary\n})\n","'use strict'\n\nconst Type = require('../type')\n\nconst _hasOwnProperty = Object.prototype.hasOwnProperty\nconst _toString = Object.prototype.toString\n\nfunction resolveYamlOmap (data) {\n if (data === null) return true\n\n const objectKeys = []\n const object = data\n\n for (let index = 0, length = object.length; index < length; index += 1) {\n const pair = object[index]\n let pairHasKey = false\n\n if (_toString.call(pair) !== '[object Object]') return false\n\n let pairKey\n for (pairKey in pair) {\n if (_hasOwnProperty.call(pair, pairKey)) {\n if (!pairHasKey) pairHasKey = true\n else return false\n }\n }\n\n if (!pairHasKey) return false\n\n if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey)\n else return false\n }\n\n return true\n}\n\nfunction constructYamlOmap (data) {\n return data !== null ? data : []\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:omap', {\n kind: 'sequence',\n resolve: resolveYamlOmap,\n construct: constructYamlOmap\n})\n","'use strict'\n\nconst Type = require('../type')\n\nconst _toString = Object.prototype.toString\n\nfunction resolveYamlPairs (data) {\n if (data === null) return true\n\n const object = data\n\n const result = new Array(object.length)\n\n for (let index = 0, length = object.length; index < length; index += 1) {\n const pair = object[index]\n\n if (_toString.call(pair) !== '[object Object]') return false\n\n const keys = Object.keys(pair)\n\n if (keys.length !== 1) return false\n\n result[index] = [keys[0], pair[keys[0]]]\n }\n\n return true\n}\n\nfunction constructYamlPairs (data) {\n if (data === null) return []\n\n const object = data\n const result = new Array(object.length)\n\n for (let index = 0, length = object.length; index < length; index += 1) {\n const pair = object[index]\n\n const keys = Object.keys(pair)\n\n result[index] = [keys[0], pair[keys[0]]]\n }\n\n return result\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:pairs', {\n kind: 'sequence',\n resolve: resolveYamlPairs,\n construct: constructYamlPairs\n})\n","'use strict'\n\nconst Type = require('../type')\n\nconst _hasOwnProperty = Object.prototype.hasOwnProperty\n\nfunction resolveYamlSet (data) {\n if (data === null) return true\n\n const object = data\n\n for (const key in object) {\n if (_hasOwnProperty.call(object, key)) {\n if (object[key] !== null) return false\n }\n }\n\n return true\n}\n\nfunction constructYamlSet (data) {\n return data !== null ? data : {}\n}\n\nmodule.exports = new Type('tag:yaml.org,2002:set', {\n kind: 'mapping',\n resolve: resolveYamlSet,\n construct: constructYamlSet\n})\n","// JS-YAML's default schema for `safeLoad` function.\n// It is not described in the YAML specification.\n//\n// This schema is based on standard YAML's Core schema and includes most of\n// extra types described at YAML tag repository. (http://yaml.org/type/)\n\n'use strict'\n\nmodule.exports = require('./core').extend({\n implicit: [\n require('../type/timestamp'),\n require('../type/merge')\n ],\n explicit: [\n require('../type/binary'),\n require('../type/omap'),\n require('../type/pairs'),\n require('../type/set')\n ]\n})\n","'use strict'\n\nconst common = require('./common')\nconst YAMLException = require('./exception')\nconst makeSnippet = require('./snippet')\nconst DEFAULT_SCHEMA = require('./schema/default')\n\nconst _hasOwnProperty = Object.prototype.hasOwnProperty\n\nconst CONTEXT_FLOW_IN = 1\nconst CONTEXT_FLOW_OUT = 2\nconst CONTEXT_BLOCK_IN = 3\nconst CONTEXT_BLOCK_OUT = 4\n\nconst CHOMPING_CLIP = 1\nconst CHOMPING_STRIP = 2\nconst CHOMPING_KEEP = 3\n\n// eslint-disable-next-line no-control-regex\nconst PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/\nconst PATTERN_NON_ASCII_LINE_BREAKS = /[\\x85\\u2028\\u2029]/\n// eslint-disable-next-line no-useless-escape\nconst PATTERN_FLOW_INDICATORS = /[,\\[\\]{}]/\n// eslint-disable-next-line no-useless-escape\nconst PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/\n// eslint-disable-next-line no-useless-escape\nconst PATTERN_TAG_URI = /^(?:!|[^,\\[\\]{}])(?:%[0-9a-f]{2}|[0-9a-z\\-#;/?:@&=+$,_.!~*'()\\[\\]])*$/i\n\nfunction _class (obj) { return Object.prototype.toString.call(obj) }\n\nfunction isEol (c) {\n return (c === 0x0A/* LF */) || (c === 0x0D/* CR */)\n}\n\nfunction isWhiteSpace (c) {\n return (c === 0x09/* Tab */) || (c === 0x20/* Space */)\n}\n\nfunction isWsOrEol (c) {\n return (c === 0x09/* Tab */) ||\n (c === 0x20/* Space */) ||\n (c === 0x0A/* LF */) ||\n (c === 0x0D/* CR */)\n}\n\nfunction isFlowIndicator (c) {\n return c === 0x2C/* , */ ||\n c === 0x5B/* [ */ ||\n c === 0x5D/* ] */ ||\n c === 0x7B/* { */ ||\n c === 0x7D/* } */\n}\n\nfunction fromHexCode (c) {\n if ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) {\n return c - 0x30\n }\n\n const lc = c | 0x20\n\n if ((lc >= 0x61/* a */) && (lc <= 0x66/* f */)) {\n return lc - 0x61 + 10\n }\n\n return -1\n}\n\nfunction escapedHexLen (c) {\n if (c === 0x78/* x */) { return 2 }\n if (c === 0x75/* u */) { return 4 }\n if (c === 0x55/* U */) { return 8 }\n return 0\n}\n\nfunction fromDecimalCode (c) {\n if ((c >= 0x30/* 0 */) && (c <= 0x39/* 9 */)) {\n return c - 0x30\n }\n\n return -1\n}\n\nfunction simpleEscapeSequence (c) {\n switch (c) {\n case 0x30/* 0 */: return '\\x00'\n case 0x61/* a */: return '\\x07'\n case 0x62/* b */: return '\\x08'\n case 0x74/* t */: return '\\x09'\n case 0x09/* Tab */: return '\\x09'\n case 0x6E/* n */: return '\\x0A'\n case 0x76/* v */: return '\\x0B'\n case 0x66/* f */: return '\\x0C'\n case 0x72/* r */: return '\\x0D'\n case 0x65/* e */: return '\\x1B'\n case 0x20/* Space */: return ' '\n case 0x22/* \" */: return '\\x22'\n case 0x2F/* / */: return '/'\n case 0x5C/* \\ */: return '\\x5C'\n case 0x4E/* N */: return '\\x85'\n case 0x5F/* _ */: return '\\xA0'\n case 0x4C/* L */: return '\\u2028'\n case 0x50/* P */: return '\\u2029'\n default: return ''\n }\n}\n\nfunction charFromCodepoint (c) {\n if (c <= 0xFFFF) {\n return String.fromCharCode(c)\n }\n // Encode UTF-16 surrogate pair\n // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF\n return String.fromCharCode(\n ((c - 0x010000) >> 10) + 0xD800,\n ((c - 0x010000) & 0x03FF) + 0xDC00\n )\n}\n\n// set a property of a literal object, while protecting against prototype pollution,\n// see https://github.com/nodeca/js-yaml/issues/164 for more details\nfunction setProperty (object, key, value) {\n // used for this specific key only because Object.defineProperty is slow\n if (key === '__proto__') {\n Object.defineProperty(object, key, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: value\n })\n } else {\n object[key] = value\n }\n}\n\nconst simpleEscapeCheck = new Array(256) // integer, for fast access\nconst simpleEscapeMap = new Array(256)\nfor (let i = 0; i < 256; i++) {\n simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0\n simpleEscapeMap[i] = simpleEscapeSequence(i)\n}\n\nfunction State (input, options) {\n this.input = input\n\n this.filename = options['filename'] || null\n this.schema = options['schema'] || DEFAULT_SCHEMA\n this.onWarning = options['onWarning'] || null\n // (Hidden) Remove? makes the loader to expect YAML 1.1 documents\n // if such documents have no explicit %YAML directive\n this.legacy = options['legacy'] || false\n\n this.json = options['json'] || false\n this.listener = options['listener'] || null\n this.maxDepth = typeof options['maxDepth'] === 'number' ? options['maxDepth'] : 100\n this.maxMergeSeqLength = typeof options['maxMergeSeqLength'] === 'number' ? options['maxMergeSeqLength'] : 20\n\n this.implicitTypes = this.schema.compiledImplicit\n this.typeMap = this.schema.compiledTypeMap\n\n this.length = input.length\n this.position = 0\n this.line = 0\n this.lineStart = 0\n this.lineIndent = 0\n this.depth = 0\n\n // position of first leading tab in the current line,\n // used to make sure there are no tabs in the indentation\n this.firstTabInLine = -1\n\n this.documents = []\n this.anchorMapTransactions = []\n\n /*\n this.version;\n this.checkLineBreaks;\n this.tagMap;\n this.anchorMap;\n this.tag;\n this.anchor;\n this.kind;\n this.result; */\n}\n\nfunction generateError (state, message) {\n const mark = {\n name: state.filename,\n buffer: state.input.slice(0, -1), // omit trailing \\0\n position: state.position,\n line: state.line,\n column: state.position - state.lineStart\n }\n\n mark.snippet = makeSnippet(mark)\n\n return new YAMLException(message, mark)\n}\n\nfunction throwError (state, message) {\n throw generateError(state, message)\n}\n\nfunction throwWarning (state, message) {\n if (state.onWarning) {\n state.onWarning.call(null, generateError(state, message))\n }\n}\n\nfunction storeAnchor (state, name, value) {\n const transactions = state.anchorMapTransactions\n\n if (transactions.length !== 0) {\n const transaction = transactions[transactions.length - 1]\n\n if (!_hasOwnProperty.call(transaction, name)) {\n transaction[name] = {\n existed: _hasOwnProperty.call(state.anchorMap, name),\n value: state.anchorMap[name]\n }\n }\n }\n\n state.anchorMap[name] = value\n}\n\nfunction beginAnchorTransaction (state) {\n state.anchorMapTransactions.push(Object.create(null))\n}\n\nfunction commitAnchorTransaction (state) {\n const transaction = state.anchorMapTransactions.pop()\n const transactions = state.anchorMapTransactions\n\n if (transactions.length === 0) return\n\n const parent = transactions[transactions.length - 1]\n const names = Object.keys(transaction)\n\n for (let index = 0, length = names.length; index < length; index += 1) {\n const name = names[index]\n\n if (!_hasOwnProperty.call(parent, name)) {\n parent[name] = transaction[name]\n }\n }\n}\n\nfunction rollbackAnchorTransaction (state) {\n const transaction = state.anchorMapTransactions.pop()\n const names = Object.keys(transaction)\n\n for (let index = names.length - 1; index >= 0; index -= 1) {\n const entry = transaction[names[index]]\n\n if (entry.existed) {\n state.anchorMap[names[index]] = entry.value\n } else {\n delete state.anchorMap[names[index]]\n }\n }\n}\n\nfunction snapshotState (state) {\n return {\n position: state.position,\n line: state.line,\n lineStart: state.lineStart,\n lineIndent: state.lineIndent,\n firstTabInLine: state.firstTabInLine,\n tag: state.tag,\n anchor: state.anchor,\n kind: state.kind,\n result: state.result\n }\n}\n\nfunction restoreState (state, snapshot) {\n state.position = snapshot.position\n state.line = snapshot.line\n state.lineStart = snapshot.lineStart\n state.lineIndent = snapshot.lineIndent\n state.firstTabInLine = snapshot.firstTabInLine\n state.tag = snapshot.tag\n state.anchor = snapshot.anchor\n state.kind = snapshot.kind\n state.result = snapshot.result\n}\n\nconst directiveHandlers = {\n\n YAML: function handleYamlDirective (state, name, args) {\n if (state.version !== null) {\n throwError(state, 'duplication of %YAML directive')\n }\n\n if (args.length !== 1) {\n throwError(state, 'YAML directive accepts exactly one argument')\n }\n\n const match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0])\n\n if (match === null) {\n throwError(state, 'ill-formed argument of the YAML directive')\n }\n\n const major = parseInt(match[1], 10)\n const minor = parseInt(match[2], 10)\n\n if (major !== 1) {\n throwError(state, 'unacceptable YAML version of the document')\n }\n\n state.version = args[0]\n state.checkLineBreaks = (minor < 2)\n\n if (minor !== 1 && minor !== 2) {\n throwWarning(state, 'unsupported YAML version of the document')\n }\n },\n\n TAG: function handleTagDirective (state, name, args) {\n let prefix\n\n if (args.length !== 2) {\n throwError(state, 'TAG directive accepts exactly two arguments')\n }\n\n const handle = args[0]\n prefix = args[1]\n\n if (!PATTERN_TAG_HANDLE.test(handle)) {\n throwError(state, 'ill-formed tag handle (first argument) of the TAG directive')\n }\n\n if (_hasOwnProperty.call(state.tagMap, handle)) {\n throwError(state, 'there is a previously declared suffix for \"' + handle + '\" tag handle')\n }\n\n if (!PATTERN_TAG_URI.test(prefix)) {\n throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive')\n }\n\n try {\n prefix = decodeURIComponent(prefix)\n } catch (err) {\n throwError(state, 'tag prefix is malformed: ' + prefix)\n }\n\n state.tagMap[handle] = prefix\n }\n}\n\nfunction captureSegment (state, start, end, checkJson) {\n if (start < end) {\n const _result = state.input.slice(start, end)\n\n if (checkJson) {\n for (let _position = 0, _length = _result.length; _position < _length; _position += 1) {\n const _character = _result.charCodeAt(_position)\n if (!(_character === 0x09 ||\n (_character >= 0x20 && _character <= 0x10FFFF))) {\n throwError(state, 'expected valid JSON character')\n }\n }\n } else if (PATTERN_NON_PRINTABLE.test(_result)) {\n throwError(state, 'the stream contains non-printable characters')\n }\n\n state.result += _result\n }\n}\n\nfunction mergeMappings (state, destination, source, overridableKeys) {\n if (!common.isObject(source)) {\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable')\n }\n\n const sourceKeys = Object.keys(source)\n\n for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {\n const key = sourceKeys[index]\n\n if (!_hasOwnProperty.call(destination, key)) {\n setProperty(destination, key, source[key])\n overridableKeys[key] = true\n }\n }\n}\n\nfunction storeMappingPair (state, _result, overridableKeys, keyTag, keyNode, valueNode,\n startLine, startLineStart, startPos) {\n // The output is a plain object here, so keys can only be strings.\n // We need to convert keyNode to a string, but doing so can hang the process\n // (deeply nested arrays that explode exponentially using aliases).\n if (Array.isArray(keyNode)) {\n keyNode = Array.prototype.slice.call(keyNode)\n\n for (let index = 0, quantity = keyNode.length; index < quantity; index += 1) {\n if (Array.isArray(keyNode[index])) {\n throwError(state, 'nested arrays are not supported inside keys')\n }\n\n if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {\n keyNode[index] = '[object Object]'\n }\n }\n }\n\n // Avoid code execution in load() via toString property\n // (still use its own toString for arrays, timestamps,\n // and whatever user schema extensions happen to have @@toStringTag)\n if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {\n keyNode = '[object Object]'\n }\n\n keyNode = String(keyNode)\n\n if (_result === null) {\n _result = {}\n }\n\n if (keyTag === 'tag:yaml.org,2002:merge') {\n if (Array.isArray(valueNode)) {\n if (valueNode.length > state.maxMergeSeqLength) {\n throwError(state, 'merge sequence length exceeded maxMergeSeqLength (' + state.maxMergeSeqLength + ')')\n }\n const seen = new Set()\n for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {\n const src = valueNode[index]\n // Existing keys are not overridden on merge, so dedupe sources to\n // avoid redundant work on repeated aliases.\n if (seen.has(src)) continue\n seen.add(src)\n mergeMappings(state, _result, src, overridableKeys)\n }\n } else {\n mergeMappings(state, _result, valueNode, overridableKeys)\n }\n } else {\n if (!state.json &&\n !_hasOwnProperty.call(overridableKeys, keyNode) &&\n _hasOwnProperty.call(_result, keyNode)) {\n state.line = startLine || state.line\n state.lineStart = startLineStart || state.lineStart\n state.position = startPos || state.position\n throwError(state, 'duplicated mapping key')\n }\n\n setProperty(_result, keyNode, valueNode)\n delete overridableKeys[keyNode]\n }\n\n return _result\n}\n\nfunction readLineBreak (state) {\n const ch = state.input.charCodeAt(state.position)\n\n if (ch === 0x0A/* LF */) {\n state.position++\n } else if (ch === 0x0D/* CR */) {\n state.position++\n if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {\n state.position++\n }\n } else {\n throwError(state, 'a line break is expected')\n }\n\n state.line += 1\n state.lineStart = state.position\n state.firstTabInLine = -1\n}\n\nfunction skipSeparationSpace (state, allowComments, checkIndent) {\n let lineBreaks = 0\n let ch = state.input.charCodeAt(state.position)\n\n while (ch !== 0) {\n while (isWhiteSpace(ch)) {\n if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {\n state.firstTabInLine = state.position\n }\n ch = state.input.charCodeAt(++state.position)\n }\n\n if (allowComments && ch === 0x23/* # */) {\n do {\n ch = state.input.charCodeAt(++state.position)\n } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0)\n }\n\n if (isEol(ch)) {\n readLineBreak(state)\n\n ch = state.input.charCodeAt(state.position)\n lineBreaks++\n state.lineIndent = 0\n\n while (ch === 0x20/* Space */) {\n state.lineIndent++\n ch = state.input.charCodeAt(++state.position)\n }\n } else {\n break\n }\n }\n\n if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {\n throwWarning(state, 'deficient indentation')\n }\n\n return lineBreaks\n}\n\nfunction testDocumentSeparator (state) {\n let _position = state.position\n let ch = state.input.charCodeAt(_position)\n\n // Condition state.position === state.lineStart is tested\n // in parent on each call, for efficiency. No needs to test here again.\n if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&\n ch === state.input.charCodeAt(_position + 1) &&\n ch === state.input.charCodeAt(_position + 2)) {\n _position += 3\n\n ch = state.input.charCodeAt(_position)\n\n if (ch === 0 || isWsOrEol(ch)) {\n return true\n }\n }\n\n return false\n}\n\nfunction writeFoldedLines (state, count) {\n if (count === 1) {\n state.result += ' '\n } else if (count > 1) {\n state.result += common.repeat('\\n', count - 1)\n }\n}\n\nfunction readPlainScalar (state, nodeIndent, withinFlowCollection) {\n let captureStart\n let captureEnd\n let hasPendingContent\n let _line\n let _lineStart\n let _lineIndent\n const _kind = state.kind\n const _result = state.result\n\n let ch = state.input.charCodeAt(state.position)\n\n if (isWsOrEol(ch) ||\n isFlowIndicator(ch) ||\n ch === 0x23/* # */ ||\n ch === 0x26/* & */ ||\n ch === 0x2A/* * */ ||\n ch === 0x21/* ! */ ||\n ch === 0x7C/* | */ ||\n ch === 0x3E/* > */ ||\n ch === 0x27/* ' */ ||\n ch === 0x22/* \" */ ||\n ch === 0x25/* % */ ||\n ch === 0x40/* @ */ ||\n ch === 0x60/* ` */) {\n return false\n }\n\n if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {\n const following = state.input.charCodeAt(state.position + 1)\n\n if (isWsOrEol(following) ||\n (withinFlowCollection && isFlowIndicator(following))) {\n return false\n }\n }\n\n state.kind = 'scalar'\n state.result = ''\n captureStart = captureEnd = state.position\n hasPendingContent = false\n\n while (ch !== 0) {\n if (ch === 0x3A/* : */) {\n const following = state.input.charCodeAt(state.position + 1)\n\n if (isWsOrEol(following) ||\n (withinFlowCollection && isFlowIndicator(following))) {\n break\n }\n } else if (ch === 0x23/* # */) {\n const preceding = state.input.charCodeAt(state.position - 1)\n\n if (isWsOrEol(preceding)) {\n break\n }\n } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||\n (withinFlowCollection && isFlowIndicator(ch))) {\n break\n } else if (isEol(ch)) {\n _line = state.line\n _lineStart = state.lineStart\n _lineIndent = state.lineIndent\n skipSeparationSpace(state, false, -1)\n\n if (state.lineIndent >= nodeIndent) {\n hasPendingContent = true\n ch = state.input.charCodeAt(state.position)\n continue\n } else {\n state.position = captureEnd\n state.line = _line\n state.lineStart = _lineStart\n state.lineIndent = _lineIndent\n break\n }\n }\n\n if (hasPendingContent) {\n captureSegment(state, captureStart, captureEnd, false)\n writeFoldedLines(state, state.line - _line)\n captureStart = captureEnd = state.position\n hasPendingContent = false\n }\n\n if (!isWhiteSpace(ch)) {\n captureEnd = state.position + 1\n }\n\n ch = state.input.charCodeAt(++state.position)\n }\n\n captureSegment(state, captureStart, captureEnd, false)\n\n if (state.result) {\n return true\n }\n\n state.kind = _kind\n state.result = _result\n return false\n}\n\nfunction readSingleQuotedScalar (state, nodeIndent) {\n let captureStart\n let captureEnd\n\n let ch = state.input.charCodeAt(state.position)\n\n if (ch !== 0x27/* ' */) {\n return false\n }\n\n state.kind = 'scalar'\n state.result = ''\n state.position++\n captureStart = captureEnd = state.position\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n if (ch === 0x27/* ' */) {\n captureSegment(state, captureStart, state.position, true)\n ch = state.input.charCodeAt(++state.position)\n\n if (ch === 0x27/* ' */) {\n captureStart = state.position\n state.position++\n captureEnd = state.position\n } else {\n return true\n }\n } else if (isEol(ch)) {\n captureSegment(state, captureStart, captureEnd, true)\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent))\n captureStart = captureEnd = state.position\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a single quoted scalar')\n } else {\n state.position++\n if (!isWhiteSpace(ch)) {\n captureEnd = state.position\n }\n }\n }\n\n throwError(state, 'unexpected end of the stream within a single quoted scalar')\n}\n\nfunction readDoubleQuotedScalar (state, nodeIndent) {\n let captureStart\n let captureEnd\n let tmp\n\n let ch = st