@yarnpkg/parsers
Advanced tools
Comparing version 2.0.0-rc.8 to 2.0.0-rc.9
@@ -6,9 +6,7 @@ /* | ||
*/ | ||
"use strict"; | ||
function peg$subclass(child, parent) { | ||
function ctor() { | ||
this.constructor = child; | ||
} | ||
function ctor() { this.constructor = child; } | ||
ctor.prototype = parent.prototype; | ||
@@ -19,7 +17,7 @@ child.prototype = new ctor(); | ||
function peg$SyntaxError(message, expected, found, location) { | ||
this.message = message; | ||
this.message = message; | ||
this.expected = expected; | ||
this.found = found; | ||
this.found = found; | ||
this.location = location; | ||
this.name = "SyntaxError"; | ||
this.name = "SyntaxError"; | ||
@@ -33,24 +31,32 @@ if (typeof Error.captureStackTrace === "function") { | ||
peg$SyntaxError.buildMessage = function (expected, found) { | ||
peg$SyntaxError.buildMessage = function(expected, found) { | ||
var DESCRIBE_EXPECTATION_FNS = { | ||
literal: function (expectation) { | ||
literal: function(expectation) { | ||
return `"${literalEscape(expectation.text)}"`; | ||
}, | ||
"class": function (expectation) { | ||
"class": function(expectation) { | ||
var escapedParts = "", | ||
i; | ||
i; | ||
for (i = 0; i < expectation.parts.length; i++) escapedParts += expectation.parts[i] instanceof Array ? `${classEscape(expectation.parts[i][0])}-${classEscape(expectation.parts[i][1])}` : classEscape(expectation.parts[i]); | ||
for (i = 0; i < expectation.parts.length; i++) | ||
escapedParts += expectation.parts[i] instanceof Array | ||
? `${classEscape(expectation.parts[i][0])}-${classEscape(expectation.parts[i][1])}` | ||
: classEscape(expectation.parts[i]); | ||
return `[${expectation.inverted ? "^" : ""}${escapedParts}]`; | ||
}, | ||
any: function (expectation) { | ||
any: function(expectation) { | ||
return "any character"; | ||
}, | ||
end: function (expectation) { | ||
end: function(expectation) { | ||
return "end of input"; | ||
}, | ||
other: function (expectation) { | ||
other: function(expectation) { | ||
return expectation.description; | ||
} | ||
}, | ||
}; | ||
@@ -63,15 +69,25 @@ | ||
function literalEscape(s) { | ||
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { | ||
return `\\x0${hex(ch)}`; | ||
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { | ||
return `\\x${hex(ch)}`; | ||
}); | ||
return s | ||
.replace(/\\/g, '\\\\') | ||
.replace(/"/g, '\\"') | ||
.replace(/\0/g, '\\0') | ||
.replace(/\t/g, '\\t') | ||
.replace(/\n/g, '\\n') | ||
.replace(/\r/g, '\\r') | ||
.replace(/[\x00-\x0F]/g, function(ch) { return `\\x0${hex(ch)}`; }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return `\\x${hex(ch)}`; }); | ||
} | ||
function classEscape(s) { | ||
return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { | ||
return `\\x0${hex(ch)}`; | ||
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { | ||
return `\\x${hex(ch)}`; | ||
}); | ||
return s | ||
.replace(/\\/g, '\\\\') | ||
.replace(/\]/g, '\\]') | ||
.replace(/\^/g, '\\^') | ||
.replace(/-/g, '\\-') | ||
.replace(/\0/g, '\\0') | ||
.replace(/\t/g, '\\t') | ||
.replace(/\n/g, '\\n') | ||
.replace(/\r/g, '\\r') | ||
.replace(/[\x00-\x0F]/g, function(ch) { return `\\x0${hex(ch)}`; }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return `\\x${hex(ch)}`; }); | ||
} | ||
@@ -85,7 +101,8 @@ | ||
var descriptions = new Array(expected.length), | ||
i, | ||
j; | ||
i, j; | ||
for (i = 0; i < expected.length; i++) descriptions[i] = describeExpectation(expected[i]); | ||
for (i = 0; i < expected.length; i++) | ||
descriptions[i] = describeExpectation(expected[i]); | ||
descriptions.sort(); | ||
@@ -100,3 +117,2 @@ | ||
} | ||
descriptions.length = j; | ||
@@ -113,3 +129,5 @@ } | ||
default: | ||
return `${descriptions.slice(0, -1).join(", ")}, or ${descriptions[descriptions.length - 1]}`; | ||
return `${descriptions.slice(0, -1).join(", ") | ||
}, or ${ | ||
descriptions[descriptions.length - 1]}`; | ||
} | ||
@@ -129,52 +147,34 @@ } | ||
var peg$FAILED = {}, | ||
peg$startRuleFunctions = { | ||
resolution: peg$parseresolution | ||
}, | ||
peg$startRuleFunction = peg$parseresolution, | ||
peg$c0 = "/", | ||
peg$c1 = peg$literalExpectation("/", false), | ||
peg$c2 = function (from, descriptor) { | ||
return { | ||
from, | ||
descriptor | ||
}; | ||
}, | ||
peg$c3 = function (descriptor) { | ||
return { | ||
descriptor | ||
}; | ||
}, | ||
peg$c4 = "@", | ||
peg$c5 = peg$literalExpectation("@", false), | ||
peg$c6 = function (fullName, description) { | ||
return { | ||
fullName, | ||
description | ||
}; | ||
}, | ||
peg$c7 = function (fullName) { | ||
return { | ||
fullName | ||
}; | ||
}, | ||
peg$c8 = function () { | ||
return text(); | ||
}, | ||
peg$c9 = /^[^\/@]/, | ||
peg$c10 = peg$classExpectation(["/", "@"], true, false), | ||
peg$c11 = /^[^\/]/, | ||
peg$c12 = peg$classExpectation(["/"], true, false), | ||
peg$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{ | ||
line: 1, | ||
column: 1 | ||
}], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
peg$startRuleFunctions = {resolution: peg$parseresolution}, | ||
peg$startRuleFunction = peg$parseresolution, | ||
peg$c0 = "/", | ||
peg$c1 = peg$literalExpectation("/", false), | ||
peg$c2 = function(from, descriptor) { return {from, descriptor}; }, | ||
peg$c3 = function(descriptor) { return {descriptor}; }, | ||
peg$c4 = "@", | ||
peg$c5 = peg$literalExpectation("@", false), | ||
peg$c6 = function(fullName, description) { return {fullName, description}; }, | ||
peg$c7 = function(fullName) { return {fullName}; }, | ||
peg$c8 = function() { return text(); }, | ||
peg$c9 = /^[^\/@]/, | ||
peg$c10 = peg$classExpectation(["/", "@"], true, false), | ||
peg$c11 = /^[^\/]/, | ||
peg$c12 = peg$classExpectation(["/"], true, false), | ||
peg$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{line: 1, column: 1}], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
if ("startRule" in options) { | ||
if (!(options.startRule in peg$startRuleFunctions)) throw new Error(`Can't start parsing from rule "${options.startRule}".`); | ||
if (!(options.startRule in peg$startRuleFunctions)) | ||
throw new Error(`Can't start parsing from rule "${options.startRule}".`); | ||
peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; | ||
@@ -185,18 +185,24 @@ } | ||
return input.substring(peg$savedPos, peg$currPos); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function location() { | ||
return peg$computeLocation(peg$savedPos, peg$currPos); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function expected(description, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
throw peg$buildStructuredError( | ||
[peg$otherExpectation(description)], | ||
input.substring(peg$savedPos, peg$currPos), | ||
location | ||
); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function error(message, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
throw peg$buildSimpleError(message, location); | ||
@@ -206,41 +212,24 @@ } | ||
function peg$literalExpectation(text, ignoreCase) { | ||
return { | ||
type: "literal", | ||
text: text, | ||
ignoreCase: ignoreCase | ||
}; | ||
return {type: "literal", text: text, ignoreCase: ignoreCase}; | ||
} | ||
function peg$classExpectation(parts, inverted, ignoreCase) { | ||
return { | ||
type: "class", | ||
parts: parts, | ||
inverted: inverted, | ||
ignoreCase: ignoreCase | ||
}; | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
return {type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase}; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function peg$anyExpectation() { | ||
return { | ||
type: "any" | ||
}; | ||
return {type: "any"}; | ||
} | ||
function peg$endExpectation() { | ||
return { | ||
type: "end" | ||
}; | ||
return {type: "end"}; | ||
} | ||
function peg$otherExpectation(description) { | ||
return { | ||
type: "other", | ||
description: description | ||
}; | ||
return {type: "other", description: description}; | ||
} | ||
function peg$computePosDetails(pos) { | ||
var details = peg$posDetailsCache[pos], | ||
p; | ||
var details = peg$posDetailsCache[pos], p; | ||
@@ -251,9 +240,10 @@ if (details) { | ||
p = pos - 1; | ||
while (!peg$posDetailsCache[p]) | ||
p--; | ||
while (!peg$posDetailsCache[p]) p--; | ||
details = peg$posDetailsCache[p]; | ||
details = { | ||
line: details.line, | ||
column: details.column | ||
line: details.line, | ||
column: details.column, | ||
}; | ||
@@ -279,14 +269,15 @@ | ||
var startPosDetails = peg$computePosDetails(startPos), | ||
endPosDetails = peg$computePosDetails(endPos); | ||
endPosDetails = peg$computePosDetails(endPos); | ||
return { | ||
start: { | ||
offset: startPos, | ||
line: startPosDetails.line, | ||
column: startPosDetails.column | ||
line: startPosDetails.line, | ||
column: startPosDetails.column, | ||
}, | ||
end: { | ||
offset: endPos, | ||
line: endPosDetails.line, | ||
column: endPosDetails.column | ||
} | ||
line: endPosDetails.line, | ||
column: endPosDetails.column, | ||
}, | ||
}; | ||
@@ -296,3 +287,3 @@ } | ||
function peg$fail(expected) { | ||
if (peg$currPos < peg$maxFailPos) return; | ||
if (peg$currPos < peg$maxFailPos) return; | ||
@@ -312,3 +303,8 @@ if (peg$currPos > peg$maxFailPos) { | ||
function peg$buildStructuredError(expected, found, location) { | ||
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); | ||
return new peg$SyntaxError( | ||
peg$SyntaxError.buildMessage(expected, found), | ||
expected, | ||
found, | ||
location | ||
); | ||
} | ||
@@ -318,5 +314,5 @@ | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
s1 = peg$parsespecifier(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -328,11 +324,6 @@ if (input.charCodeAt(peg$currPos) === 47) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c1); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c1); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parsespecifier(); | ||
if (s3 !== peg$FAILED) { | ||
@@ -354,7 +345,5 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parsespecifier(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -364,3 +353,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -374,5 +362,5 @@ } | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
s1 = peg$parsefullName(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -384,11 +372,6 @@ if (input.charCodeAt(peg$currPos) === 64) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c5); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c5); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parsedescription(); | ||
if (s3 !== peg$FAILED) { | ||
@@ -410,7 +393,5 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parsefullName(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -420,3 +401,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -430,4 +410,4 @@ } | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 64) { | ||
@@ -438,11 +418,6 @@ s1 = peg$c4; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c5); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c5); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseident(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -454,11 +429,6 @@ if (input.charCodeAt(peg$currPos) === 47) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c1); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c1); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseident(); | ||
if (s4 !== peg$FAILED) { | ||
@@ -484,7 +454,5 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseident(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -494,3 +462,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -504,5 +471,5 @@ } | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (peg$c9.test(input.charAt(peg$currPos))) { | ||
@@ -513,12 +480,7 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c10); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c10); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c9.test(input.charAt(peg$currPos))) { | ||
@@ -529,6 +491,3 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c10); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c10); } | ||
} | ||
@@ -539,3 +498,2 @@ } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -545,4 +503,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -553,5 +511,5 @@ } | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (peg$c11.test(input.charAt(peg$currPos))) { | ||
@@ -562,12 +520,7 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c12); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c12); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c11.test(input.charAt(peg$currPos))) { | ||
@@ -578,6 +531,3 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c12); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c12); } | ||
} | ||
@@ -588,3 +538,2 @@ } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -594,4 +543,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -605,4 +554,13 @@ } | ||
} else { | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) peg$fail(peg$endExpectation()); | ||
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) | ||
peg$fail(peg$endExpectation()); | ||
throw peg$buildStructuredError( | ||
peg$maxFailExpected, | ||
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, | ||
peg$maxFailPos < input.length | ||
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) | ||
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos) | ||
); | ||
} | ||
@@ -613,3 +571,3 @@ } | ||
SyntaxError: peg$SyntaxError, | ||
parse: peg$parse | ||
}; | ||
parse: peg$parse, | ||
}; |
@@ -6,9 +6,7 @@ /* | ||
*/ | ||
"use strict"; | ||
function peg$subclass(child, parent) { | ||
function ctor() { | ||
this.constructor = child; | ||
} | ||
function ctor() { this.constructor = child; } | ||
ctor.prototype = parent.prototype; | ||
@@ -19,7 +17,7 @@ child.prototype = new ctor(); | ||
function peg$SyntaxError(message, expected, found, location) { | ||
this.message = message; | ||
this.message = message; | ||
this.expected = expected; | ||
this.found = found; | ||
this.found = found; | ||
this.location = location; | ||
this.name = "SyntaxError"; | ||
this.name = "SyntaxError"; | ||
@@ -33,24 +31,32 @@ if (typeof Error.captureStackTrace === "function") { | ||
peg$SyntaxError.buildMessage = function (expected, found) { | ||
peg$SyntaxError.buildMessage = function(expected, found) { | ||
var DESCRIBE_EXPECTATION_FNS = { | ||
literal: function (expectation) { | ||
literal: function(expectation) { | ||
return `"${literalEscape(expectation.text)}"`; | ||
}, | ||
"class": function (expectation) { | ||
"class": function(expectation) { | ||
var escapedParts = "", | ||
i; | ||
i; | ||
for (i = 0; i < expectation.parts.length; i++) escapedParts += expectation.parts[i] instanceof Array ? `${classEscape(expectation.parts[i][0])}-${classEscape(expectation.parts[i][1])}` : classEscape(expectation.parts[i]); | ||
for (i = 0; i < expectation.parts.length; i++) | ||
escapedParts += expectation.parts[i] instanceof Array | ||
? `${classEscape(expectation.parts[i][0])}-${classEscape(expectation.parts[i][1])}` | ||
: classEscape(expectation.parts[i]); | ||
return `[${expectation.inverted ? "^" : ""}${escapedParts}]`; | ||
}, | ||
any: function (expectation) { | ||
any: function(expectation) { | ||
return "any character"; | ||
}, | ||
end: function (expectation) { | ||
end: function(expectation) { | ||
return "end of input"; | ||
}, | ||
other: function (expectation) { | ||
other: function(expectation) { | ||
return expectation.description; | ||
} | ||
}, | ||
}; | ||
@@ -63,15 +69,25 @@ | ||
function literalEscape(s) { | ||
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { | ||
return `\\x0${hex(ch)}`; | ||
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { | ||
return `\\x${hex(ch)}`; | ||
}); | ||
return s | ||
.replace(/\\/g, '\\\\') | ||
.replace(/"/g, '\\"') | ||
.replace(/\0/g, '\\0') | ||
.replace(/\t/g, '\\t') | ||
.replace(/\n/g, '\\n') | ||
.replace(/\r/g, '\\r') | ||
.replace(/[\x00-\x0F]/g, function(ch) { return `\\x0${hex(ch)}`; }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return `\\x${hex(ch)}`; }); | ||
} | ||
function classEscape(s) { | ||
return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { | ||
return `\\x0${hex(ch)}`; | ||
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { | ||
return `\\x${hex(ch)}`; | ||
}); | ||
return s | ||
.replace(/\\/g, '\\\\') | ||
.replace(/\]/g, '\\]') | ||
.replace(/\^/g, '\\^') | ||
.replace(/-/g, '\\-') | ||
.replace(/\0/g, '\\0') | ||
.replace(/\t/g, '\\t') | ||
.replace(/\n/g, '\\n') | ||
.replace(/\r/g, '\\r') | ||
.replace(/[\x00-\x0F]/g, function(ch) { return `\\x0${hex(ch)}`; }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return `\\x${hex(ch)}`; }); | ||
} | ||
@@ -85,7 +101,8 @@ | ||
var descriptions = new Array(expected.length), | ||
i, | ||
j; | ||
i, j; | ||
for (i = 0; i < expected.length; i++) descriptions[i] = describeExpectation(expected[i]); | ||
for (i = 0; i < expected.length; i++) | ||
descriptions[i] = describeExpectation(expected[i]); | ||
descriptions.sort(); | ||
@@ -100,3 +117,2 @@ | ||
} | ||
descriptions.length = j; | ||
@@ -113,3 +129,5 @@ } | ||
default: | ||
return `${descriptions.slice(0, -1).join(", ")}, or ${descriptions[descriptions.length - 1]}`; | ||
return `${descriptions.slice(0, -1).join(", ") | ||
}, or ${ | ||
descriptions[descriptions.length - 1]}`; | ||
} | ||
@@ -129,233 +147,107 @@ } | ||
var peg$FAILED = {}, | ||
peg$startRuleFunctions = { | ||
Start: peg$parseStart | ||
}, | ||
peg$startRuleFunction = peg$parseStart, | ||
peg$c0 = function (line) { | ||
return line ? line : []; | ||
}, | ||
peg$c1 = function (main, then) { | ||
return [main].concat(then || []); | ||
}, | ||
peg$c2 = ";", | ||
peg$c3 = peg$literalExpectation(";", false), | ||
peg$c4 = function (then) { | ||
return then; | ||
}, | ||
peg$c5 = function (chain, then) { | ||
return then ? { | ||
chain, | ||
then | ||
} : { | ||
chain | ||
}; | ||
}, | ||
peg$c6 = function (type, then) { | ||
return { | ||
type, | ||
line: then | ||
}; | ||
}, | ||
peg$c7 = "&&", | ||
peg$c8 = peg$literalExpectation("&&", false), | ||
peg$c9 = "||", | ||
peg$c10 = peg$literalExpectation("||", false), | ||
peg$c11 = function (main, then) { | ||
return then ? { ...main, | ||
then | ||
} : main; | ||
}, | ||
peg$c12 = function (type, then) { | ||
return { | ||
type, | ||
chain: then | ||
}; | ||
}, | ||
peg$c13 = "|&", | ||
peg$c14 = peg$literalExpectation("|&", false), | ||
peg$c15 = "|", | ||
peg$c16 = peg$literalExpectation("|", false), | ||
peg$c17 = "=", | ||
peg$c18 = peg$literalExpectation("=", false), | ||
peg$c19 = function (name, arg) { | ||
return { | ||
name, | ||
args: [arg] | ||
}; | ||
}, | ||
peg$c20 = function (name) { | ||
return { | ||
name, | ||
args: [] | ||
}; | ||
}, | ||
peg$c21 = "(", | ||
peg$c22 = peg$literalExpectation("(", false), | ||
peg$c23 = ")", | ||
peg$c24 = peg$literalExpectation(")", false), | ||
peg$c25 = function (subshell) { | ||
return { | ||
type: `subshell`, | ||
subshell | ||
}; | ||
}, | ||
peg$c26 = function (envs, args) { | ||
return { | ||
type: `command`, | ||
args, | ||
envs | ||
}; | ||
}, | ||
peg$c27 = function (envs) { | ||
return { | ||
type: `envs`, | ||
envs | ||
}; | ||
}, | ||
peg$c28 = function (args) { | ||
return args; | ||
}, | ||
peg$c29 = ">>", | ||
peg$c30 = peg$literalExpectation(">>", false), | ||
peg$c31 = ">", | ||
peg$c32 = peg$literalExpectation(">", false), | ||
peg$c33 = "<<<", | ||
peg$c34 = peg$literalExpectation("<<<", false), | ||
peg$c35 = "<", | ||
peg$c36 = peg$literalExpectation("<", false), | ||
peg$c37 = function (redirect, arg) { | ||
return { | ||
type: `redirection`, | ||
subtype: redirect, | ||
args: [arg] | ||
}; | ||
}, | ||
peg$c38 = function (arg) { | ||
return arg; | ||
}, | ||
peg$c39 = function (segments) { | ||
return { | ||
type: `argument`, | ||
segments: [].concat(...segments) | ||
}; | ||
}, | ||
peg$c40 = function (string) { | ||
return string; | ||
}, | ||
peg$c41 = "'", | ||
peg$c42 = peg$literalExpectation("'", false), | ||
peg$c43 = function (text) { | ||
return [{ | ||
type: `text`, | ||
text | ||
}]; | ||
}, | ||
peg$c44 = "\"", | ||
peg$c45 = peg$literalExpectation("\"", false), | ||
peg$c46 = function (segments) { | ||
return segments; | ||
}, | ||
peg$c47 = function (shell) { | ||
return { | ||
type: `shell`, | ||
shell, | ||
quoted: true | ||
}; | ||
}, | ||
peg$c48 = function (variable) { | ||
return { | ||
type: `variable`, | ||
...variable, | ||
quoted: true | ||
}; | ||
}, | ||
peg$c49 = function (text) { | ||
return { | ||
type: `text`, | ||
text | ||
}; | ||
}, | ||
peg$c50 = function (shell) { | ||
return { | ||
type: `shell`, | ||
shell, | ||
quoted: false | ||
}; | ||
}, | ||
peg$c51 = function (variable) { | ||
return { | ||
type: `variable`, | ||
...variable, | ||
quoted: false | ||
}; | ||
}, | ||
peg$c52 = "\\", | ||
peg$c53 = peg$literalExpectation("\\", false), | ||
peg$c54 = peg$anyExpectation(), | ||
peg$c55 = function (c) { | ||
return c; | ||
}, | ||
peg$c56 = /^[^']/, | ||
peg$c57 = peg$classExpectation(["'"], true, false), | ||
peg$c58 = function (chars) { | ||
return chars.join(``); | ||
}, | ||
peg$c59 = /^[^$"]/, | ||
peg$c60 = peg$classExpectation(["$", "\""], true, false), | ||
peg$c61 = "$(", | ||
peg$c62 = peg$literalExpectation("$(", false), | ||
peg$c63 = function (command) { | ||
return command; | ||
}, | ||
peg$c64 = "${", | ||
peg$c65 = peg$literalExpectation("${", false), | ||
peg$c66 = ":-", | ||
peg$c67 = peg$literalExpectation(":-", false), | ||
peg$c68 = "}", | ||
peg$c69 = peg$literalExpectation("}", false), | ||
peg$c70 = function (name, arg) { | ||
return { | ||
name, | ||
defaultValue: arg | ||
}; | ||
}, | ||
peg$c71 = ":-}", | ||
peg$c72 = peg$literalExpectation(":-}", false), | ||
peg$c73 = function (name) { | ||
return { | ||
name, | ||
defaultValue: [] | ||
}; | ||
}, | ||
peg$c74 = function (name) { | ||
return { | ||
name | ||
}; | ||
}, | ||
peg$c75 = "$", | ||
peg$c76 = peg$literalExpectation("$", false), | ||
peg$c77 = /^[a-zA-Z0-9_]/, | ||
peg$c78 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false), | ||
peg$c79 = function () { | ||
return text(); | ||
}, | ||
peg$c80 = /^[@*?#a-zA-Z0-9_\-]/, | ||
peg$c81 = peg$classExpectation(["@", "*", "?", "#", ["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false), | ||
peg$c82 = /^[(){}<>$|&; \t"']/, | ||
peg$c83 = peg$classExpectation(["(", ")", "{", "}", "<", ">", "$", "|", "&", ";", " ", "\t", "\"", "'"], false, false), | ||
peg$c84 = /^[ \t]/, | ||
peg$c85 = peg$classExpectation([" ", "\t"], false, false), | ||
peg$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{ | ||
line: 1, | ||
column: 1 | ||
}], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
peg$startRuleFunctions = {Start: peg$parseStart}, | ||
peg$startRuleFunction = peg$parseStart, | ||
peg$c0 = function(line) { return line ? line : []; }, | ||
peg$c1 = function(main, then) { return [main].concat(then || []); }, | ||
peg$c2 = ";", | ||
peg$c3 = peg$literalExpectation(";", false), | ||
peg$c4 = function(then) { return then; }, | ||
peg$c5 = function(chain, then) { return then ? {chain, then} : {chain}; }, | ||
peg$c6 = function(type, then) { return {type, line: then}; }, | ||
peg$c7 = "&&", | ||
peg$c8 = peg$literalExpectation("&&", false), | ||
peg$c9 = "||", | ||
peg$c10 = peg$literalExpectation("||", false), | ||
peg$c11 = function(main, then) { return then ? {...main, then} : main; }, | ||
peg$c12 = function(type, then) { return {type, chain: then}; }, | ||
peg$c13 = "|&", | ||
peg$c14 = peg$literalExpectation("|&", false), | ||
peg$c15 = "|", | ||
peg$c16 = peg$literalExpectation("|", false), | ||
peg$c17 = "=", | ||
peg$c18 = peg$literalExpectation("=", false), | ||
peg$c19 = function(name, arg) { return {name, args: [arg]}; }, | ||
peg$c20 = function(name) { return {name, args: []}; }, | ||
peg$c21 = "(", | ||
peg$c22 = peg$literalExpectation("(", false), | ||
peg$c23 = ")", | ||
peg$c24 = peg$literalExpectation(")", false), | ||
peg$c25 = function(subshell) { return {type: `subshell`, subshell}; }, | ||
peg$c26 = function(envs, args) { return {type: `command`, args, envs}; }, | ||
peg$c27 = function(envs) { return {type: `envs`, envs}; }, | ||
peg$c28 = function(args) { return args; }, | ||
peg$c29 = ">>", | ||
peg$c30 = peg$literalExpectation(">>", false), | ||
peg$c31 = ">", | ||
peg$c32 = peg$literalExpectation(">", false), | ||
peg$c33 = "<<<", | ||
peg$c34 = peg$literalExpectation("<<<", false), | ||
peg$c35 = "<", | ||
peg$c36 = peg$literalExpectation("<", false), | ||
peg$c37 = function(redirect, arg) { return {type: `redirection`, subtype: redirect, args: [arg]}; }, | ||
peg$c38 = function(arg) { return arg; }, | ||
peg$c39 = function(segments) { return {type: `argument`, segments: [].concat(...segments)}; }, | ||
peg$c40 = function(string) { return string; }, | ||
peg$c41 = "'", | ||
peg$c42 = peg$literalExpectation("'", false), | ||
peg$c43 = function(text) { return [{type: `text`, text}]; }, | ||
peg$c44 = "\"", | ||
peg$c45 = peg$literalExpectation("\"", false), | ||
peg$c46 = function(segments) { return segments; }, | ||
peg$c47 = function(shell) { return {type: `shell`, shell, quoted: true}; }, | ||
peg$c48 = function(variable) { return {type: `variable`, ...variable, quoted: true}; }, | ||
peg$c49 = function(text) { return {type: `text`, text}; }, | ||
peg$c50 = function(shell) { return {type: `shell`, shell, quoted: false}; }, | ||
peg$c51 = function(variable) { return {type: `variable`, ...variable, quoted: false}; }, | ||
peg$c52 = "\\", | ||
peg$c53 = peg$literalExpectation("\\", false), | ||
peg$c54 = peg$anyExpectation(), | ||
peg$c55 = function(c) { return c; }, | ||
peg$c56 = /^[^']/, | ||
peg$c57 = peg$classExpectation(["'"], true, false), | ||
peg$c58 = function(chars) { return chars.join(``); }, | ||
peg$c59 = /^[^$"]/, | ||
peg$c60 = peg$classExpectation(["$", "\""], true, false), | ||
peg$c61 = "$(", | ||
peg$c62 = peg$literalExpectation("$(", false), | ||
peg$c63 = function(command) { return command; }, | ||
peg$c64 = "${", | ||
peg$c65 = peg$literalExpectation("${", false), | ||
peg$c66 = ":-", | ||
peg$c67 = peg$literalExpectation(":-", false), | ||
peg$c68 = "}", | ||
peg$c69 = peg$literalExpectation("}", false), | ||
peg$c70 = function(name, arg) { return {name, defaultValue: arg}; }, | ||
peg$c71 = ":-}", | ||
peg$c72 = peg$literalExpectation(":-}", false), | ||
peg$c73 = function(name) { return {name, defaultValue: []}; }, | ||
peg$c74 = function(name) { return {name}; }, | ||
peg$c75 = "$", | ||
peg$c76 = peg$literalExpectation("$", false), | ||
peg$c77 = /^[a-zA-Z0-9_]/, | ||
peg$c78 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false), | ||
peg$c79 = function() { return text(); }, | ||
peg$c80 = /^[@*?#a-zA-Z0-9_\-]/, | ||
peg$c81 = peg$classExpectation(["@", "*", "?", "#", ["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false), | ||
peg$c82 = /^[(){}<>$|&; \t"']/, | ||
peg$c83 = peg$classExpectation(["(", ")", "{", "}", "<", ">", "$", "|", "&", ";", " ", "\t", "\"", "'"], false, false), | ||
peg$c84 = /^[ \t]/, | ||
peg$c85 = peg$classExpectation([" ", "\t"], false, false), | ||
peg$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{line: 1, column: 1}], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
if ("startRule" in options) { | ||
if (!(options.startRule in peg$startRuleFunctions)) throw new Error(`Can't start parsing from rule "${options.startRule}".`); | ||
if (!(options.startRule in peg$startRuleFunctions)) | ||
throw new Error(`Can't start parsing from rule "${options.startRule}".`); | ||
peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; | ||
@@ -366,18 +258,24 @@ } | ||
return input.substring(peg$savedPos, peg$currPos); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function location() { | ||
return peg$computeLocation(peg$savedPos, peg$currPos); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function expected(description, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
throw peg$buildStructuredError( | ||
[peg$otherExpectation(description)], | ||
input.substring(peg$savedPos, peg$currPos), | ||
location | ||
); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function error(message, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
throw peg$buildSimpleError(message, location); | ||
@@ -387,40 +285,23 @@ } | ||
function peg$literalExpectation(text, ignoreCase) { | ||
return { | ||
type: "literal", | ||
text: text, | ||
ignoreCase: ignoreCase | ||
}; | ||
return {type: "literal", text: text, ignoreCase: ignoreCase}; | ||
} | ||
function peg$classExpectation(parts, inverted, ignoreCase) { | ||
return { | ||
type: "class", | ||
parts: parts, | ||
inverted: inverted, | ||
ignoreCase: ignoreCase | ||
}; | ||
return {type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase}; | ||
} | ||
function peg$anyExpectation() { | ||
return { | ||
type: "any" | ||
}; | ||
return {type: "any"}; | ||
} | ||
function peg$endExpectation() { | ||
return { | ||
type: "end" | ||
}; | ||
return {type: "end"}; | ||
} | ||
function peg$otherExpectation(description) { | ||
return { | ||
type: "other", | ||
description: description | ||
}; | ||
return {type: "other", description: description}; | ||
} | ||
function peg$computePosDetails(pos) { | ||
var details = peg$posDetailsCache[pos], | ||
p; | ||
var details = peg$posDetailsCache[pos], p; | ||
@@ -431,9 +312,10 @@ if (details) { | ||
p = pos - 1; | ||
while (!peg$posDetailsCache[p]) | ||
p--; | ||
while (!peg$posDetailsCache[p]) p--; | ||
details = peg$posDetailsCache[p]; | ||
details = { | ||
line: details.line, | ||
column: details.column | ||
line: details.line, | ||
column: details.column, | ||
}; | ||
@@ -459,14 +341,15 @@ | ||
var startPosDetails = peg$computePosDetails(startPos), | ||
endPosDetails = peg$computePosDetails(endPos); | ||
endPosDetails = peg$computePosDetails(endPos); | ||
return { | ||
start: { | ||
offset: startPos, | ||
line: startPosDetails.line, | ||
column: startPosDetails.column | ||
line: startPosDetails.line, | ||
column: startPosDetails.column, | ||
}, | ||
end: { | ||
offset: endPos, | ||
line: endPosDetails.line, | ||
column: endPosDetails.column | ||
} | ||
line: endPosDetails.line, | ||
column: endPosDetails.column, | ||
}, | ||
}; | ||
@@ -476,3 +359,3 @@ } | ||
function peg$fail(expected) { | ||
if (peg$currPos < peg$maxFailPos) return; | ||
if (peg$currPos < peg$maxFailPos) return; | ||
@@ -492,3 +375,8 @@ if (peg$currPos > peg$maxFailPos) { | ||
function peg$buildStructuredError(expected, found, location) { | ||
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); | ||
return new peg$SyntaxError( | ||
peg$SyntaxError.buildMessage(expected, found), | ||
expected, | ||
found, | ||
location | ||
); | ||
} | ||
@@ -498,5 +386,7 @@ | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
s1 = peg$parseShellLine(); | ||
if (s1 === peg$FAILED) s1 = null; | ||
if (s1 === peg$FAILED) | ||
s1 = null; | ||
@@ -507,4 +397,4 @@ if (s1 !== peg$FAILED) { | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -515,8 +405,9 @@ } | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$parseCommandLine(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseShellLineThen(); | ||
if (s2 === peg$FAILED) s2 = null; | ||
if (s2 === peg$FAILED) | ||
s2 = null; | ||
@@ -541,6 +432,6 @@ if (s2 !== peg$FAILED) { | ||
var s0, s1, s2, s3, s4, s5, s6; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -550,3 +441,2 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -558,12 +448,7 @@ if (input.charCodeAt(peg$currPos) === 59) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c3); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c3); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -573,10 +458,7 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseShellLine(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = []; | ||
s6 = peg$parseS(); | ||
while (s6 !== peg$FAILED) { | ||
@@ -586,3 +468,2 @@ s5.push(s6); | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -618,8 +499,9 @@ peg$savedPos = s0; | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$parseCommandChain(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseCommandLineThen(); | ||
if (s2 === peg$FAILED) s2 = null; | ||
if (s2 === peg$FAILED) | ||
s2 = null; | ||
@@ -644,6 +526,6 @@ if (s2 !== peg$FAILED) { | ||
var s0, s1, s2, s3, s4, s5, s6; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -653,10 +535,7 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseCommandLineType(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -666,10 +545,7 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseCommandLine(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = []; | ||
s6 = peg$parseS(); | ||
while (s6 !== peg$FAILED) { | ||
@@ -679,3 +555,2 @@ s5.push(s6); | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -717,8 +592,4 @@ peg$savedPos = s0; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c8); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c8); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
@@ -730,6 +601,3 @@ if (input.substr(peg$currPos, 2) === peg$c9) { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c10); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c10); } | ||
} | ||
@@ -743,8 +611,9 @@ } | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = peg$parseCommand(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseCommandChainThen(); | ||
if (s2 === peg$FAILED) s2 = null; | ||
if (s2 === peg$FAILED) | ||
s2 = null; | ||
@@ -769,6 +638,6 @@ if (s2 !== peg$FAILED) { | ||
var s0, s1, s2, s3, s4, s5, s6; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -778,10 +647,7 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseCommandChainType(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -791,10 +657,7 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseCommandChain(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = []; | ||
s6 = peg$parseS(); | ||
while (s6 !== peg$FAILED) { | ||
@@ -804,3 +667,2 @@ s5.push(s6); | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -842,8 +704,4 @@ peg$savedPos = s0; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c14); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c14); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
@@ -855,6 +713,3 @@ if (input.charCodeAt(peg$currPos) === 124) { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c16); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
@@ -868,5 +723,5 @@ } | ||
var s0, s1, s2, s3, s4, s5; | ||
s0 = peg$currPos; | ||
s1 = peg$parseEnvVariable(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -878,15 +733,9 @@ if (input.charCodeAt(peg$currPos) === 61) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c18); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseStrictValueArgument(); | ||
if (s3 !== peg$FAILED) { | ||
s4 = []; | ||
s5 = peg$parseS(); | ||
while (s5 !== peg$FAILED) { | ||
@@ -896,3 +745,2 @@ s4.push(s5); | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -918,7 +766,5 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseEnvVariable(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -930,12 +776,7 @@ if (input.charCodeAt(peg$currPos) === 61) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c18); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -945,3 +786,2 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -970,6 +810,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2, s3, s4, s5, s6, s7, s8; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -979,3 +819,2 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -987,12 +826,7 @@ if (input.charCodeAt(peg$currPos) === 40) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c22); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -1002,10 +836,7 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseShellLine(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = []; | ||
s6 = peg$parseS(); | ||
while (s6 !== peg$FAILED) { | ||
@@ -1015,3 +846,2 @@ s5.push(s6); | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -1023,12 +853,7 @@ if (input.charCodeAt(peg$currPos) === 41) { | ||
s6 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c24); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
} | ||
if (s6 !== peg$FAILED) { | ||
s7 = []; | ||
s8 = peg$parseS(); | ||
while (s8 !== peg$FAILED) { | ||
@@ -1038,3 +863,2 @@ s7.push(s8); | ||
} | ||
if (s7 !== peg$FAILED) { | ||
@@ -1072,3 +896,2 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
@@ -1078,3 +901,2 @@ s0 = peg$currPos; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -1084,7 +906,5 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseVariableAssignment(); | ||
while (s3 !== peg$FAILED) { | ||
@@ -1094,7 +914,5 @@ s2.push(s3); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -1104,7 +922,5 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = []; | ||
s5 = peg$parseArgument(); | ||
if (s5 !== peg$FAILED) { | ||
@@ -1118,7 +934,5 @@ while (s5 !== peg$FAILED) { | ||
} | ||
if (s4 !== peg$FAILED) { | ||
s5 = []; | ||
s6 = peg$parseS(); | ||
while (s6 !== peg$FAILED) { | ||
@@ -1128,3 +942,2 @@ s5.push(s6); | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -1154,3 +967,2 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
@@ -1160,3 +972,2 @@ s0 = peg$currPos; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -1166,7 +977,5 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseVariableAssignment(); | ||
if (s3 !== peg$FAILED) { | ||
@@ -1180,7 +989,5 @@ while (s3 !== peg$FAILED) { | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -1190,3 +997,2 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1216,6 +1022,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -1225,7 +1031,5 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseValueArgument(); | ||
if (s3 !== peg$FAILED) { | ||
@@ -1239,7 +1043,5 @@ while (s3 !== peg$FAILED) { | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseS(); | ||
while (s4 !== peg$FAILED) { | ||
@@ -1249,3 +1051,2 @@ s3.push(s4); | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1273,6 +1074,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -1282,3 +1083,2 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1290,8 +1090,4 @@ if (input.substr(peg$currPos, 2) === peg$c29) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c30); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c30); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -1303,8 +1099,4 @@ if (input.charCodeAt(peg$currPos) === 62) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c32); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -1316,8 +1108,4 @@ if (input.substr(peg$currPos, 3) === peg$c33) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c34); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c34); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -1329,6 +1117,3 @@ if (input.charCodeAt(peg$currPos) === 60) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c36); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
} | ||
@@ -1338,6 +1123,4 @@ } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseValueArgument(); | ||
if (s3 !== peg$FAILED) { | ||
@@ -1359,3 +1142,2 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
@@ -1365,3 +1147,2 @@ s0 = peg$currPos; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -1371,6 +1152,4 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseValueArgument(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1395,6 +1174,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseS(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -1404,6 +1183,4 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseStrictValueArgument(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1427,6 +1204,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseArgumentSegment(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1440,3 +1217,2 @@ while (s2 !== peg$FAILED) { | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1446,4 +1222,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -1454,5 +1230,5 @@ } | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
s1 = peg$parseSglQuoteString(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1462,9 +1238,6 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseDblQuoteString(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1474,9 +1247,6 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parsePlainString(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1486,3 +1256,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -1497,4 +1266,4 @@ } | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 39) { | ||
@@ -1505,11 +1274,6 @@ s1 = peg$c41; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c42); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseSglQuoteStringText(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1521,8 +1285,4 @@ if (input.charCodeAt(peg$currPos) === 39) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c42); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1550,4 +1310,4 @@ peg$savedPos = s0; | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
@@ -1558,12 +1318,7 @@ s1 = peg$c44; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c45); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseDblQuoteStringSegment(); | ||
while (s3 !== peg$FAILED) { | ||
@@ -1573,3 +1328,2 @@ s2.push(s3); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1581,8 +1335,4 @@ if (input.charCodeAt(peg$currPos) === 34) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c45); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1610,6 +1360,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parsePlainStringSegment(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1623,3 +1373,2 @@ while (s2 !== peg$FAILED) { | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1629,4 +1378,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -1637,5 +1386,5 @@ } | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
s1 = peg$parseSubshell(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1645,9 +1394,6 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseVariable(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1657,9 +1403,6 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseDblQuoteStringText(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1669,3 +1412,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -1680,5 +1422,5 @@ } | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
s1 = peg$parseSubshell(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1688,9 +1430,6 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseVariable(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1700,9 +1439,6 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parsePlainStringText(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -1712,3 +1448,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -1723,6 +1458,6 @@ } | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
@@ -1733,8 +1468,4 @@ s3 = peg$c52; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c53); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1746,8 +1477,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1765,3 +1492,2 @@ peg$savedPos = s2; | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -1773,9 +1499,5 @@ if (peg$c56.test(input.charAt(peg$currPos))) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c57); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c57); } | ||
} | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1785,3 +1507,2 @@ while (s2 !== peg$FAILED) { | ||
s2 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
@@ -1792,8 +1513,4 @@ s3 = peg$c52; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c53); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1805,8 +1522,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1824,3 +1537,2 @@ peg$savedPos = s2; | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -1832,6 +1544,3 @@ if (peg$c56.test(input.charAt(peg$currPos))) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c57); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c57); } | ||
} | ||
@@ -1843,3 +1552,2 @@ } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1849,4 +1557,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -1857,6 +1565,6 @@ } | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
@@ -1867,8 +1575,4 @@ s3 = peg$c52; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c53); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1880,8 +1584,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1899,3 +1599,2 @@ peg$savedPos = s2; | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -1907,9 +1606,5 @@ if (peg$c59.test(input.charAt(peg$currPos))) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c60); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c60); } | ||
} | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1919,3 +1614,2 @@ while (s2 !== peg$FAILED) { | ||
s2 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
@@ -1926,8 +1620,4 @@ s3 = peg$c52; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c53); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1939,8 +1629,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1958,3 +1644,2 @@ peg$savedPos = s2; | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -1966,6 +1651,3 @@ if (peg$c59.test(input.charAt(peg$currPos))) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c60); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c60); } | ||
} | ||
@@ -1977,3 +1659,2 @@ } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1983,4 +1664,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -1991,6 +1672,6 @@ } | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
@@ -2001,8 +1682,4 @@ s3 = peg$c52; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c53); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -2014,8 +1691,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -2033,3 +1706,2 @@ peg$savedPos = s2; | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -2041,3 +1713,2 @@ s2 = peg$currPos; | ||
peg$silentFails--; | ||
if (s4 === peg$FAILED) { | ||
@@ -2049,3 +1720,2 @@ s3 = void 0; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -2057,8 +1727,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -2077,3 +1743,2 @@ peg$savedPos = s2; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -2083,3 +1748,2 @@ while (s2 !== peg$FAILED) { | ||
s2 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
@@ -2090,8 +1754,4 @@ s3 = peg$c52; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c53); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -2103,8 +1763,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -2122,3 +1778,2 @@ peg$savedPos = s2; | ||
} | ||
if (s2 === peg$FAILED) { | ||
@@ -2130,3 +1785,2 @@ s2 = peg$currPos; | ||
peg$silentFails--; | ||
if (s4 === peg$FAILED) { | ||
@@ -2138,3 +1792,2 @@ s3 = void 0; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -2146,8 +1799,4 @@ if (input.length > peg$currPos) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -2170,3 +1819,2 @@ peg$savedPos = s2; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -2176,4 +1824,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -2184,4 +1832,4 @@ } | ||
var s0, s1, s2, s3; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c61) { | ||
@@ -2192,11 +1840,6 @@ s1 = peg$c61; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c62); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c62); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseShellLine(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -2208,8 +1851,4 @@ if (input.charCodeAt(peg$currPos) === 41) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c24); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -2237,4 +1876,4 @@ peg$savedPos = s0; | ||
var s0, s1, s2, s3, s4, s5; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c64) { | ||
@@ -2245,11 +1884,6 @@ s1 = peg$c64; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c65); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c65); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseIdentifier(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -2261,11 +1895,6 @@ if (input.substr(peg$currPos, 2) === peg$c66) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c67); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c67); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseCommandString(); | ||
if (s4 !== peg$FAILED) { | ||
@@ -2277,8 +1906,4 @@ if (input.charCodeAt(peg$currPos) === 125) { | ||
s5 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c69); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c69); } | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -2308,6 +1933,4 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c64) { | ||
@@ -2318,11 +1941,6 @@ s1 = peg$c64; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c65); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c65); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseIdentifier(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -2334,8 +1952,4 @@ if (input.substr(peg$currPos, 3) === peg$c71) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c72); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c72); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -2357,6 +1971,4 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c64) { | ||
@@ -2367,11 +1979,6 @@ s1 = peg$c64; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c65); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c65); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseIdentifier(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -2383,8 +1990,4 @@ if (input.charCodeAt(peg$currPos) === 125) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c69); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c69); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -2406,6 +2009,4 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 36) { | ||
@@ -2416,11 +2017,6 @@ s1 = peg$c75; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c76); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c76); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseIdentifier(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -2447,5 +2043,5 @@ peg$savedPos = s0; | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (peg$c77.test(input.charAt(peg$currPos))) { | ||
@@ -2456,12 +2052,7 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c78); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c78); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c77.test(input.charAt(peg$currPos))) { | ||
@@ -2472,6 +2063,3 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c78); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c78); } | ||
} | ||
@@ -2482,3 +2070,2 @@ } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -2488,4 +2075,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -2496,5 +2083,5 @@ } | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (peg$c80.test(input.charAt(peg$currPos))) { | ||
@@ -2505,12 +2092,7 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c81); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c81); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c80.test(input.charAt(peg$currPos))) { | ||
@@ -2521,6 +2103,3 @@ s2 = input.charAt(peg$currPos); | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c81); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c81); } | ||
} | ||
@@ -2531,3 +2110,2 @@ } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -2537,4 +2115,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -2551,6 +2129,3 @@ } | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c83); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c83); } | ||
} | ||
@@ -2563,4 +2138,4 @@ | ||
var s0, s1; | ||
s0 = []; | ||
if (peg$c84.test(input.charAt(peg$currPos))) { | ||
@@ -2571,12 +2146,7 @@ s1 = input.charAt(peg$currPos); | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c85); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c85); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
while (s1 !== peg$FAILED) { | ||
s0.push(s1); | ||
if (peg$c84.test(input.charAt(peg$currPos))) { | ||
@@ -2587,6 +2157,3 @@ s1 = input.charAt(peg$currPos); | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c85); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c85); } | ||
} | ||
@@ -2606,4 +2173,13 @@ } | ||
} else { | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) peg$fail(peg$endExpectation()); | ||
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) | ||
peg$fail(peg$endExpectation()); | ||
throw peg$buildStructuredError( | ||
peg$maxFailExpected, | ||
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, | ||
peg$maxFailPos < input.length | ||
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) | ||
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos) | ||
); | ||
} | ||
@@ -2614,3 +2190,3 @@ } | ||
SyntaxError: peg$SyntaxError, | ||
parse: peg$parse | ||
}; | ||
parse: peg$parse, | ||
}; |
@@ -6,9 +6,7 @@ /* | ||
*/ | ||
"use strict"; | ||
function peg$subclass(child, parent) { | ||
function ctor() { | ||
this.constructor = child; | ||
} | ||
function ctor() { this.constructor = child; } | ||
ctor.prototype = parent.prototype; | ||
@@ -19,7 +17,7 @@ child.prototype = new ctor(); | ||
function peg$SyntaxError(message, expected, found, location) { | ||
this.message = message; | ||
this.message = message; | ||
this.expected = expected; | ||
this.found = found; | ||
this.found = found; | ||
this.location = location; | ||
this.name = "SyntaxError"; | ||
this.name = "SyntaxError"; | ||
@@ -33,24 +31,32 @@ if (typeof Error.captureStackTrace === "function") { | ||
peg$SyntaxError.buildMessage = function (expected, found) { | ||
peg$SyntaxError.buildMessage = function(expected, found) { | ||
var DESCRIBE_EXPECTATION_FNS = { | ||
literal: function (expectation) { | ||
literal: function(expectation) { | ||
return `"${literalEscape(expectation.text)}"`; | ||
}, | ||
"class": function (expectation) { | ||
"class": function(expectation) { | ||
var escapedParts = "", | ||
i; | ||
i; | ||
for (i = 0; i < expectation.parts.length; i++) escapedParts += expectation.parts[i] instanceof Array ? `${classEscape(expectation.parts[i][0])}-${classEscape(expectation.parts[i][1])}` : classEscape(expectation.parts[i]); | ||
for (i = 0; i < expectation.parts.length; i++) | ||
escapedParts += expectation.parts[i] instanceof Array | ||
? `${classEscape(expectation.parts[i][0])}-${classEscape(expectation.parts[i][1])}` | ||
: classEscape(expectation.parts[i]); | ||
return `[${expectation.inverted ? "^" : ""}${escapedParts}]`; | ||
}, | ||
any: function (expectation) { | ||
any: function(expectation) { | ||
return "any character"; | ||
}, | ||
end: function (expectation) { | ||
end: function(expectation) { | ||
return "end of input"; | ||
}, | ||
other: function (expectation) { | ||
other: function(expectation) { | ||
return expectation.description; | ||
} | ||
}, | ||
}; | ||
@@ -63,15 +69,25 @@ | ||
function literalEscape(s) { | ||
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { | ||
return `\\x0${hex(ch)}`; | ||
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { | ||
return `\\x${hex(ch)}`; | ||
}); | ||
return s | ||
.replace(/\\/g, '\\\\') | ||
.replace(/"/g, '\\"') | ||
.replace(/\0/g, '\\0') | ||
.replace(/\t/g, '\\t') | ||
.replace(/\n/g, '\\n') | ||
.replace(/\r/g, '\\r') | ||
.replace(/[\x00-\x0F]/g, function(ch) { return `\\x0${hex(ch)}`; }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return `\\x${hex(ch)}`; }); | ||
} | ||
function classEscape(s) { | ||
return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { | ||
return `\\x0${hex(ch)}`; | ||
}).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { | ||
return `\\x${hex(ch)}`; | ||
}); | ||
return s | ||
.replace(/\\/g, '\\\\') | ||
.replace(/\]/g, '\\]') | ||
.replace(/\^/g, '\\^') | ||
.replace(/-/g, '\\-') | ||
.replace(/\0/g, '\\0') | ||
.replace(/\t/g, '\\t') | ||
.replace(/\n/g, '\\n') | ||
.replace(/\r/g, '\\r') | ||
.replace(/[\x00-\x0F]/g, function(ch) { return `\\x0${hex(ch)}`; }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return `\\x${hex(ch)}`; }); | ||
} | ||
@@ -85,7 +101,8 @@ | ||
var descriptions = new Array(expected.length), | ||
i, | ||
j; | ||
i, j; | ||
for (i = 0; i < expected.length; i++) descriptions[i] = describeExpectation(expected[i]); | ||
for (i = 0; i < expected.length; i++) | ||
descriptions[i] = describeExpectation(expected[i]); | ||
descriptions.sort(); | ||
@@ -100,3 +117,2 @@ | ||
} | ||
descriptions.length = j; | ||
@@ -113,3 +129,5 @@ } | ||
default: | ||
return `${descriptions.slice(0, -1).join(", ")}, or ${descriptions[descriptions.length - 1]}`; | ||
return `${descriptions.slice(0, -1).join(", ") | ||
}, or ${ | ||
descriptions[descriptions.length - 1]}`; | ||
} | ||
@@ -129,181 +147,119 @@ } | ||
var peg$FAILED = {}, | ||
peg$startRuleFunctions = { | ||
Start: peg$parseStart | ||
}, | ||
peg$startRuleFunction = peg$parseStart, | ||
peg$c0 = function (statements) { | ||
return [].concat(...statements); | ||
}, | ||
peg$c1 = "-", | ||
peg$c2 = peg$literalExpectation("-", false), | ||
peg$c3 = function (value) { | ||
return value; | ||
}, | ||
peg$c4 = function (statements) { | ||
return Object.assign({}, ...statements); | ||
}, | ||
peg$c5 = "#", | ||
peg$c6 = peg$literalExpectation("#", false), | ||
peg$c7 = peg$anyExpectation(), | ||
peg$c8 = function () { | ||
return {}; | ||
}, | ||
peg$c9 = ":", | ||
peg$c10 = peg$literalExpectation(":", false), | ||
peg$c11 = function (property, value) { | ||
return { | ||
[property]: value | ||
}; | ||
}, | ||
peg$c12 = ",", | ||
peg$c13 = peg$literalExpectation(",", false), | ||
peg$c14 = function (property, other) { | ||
return other; | ||
}, | ||
peg$c15 = function (property, others, value) { | ||
return Object.assign({}, ...[property].concat(others).map(property => ({ | ||
[property]: value | ||
}))); | ||
}, | ||
peg$c16 = function (statements) { | ||
return statements; | ||
}, | ||
peg$c17 = function (expression) { | ||
return expression; | ||
}, | ||
peg$c18 = peg$otherExpectation("correct indentation"), | ||
peg$c19 = " ", | ||
peg$c20 = peg$literalExpectation(" ", false), | ||
peg$c21 = function (spaces) { | ||
return spaces.length === indentLevel * INDENT_STEP; | ||
}, | ||
peg$c22 = function (spaces) { | ||
return spaces.length === (indentLevel + 1) * INDENT_STEP; | ||
}, | ||
peg$c23 = function () { | ||
indentLevel++; | ||
return true; | ||
}, | ||
peg$c24 = function () { | ||
indentLevel--; | ||
return true; | ||
}, | ||
peg$c25 = function () { | ||
return text(); | ||
}, | ||
peg$c26 = peg$otherExpectation("pseudostring"), | ||
peg$c27 = /^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/, | ||
peg$c28 = peg$classExpectation(["\r", "\n", "\t", " ", "?", ":", ",", "]", "[", "{", "}", "#", "&", "*", "!", "|", ">", "'", "\"", "%", "@", "`", "-"], true, false), | ||
peg$c29 = /^[^\r\n\t ,\][{}:#"']/, | ||
peg$c30 = peg$classExpectation(["\r", "\n", "\t", " ", ",", "]", "[", "{", "}", ":", "#", "\"", "'"], true, false), | ||
peg$c31 = function () { | ||
return text().replace(/^ *| *$/g, ''); | ||
}, | ||
peg$c32 = "--", | ||
peg$c33 = peg$literalExpectation("--", false), | ||
peg$c34 = /^[a-zA-Z\/0-9]/, | ||
peg$c35 = peg$classExpectation([["a", "z"], ["A", "Z"], "/", ["0", "9"]], false, false), | ||
peg$c36 = /^[^\r\n\t :,]/, | ||
peg$c37 = peg$classExpectation(["\r", "\n", "\t", " ", ":", ","], true, false), | ||
peg$c38 = "null", | ||
peg$c39 = peg$literalExpectation("null", false), | ||
peg$c40 = function () { | ||
return null; | ||
}, | ||
peg$c41 = "true", | ||
peg$c42 = peg$literalExpectation("true", false), | ||
peg$c43 = function () { | ||
return true; | ||
}, | ||
peg$c44 = "false", | ||
peg$c45 = peg$literalExpectation("false", false), | ||
peg$c46 = function () { | ||
return false; | ||
}, | ||
peg$c47 = peg$otherExpectation("string"), | ||
peg$c48 = "\"", | ||
peg$c49 = peg$literalExpectation("\"", false), | ||
peg$c50 = function () { | ||
return ""; | ||
}, | ||
peg$c51 = function (chars) { | ||
return chars; | ||
}, | ||
peg$c52 = function (chars) { | ||
return chars.join(``); | ||
}, | ||
peg$c53 = /^[^"\\\0-\x1F\x7F]/, | ||
peg$c54 = peg$classExpectation(["\"", "\\", ["\0", "\x1F"], "\x7F"], true, false), | ||
peg$c55 = "\\\"", | ||
peg$c56 = peg$literalExpectation("\\\"", false), | ||
peg$c57 = function () { | ||
return `"`; | ||
}, | ||
peg$c58 = "\\\\", | ||
peg$c59 = peg$literalExpectation("\\\\", false), | ||
peg$c60 = function () { | ||
return `\\`; | ||
}, | ||
peg$c61 = "\\/", | ||
peg$c62 = peg$literalExpectation("\\/", false), | ||
peg$c63 = function () { | ||
return `/`; | ||
}, | ||
peg$c64 = "\\b", | ||
peg$c65 = peg$literalExpectation("\\b", false), | ||
peg$c66 = function () { | ||
return `\b`; | ||
}, | ||
peg$c67 = "\\f", | ||
peg$c68 = peg$literalExpectation("\\f", false), | ||
peg$c69 = function () { | ||
return `\f`; | ||
}, | ||
peg$c70 = "\\n", | ||
peg$c71 = peg$literalExpectation("\\n", false), | ||
peg$c72 = function () { | ||
return `\n`; | ||
}, | ||
peg$c73 = "\\r", | ||
peg$c74 = peg$literalExpectation("\\r", false), | ||
peg$c75 = function () { | ||
return `\r`; | ||
}, | ||
peg$c76 = "\\t", | ||
peg$c77 = peg$literalExpectation("\\t", false), | ||
peg$c78 = function () { | ||
return `\t`; | ||
}, | ||
peg$c79 = "\\u", | ||
peg$c80 = peg$literalExpectation("\\u", false), | ||
peg$c81 = function (h1, h2, h3, h4) { | ||
return String.fromCharCode(parseInt(`0x${h1}${h2}${h3}${h4}`)); | ||
}, | ||
peg$c82 = /^[0-9a-fA-F]/, | ||
peg$c83 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), | ||
peg$c84 = peg$otherExpectation("blank space"), | ||
peg$c85 = /^[ \t]/, | ||
peg$c86 = peg$classExpectation([" ", "\t"], false, false), | ||
peg$c87 = peg$otherExpectation("white space"), | ||
peg$c88 = /^[ \t\n\r]/, | ||
peg$c89 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false), | ||
peg$c90 = "\r\n", | ||
peg$c91 = peg$literalExpectation("\r\n", false), | ||
peg$c92 = "\n", | ||
peg$c93 = peg$literalExpectation("\n", false), | ||
peg$c94 = "\r", | ||
peg$c95 = peg$literalExpectation("\r", false), | ||
peg$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{ | ||
line: 1, | ||
column: 1 | ||
}], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
peg$startRuleFunctions = {Start: peg$parseStart}, | ||
peg$startRuleFunction = peg$parseStart, | ||
peg$c0 = function(statements) { return [].concat(...statements); }, | ||
peg$c1 = "-", | ||
peg$c2 = peg$literalExpectation("-", false), | ||
peg$c3 = function(value) { return value; }, | ||
peg$c4 = function(statements) { return Object.assign({}, ...statements); }, | ||
peg$c5 = "#", | ||
peg$c6 = peg$literalExpectation("#", false), | ||
peg$c7 = peg$anyExpectation(), | ||
peg$c8 = function() { return {}; }, | ||
peg$c9 = ":", | ||
peg$c10 = peg$literalExpectation(":", false), | ||
peg$c11 = function(property, value) { return {[property]: value}; }, | ||
peg$c12 = ",", | ||
peg$c13 = peg$literalExpectation(",", false), | ||
peg$c14 = function(property, other) { return other; }, | ||
peg$c15 = function(property, others, value) { return Object.assign({}, ...[property].concat(others).map(property => ({[property]: value}))); }, | ||
peg$c16 = function(statements) { return statements; }, | ||
peg$c17 = function(expression) { return expression; }, | ||
peg$c18 = peg$otherExpectation("correct indentation"), | ||
peg$c19 = " ", | ||
peg$c20 = peg$literalExpectation(" ", false), | ||
peg$c21 = function(spaces) { return spaces.length === indentLevel * INDENT_STEP; }, | ||
peg$c22 = function(spaces) { return spaces.length === (indentLevel + 1) * INDENT_STEP; }, | ||
peg$c23 = function() { indentLevel++; return true; }, | ||
peg$c24 = function() { indentLevel--; return true; }, | ||
peg$c25 = function() { return text(); }, | ||
peg$c26 = peg$otherExpectation("pseudostring"), | ||
peg$c27 = /^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/, | ||
peg$c28 = peg$classExpectation(["\r", "\n", "\t", " ", "?", ":", ",", "]", "[", "{", "}", "#", "&", "*", "!", "|", ">", "'", "\"", "%", "@", "`", "-"], true, false), | ||
peg$c29 = /^[^\r\n\t ,\][{}:#"']/, | ||
peg$c30 = peg$classExpectation(["\r", "\n", "\t", " ", ",", "]", "[", "{", "}", ":", "#", "\"", "'"], true, false), | ||
peg$c31 = function() { return text().replace(/^ *| *$/g, ''); }, | ||
peg$c32 = "--", | ||
peg$c33 = peg$literalExpectation("--", false), | ||
peg$c34 = /^[a-zA-Z\/0-9]/, | ||
peg$c35 = peg$classExpectation([["a", "z"], ["A", "Z"], "/", ["0", "9"]], false, false), | ||
peg$c36 = /^[^\r\n\t :,]/, | ||
peg$c37 = peg$classExpectation(["\r", "\n", "\t", " ", ":", ","], true, false), | ||
peg$c38 = "null", | ||
peg$c39 = peg$literalExpectation("null", false), | ||
peg$c40 = function() { return null; }, | ||
peg$c41 = "true", | ||
peg$c42 = peg$literalExpectation("true", false), | ||
peg$c43 = function() { return true; }, | ||
peg$c44 = "false", | ||
peg$c45 = peg$literalExpectation("false", false), | ||
peg$c46 = function() { return false; }, | ||
peg$c47 = peg$otherExpectation("string"), | ||
peg$c48 = "\"", | ||
peg$c49 = peg$literalExpectation("\"", false), | ||
peg$c50 = function() { return ""; }, | ||
peg$c51 = function(chars) { return chars; }, | ||
peg$c52 = function(chars) { return chars.join(``); }, | ||
peg$c53 = /^[^"\\\0-\x1F\x7F]/, | ||
peg$c54 = peg$classExpectation(["\"", "\\", ["\0", "\x1F"], "\x7F"], true, false), | ||
peg$c55 = "\\\"", | ||
peg$c56 = peg$literalExpectation("\\\"", false), | ||
peg$c57 = function() { return `"`; }, | ||
peg$c58 = "\\\\", | ||
peg$c59 = peg$literalExpectation("\\\\", false), | ||
peg$c60 = function() { return `\\`; }, | ||
peg$c61 = "\\/", | ||
peg$c62 = peg$literalExpectation("\\/", false), | ||
peg$c63 = function() { return `/`; }, | ||
peg$c64 = "\\b", | ||
peg$c65 = peg$literalExpectation("\\b", false), | ||
peg$c66 = function() { return `\b`; }, | ||
peg$c67 = "\\f", | ||
peg$c68 = peg$literalExpectation("\\f", false), | ||
peg$c69 = function() { return `\f`; }, | ||
peg$c70 = "\\n", | ||
peg$c71 = peg$literalExpectation("\\n", false), | ||
peg$c72 = function() { return `\n`; }, | ||
peg$c73 = "\\r", | ||
peg$c74 = peg$literalExpectation("\\r", false), | ||
peg$c75 = function() { return `\r`; }, | ||
peg$c76 = "\\t", | ||
peg$c77 = peg$literalExpectation("\\t", false), | ||
peg$c78 = function() { return `\t`; }, | ||
peg$c79 = "\\u", | ||
peg$c80 = peg$literalExpectation("\\u", false), | ||
peg$c81 = function(h1, h2, h3, h4) { | ||
return String.fromCharCode(parseInt(`0x${h1}${h2}${h3}${h4}`)); | ||
}, | ||
peg$c82 = /^[0-9a-fA-F]/, | ||
peg$c83 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), | ||
peg$c84 = peg$otherExpectation("blank space"), | ||
peg$c85 = /^[ \t]/, | ||
peg$c86 = peg$classExpectation([" ", "\t"], false, false), | ||
peg$c87 = peg$otherExpectation("white space"), | ||
peg$c88 = /^[ \t\n\r]/, | ||
peg$c89 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false), | ||
peg$c90 = "\r\n", | ||
peg$c91 = peg$literalExpectation("\r\n", false), | ||
peg$c92 = "\n", | ||
peg$c93 = peg$literalExpectation("\n", false), | ||
peg$c94 = "\r", | ||
peg$c95 = peg$literalExpectation("\r", false), | ||
peg$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{line: 1, column: 1}], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
if ("startRule" in options) { | ||
if (!(options.startRule in peg$startRuleFunctions)) throw new Error(`Can't start parsing from rule "${options.startRule}".`); | ||
if (!(options.startRule in peg$startRuleFunctions)) | ||
throw new Error(`Can't start parsing from rule "${options.startRule}".`); | ||
peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; | ||
@@ -314,18 +270,24 @@ } | ||
return input.substring(peg$savedPos, peg$currPos); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function location() { | ||
return peg$computeLocation(peg$savedPos, peg$currPos); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function expected(description, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location); | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
throw peg$buildStructuredError( | ||
[peg$otherExpectation(description)], | ||
input.substring(peg$savedPos, peg$currPos), | ||
location | ||
); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function error(message, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
throw peg$buildSimpleError(message, location); | ||
@@ -335,40 +297,23 @@ } | ||
function peg$literalExpectation(text, ignoreCase) { | ||
return { | ||
type: "literal", | ||
text: text, | ||
ignoreCase: ignoreCase | ||
}; | ||
return {type: "literal", text: text, ignoreCase: ignoreCase}; | ||
} | ||
function peg$classExpectation(parts, inverted, ignoreCase) { | ||
return { | ||
type: "class", | ||
parts: parts, | ||
inverted: inverted, | ||
ignoreCase: ignoreCase | ||
}; | ||
return {type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase}; | ||
} | ||
function peg$anyExpectation() { | ||
return { | ||
type: "any" | ||
}; | ||
return {type: "any"}; | ||
} | ||
function peg$endExpectation() { | ||
return { | ||
type: "end" | ||
}; | ||
return {type: "end"}; | ||
} | ||
function peg$otherExpectation(description) { | ||
return { | ||
type: "other", | ||
description: description | ||
}; | ||
return {type: "other", description: description}; | ||
} | ||
function peg$computePosDetails(pos) { | ||
var details = peg$posDetailsCache[pos], | ||
p; | ||
var details = peg$posDetailsCache[pos], p; | ||
@@ -379,9 +324,10 @@ if (details) { | ||
p = pos - 1; | ||
while (!peg$posDetailsCache[p]) | ||
p--; | ||
while (!peg$posDetailsCache[p]) p--; | ||
details = peg$posDetailsCache[p]; | ||
details = { | ||
line: details.line, | ||
column: details.column | ||
line: details.line, | ||
column: details.column, | ||
}; | ||
@@ -407,14 +353,15 @@ | ||
var startPosDetails = peg$computePosDetails(startPos), | ||
endPosDetails = peg$computePosDetails(endPos); | ||
endPosDetails = peg$computePosDetails(endPos); | ||
return { | ||
start: { | ||
offset: startPos, | ||
line: startPosDetails.line, | ||
column: startPosDetails.column | ||
line: startPosDetails.line, | ||
column: startPosDetails.column, | ||
}, | ||
end: { | ||
offset: endPos, | ||
line: endPosDetails.line, | ||
column: endPosDetails.column | ||
} | ||
line: endPosDetails.line, | ||
column: endPosDetails.column, | ||
}, | ||
}; | ||
@@ -424,3 +371,3 @@ } | ||
function peg$fail(expected) { | ||
if (peg$currPos < peg$maxFailPos) return; | ||
if (peg$currPos < peg$maxFailPos) return; | ||
@@ -440,3 +387,8 @@ if (peg$currPos > peg$maxFailPos) { | ||
function peg$buildStructuredError(expected, found, location) { | ||
return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); | ||
return new peg$SyntaxError( | ||
peg$SyntaxError.buildMessage(expected, found), | ||
expected, | ||
found, | ||
location | ||
); | ||
} | ||
@@ -446,3 +398,5 @@ | ||
var s0; | ||
s0 = peg$parsePropertyStatements(); | ||
return s0; | ||
@@ -453,6 +407,6 @@ } | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseItemStatement(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -462,3 +416,2 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -468,4 +421,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -476,5 +429,5 @@ } | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
s1 = peg$parseSamedent(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -486,14 +439,8 @@ if (input.charCodeAt(peg$currPos) === 45) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c2); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c2); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseB(); | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseExpression(); | ||
if (s4 !== peg$FAILED) { | ||
@@ -525,6 +472,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parsePropertyStatement(); | ||
while (s2 !== peg$FAILED) { | ||
@@ -534,3 +481,2 @@ s1.push(s2); | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -540,4 +486,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -548,9 +494,10 @@ } | ||
var s0, s1, s2, s3, s4, s5, s6, s7, s8; | ||
s0 = peg$currPos; | ||
s1 = peg$parseB(); | ||
if (s1 === peg$FAILED) s1 = null; | ||
if (s1 === peg$FAILED) | ||
s1 = null; | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 35) { | ||
@@ -561,8 +508,4 @@ s3 = peg$c5; | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c6); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c6); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -575,3 +518,2 @@ s4 = []; | ||
peg$silentFails--; | ||
if (s7 === peg$FAILED) { | ||
@@ -583,3 +525,2 @@ s6 = void 0; | ||
} | ||
if (s6 !== peg$FAILED) { | ||
@@ -591,8 +532,4 @@ if (input.length > peg$currPos) { | ||
s7 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c7); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
} | ||
if (s7 !== peg$FAILED) { | ||
@@ -609,3 +546,2 @@ s6 = [s6, s7]; | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -619,3 +555,2 @@ while (s5 !== peg$FAILED) { | ||
peg$silentFails--; | ||
if (s7 === peg$FAILED) { | ||
@@ -627,3 +562,2 @@ s6 = void 0; | ||
} | ||
if (s6 !== peg$FAILED) { | ||
@@ -635,8 +569,4 @@ if (input.length > peg$currPos) { | ||
s7 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c7); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c7); } | ||
} | ||
if (s7 !== peg$FAILED) { | ||
@@ -657,3 +587,2 @@ s6 = [s6, s7]; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -670,9 +599,8 @@ s3 = [s3, s4]; | ||
} | ||
if (s2 === peg$FAILED) | ||
s2 = null; | ||
if (s2 === peg$FAILED) s2 = null; | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
s4 = peg$parseEOL_ANY(); | ||
if (s4 !== peg$FAILED) { | ||
@@ -686,3 +614,2 @@ while (s4 !== peg$FAILED) { | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -704,13 +631,11 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseSamedent(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseName(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseB(); | ||
if (s3 === peg$FAILED) s3 = null; | ||
if (s3 === peg$FAILED) | ||
s3 = null; | ||
@@ -723,15 +648,11 @@ if (s3 !== peg$FAILED) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c10); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c10); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) s5 = null; | ||
if (s5 === peg$FAILED) | ||
s5 = null; | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parseExpression(); | ||
if (s6 !== peg$FAILED) { | ||
@@ -765,13 +686,11 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseSamedent(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseLegacyName(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseB(); | ||
if (s3 === peg$FAILED) s3 = null; | ||
if (s3 === peg$FAILED) | ||
s3 = null; | ||
@@ -784,15 +703,11 @@ if (s3 !== peg$FAILED) { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c10); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c10); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) s5 = null; | ||
if (s5 === peg$FAILED) | ||
s5 = null; | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parseExpression(); | ||
if (s6 !== peg$FAILED) { | ||
@@ -826,20 +741,14 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseSamedent(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseLegacyName(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseB(); | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseLegacyLiteral(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = []; | ||
s6 = peg$parseEOL_ANY(); | ||
if (s6 !== peg$FAILED) { | ||
@@ -853,3 +762,2 @@ while (s6 !== peg$FAILED) { | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -879,10 +787,7 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseSamedent(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseLegacyName(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -892,3 +797,4 @@ s3 = []; | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) s5 = null; | ||
if (s5 === peg$FAILED) | ||
s5 = null; | ||
@@ -901,15 +807,11 @@ if (s5 !== peg$FAILED) { | ||
s6 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c13); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c13); } | ||
} | ||
if (s6 !== peg$FAILED) { | ||
s7 = peg$parseB(); | ||
if (s7 === peg$FAILED) s7 = null; | ||
if (s7 === peg$FAILED) | ||
s7 = null; | ||
if (s7 !== peg$FAILED) { | ||
s8 = peg$parseLegacyName(); | ||
if (s8 !== peg$FAILED) { | ||
@@ -935,3 +837,2 @@ peg$savedPos = s4; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -942,3 +843,4 @@ while (s4 !== peg$FAILED) { | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) s5 = null; | ||
if (s5 === peg$FAILED) | ||
s5 = null; | ||
@@ -951,15 +853,11 @@ if (s5 !== peg$FAILED) { | ||
s6 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c13); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c13); } | ||
} | ||
if (s6 !== peg$FAILED) { | ||
s7 = peg$parseB(); | ||
if (s7 === peg$FAILED) s7 = null; | ||
if (s7 === peg$FAILED) | ||
s7 = null; | ||
if (s7 !== peg$FAILED) { | ||
s8 = peg$parseLegacyName(); | ||
if (s8 !== peg$FAILED) { | ||
@@ -989,6 +887,6 @@ peg$savedPos = s4; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) s4 = null; | ||
if (s4 === peg$FAILED) | ||
s4 = null; | ||
@@ -1001,15 +899,11 @@ if (s4 !== peg$FAILED) { | ||
s5 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c10); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c10); } | ||
} | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parseB(); | ||
if (s6 === peg$FAILED) s6 = null; | ||
if (s6 === peg$FAILED) | ||
s6 = null; | ||
if (s6 !== peg$FAILED) { | ||
s7 = peg$parseExpression(); | ||
if (s7 !== peg$FAILED) { | ||
@@ -1057,2 +951,3 @@ peg$savedPos = s0; | ||
var s0, s1, s2, s3, s4, s5, s6; | ||
s0 = peg$currPos; | ||
@@ -1063,6 +958,4 @@ s1 = peg$currPos; | ||
s3 = peg$parseEOL(); | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseExtradent(); | ||
if (s4 !== peg$FAILED) { | ||
@@ -1074,11 +967,6 @@ if (input.charCodeAt(peg$currPos) === 45) { | ||
s5 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c2); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c2); } | ||
} | ||
if (s5 !== peg$FAILED) { | ||
s6 = peg$parseB(); | ||
if (s6 !== peg$FAILED) { | ||
@@ -1103,5 +991,3 @@ s3 = [s3, s4, s5, s6]; | ||
} | ||
peg$silentFails--; | ||
if (s2 !== peg$FAILED) { | ||
@@ -1113,15 +999,10 @@ peg$currPos = s1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseEOL_ANY(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parseIndent(); | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseItemStatements(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseDedent(); | ||
if (s5 !== peg$FAILED) { | ||
@@ -1151,16 +1032,11 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseEOL(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parseIndent(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parsePropertyStatements(); | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parseDedent(); | ||
if (s4 !== peg$FAILED) { | ||
@@ -1186,11 +1062,8 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
s1 = peg$parseLiteral(); | ||
if (s1 !== peg$FAILED) { | ||
s2 = []; | ||
s3 = peg$parseEOL_ANY(); | ||
if (s3 !== peg$FAILED) { | ||
@@ -1204,3 +1077,2 @@ while (s3 !== peg$FAILED) { | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1226,6 +1098,6 @@ peg$savedPos = s0; | ||
var s0, s1, s2; | ||
peg$silentFails++; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
@@ -1236,11 +1108,6 @@ s2 = peg$c19; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c20); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
} | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
@@ -1251,13 +1118,12 @@ s2 = peg$c19; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c20); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
} | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = peg$currPos; | ||
s2 = peg$c21(s1); | ||
if (s2) s2 = void 0;else s2 = peg$FAILED; | ||
if (s2) | ||
s2 = void 0; | ||
else | ||
s2 = peg$FAILED; | ||
@@ -1275,11 +1141,6 @@ if (s2 !== peg$FAILED) { | ||
} | ||
peg$silentFails--; | ||
if (s0 === peg$FAILED) { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c18); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
} | ||
@@ -1292,5 +1153,5 @@ | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
@@ -1301,11 +1162,6 @@ s2 = peg$c19; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c20); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
} | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
@@ -1316,13 +1172,12 @@ s2 = peg$c19; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c20); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
} | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = peg$currPos; | ||
s2 = peg$c22(s1); | ||
if (s2) s2 = void 0;else s2 = peg$FAILED; | ||
if (s2) | ||
s2 = void 0; | ||
else | ||
s2 = peg$FAILED; | ||
@@ -1346,5 +1201,11 @@ if (s2 !== peg$FAILED) { | ||
var s0; | ||
peg$savedPos = peg$currPos; | ||
s0 = peg$c23(); | ||
if (s0) s0 = void 0;else s0 = peg$FAILED; | ||
if (s0) | ||
s0 = void 0; | ||
else | ||
s0 = peg$FAILED; | ||
return s0; | ||
@@ -1355,5 +1216,11 @@ } | ||
var s0; | ||
peg$savedPos = peg$currPos; | ||
s0 = peg$c24(); | ||
if (s0) s0 = void 0;else s0 = peg$FAILED; | ||
if (s0) | ||
s0 = void 0; | ||
else | ||
s0 = peg$FAILED; | ||
return s0; | ||
@@ -1364,4 +1231,8 @@ } | ||
var s0; | ||
s0 = peg$parsestring(); | ||
if (s0 === peg$FAILED) s0 = peg$parsepseudostring(); | ||
if (s0 === peg$FAILED) | ||
s0 = peg$parsepseudostring(); | ||
return s0; | ||
@@ -1372,4 +1243,4 @@ } | ||
var s0, s1, s2; | ||
s0 = peg$parsestring(); | ||
if (s0 === peg$FAILED) { | ||
@@ -1379,3 +1250,2 @@ s0 = peg$currPos; | ||
s2 = peg$parsepseudostringLegacy(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1389,3 +1259,2 @@ while (s2 !== peg$FAILED) { | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1395,3 +1264,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -1405,10 +1273,8 @@ } | ||
var s0; | ||
s0 = peg$parsenull(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseboolean(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsestring(); | ||
if (s0 === peg$FAILED) { | ||
@@ -1425,7 +1291,6 @@ s0 = peg$parsepseudostring(); | ||
var s0; | ||
s0 = peg$parsenull(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsestring(); | ||
if (s0 === peg$FAILED) { | ||
@@ -1441,5 +1306,5 @@ s0 = peg$parsepseudostringLegacy(); | ||
var s0, s1, s2, s3, s4, s5; | ||
peg$silentFails++; | ||
s0 = peg$currPos; | ||
if (peg$c27.test(input.charAt(peg$currPos))) { | ||
@@ -1450,8 +1315,4 @@ s1 = input.charAt(peg$currPos); | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c28); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1461,3 +1322,4 @@ s2 = []; | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) s4 = null; | ||
if (s4 === peg$FAILED) | ||
s4 = null; | ||
@@ -1470,8 +1332,4 @@ if (s4 !== peg$FAILED) { | ||
s5 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c30); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c30); } | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -1488,3 +1346,2 @@ s4 = [s4, s5]; | ||
} | ||
while (s3 !== peg$FAILED) { | ||
@@ -1494,3 +1351,4 @@ s2.push(s3); | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) s4 = null; | ||
if (s4 === peg$FAILED) | ||
s4 = null; | ||
@@ -1503,8 +1361,4 @@ if (s4 !== peg$FAILED) { | ||
s5 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c30); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c30); } | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -1522,3 +1376,2 @@ s4 = [s4, s5]; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1536,11 +1389,6 @@ peg$savedPos = s0; | ||
} | ||
peg$silentFails--; | ||
if (s0 === peg$FAILED) { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c26); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
} | ||
@@ -1553,4 +1401,4 @@ | ||
var s0, s1, s2, s3, s4; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c32) { | ||
@@ -1561,10 +1409,7 @@ s1 = peg$c32; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c33); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
} | ||
if (s1 === peg$FAILED) | ||
s1 = null; | ||
if (s1 === peg$FAILED) s1 = null; | ||
if (s1 !== peg$FAILED) { | ||
@@ -1576,11 +1421,6 @@ if (peg$c34.test(input.charAt(peg$currPos))) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c35); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
s3 = []; | ||
if (peg$c36.test(input.charAt(peg$currPos))) { | ||
@@ -1591,11 +1431,6 @@ s4 = input.charAt(peg$currPos); | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c37); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
} | ||
while (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
if (peg$c36.test(input.charAt(peg$currPos))) { | ||
@@ -1606,9 +1441,5 @@ s4 = input.charAt(peg$currPos); | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c37); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
} | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1636,4 +1467,4 @@ peg$savedPos = s0; | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 4) === peg$c38) { | ||
@@ -1644,8 +1475,4 @@ s1 = peg$c38; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c39); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1655,4 +1482,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -1663,4 +1490,4 @@ } | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 4) === peg$c41) { | ||
@@ -1671,8 +1498,4 @@ s1 = peg$c41; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c42); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1682,8 +1505,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 5) === peg$c44) { | ||
@@ -1694,8 +1514,4 @@ s1 = peg$c44; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c45); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1705,3 +1521,2 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
@@ -1715,5 +1530,5 @@ } | ||
var s0, s1, s2, s3; | ||
peg$silentFails++; | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
@@ -1724,8 +1539,4 @@ s1 = peg$c48; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c49); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1737,8 +1548,4 @@ if (input.charCodeAt(peg$currPos) === 34) { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c49); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1756,6 +1563,4 @@ peg$savedPos = s0; | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
@@ -1766,11 +1571,6 @@ s1 = peg$c48; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c49); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parsechars(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1782,8 +1582,4 @@ if (input.charCodeAt(peg$currPos) === 34) { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c49); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -1806,11 +1602,6 @@ peg$savedPos = s0; | ||
} | ||
peg$silentFails--; | ||
if (s0 === peg$FAILED) { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c47); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
@@ -1823,6 +1614,6 @@ | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parsechar(); | ||
if (s2 !== peg$FAILED) { | ||
@@ -1836,3 +1627,2 @@ while (s2 !== peg$FAILED) { | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1842,4 +1632,4 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
s0 = s1; | ||
return s0; | ||
@@ -1856,11 +1646,6 @@ } | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c54); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c54); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c55) { | ||
@@ -1871,8 +1656,4 @@ s1 = peg$c55; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c56); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c56); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1882,8 +1663,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c58) { | ||
@@ -1894,8 +1672,4 @@ s1 = peg$c58; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c59); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c59); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1905,8 +1679,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c61) { | ||
@@ -1917,8 +1688,4 @@ s1 = peg$c61; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c62); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c62); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1928,8 +1695,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c64) { | ||
@@ -1940,8 +1704,4 @@ s1 = peg$c64; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c65); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c65); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1951,8 +1711,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c67) { | ||
@@ -1963,8 +1720,4 @@ s1 = peg$c67; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c68); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c68); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1974,8 +1727,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c70) { | ||
@@ -1986,8 +1736,4 @@ s1 = peg$c70; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c71); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c71); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1997,8 +1743,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c73) { | ||
@@ -2009,8 +1752,4 @@ s1 = peg$c73; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c74); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c74); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -2020,8 +1759,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c76) { | ||
@@ -2032,8 +1768,4 @@ s1 = peg$c76; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c77); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c77); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -2043,8 +1775,5 @@ peg$savedPos = s0; | ||
} | ||
s0 = s1; | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 2) === peg$c79) { | ||
@@ -2055,20 +1784,12 @@ s1 = peg$c79; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c80); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c80); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
s2 = peg$parsehexDigit(); | ||
if (s2 !== peg$FAILED) { | ||
s3 = peg$parsehexDigit(); | ||
if (s3 !== peg$FAILED) { | ||
s4 = peg$parsehexDigit(); | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parsehexDigit(); | ||
if (s5 !== peg$FAILED) { | ||
@@ -2119,6 +1840,3 @@ peg$savedPos = s0; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c83); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c83); } | ||
} | ||
@@ -2131,5 +1849,5 @@ | ||
var s0, s1; | ||
peg$silentFails++; | ||
s0 = []; | ||
if (peg$c85.test(input.charAt(peg$currPos))) { | ||
@@ -2140,12 +1858,7 @@ s1 = input.charAt(peg$currPos); | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c86); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c86); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
while (s1 !== peg$FAILED) { | ||
s0.push(s1); | ||
if (peg$c85.test(input.charAt(peg$currPos))) { | ||
@@ -2156,6 +1869,3 @@ s1 = input.charAt(peg$currPos); | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c86); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c86); } | ||
} | ||
@@ -2166,22 +1876,17 @@ } | ||
} | ||
peg$silentFails--; | ||
if (s0 === peg$FAILED) { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c84); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c84); } | ||
} | ||
return s0; | ||
} // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function peg$parseS() { | ||
var s0, s1; | ||
peg$silentFails++; | ||
s0 = []; | ||
if (peg$c88.test(input.charAt(peg$currPos))) { | ||
@@ -2192,12 +1897,7 @@ s1 = input.charAt(peg$currPos); | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c89); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c89); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
while (s1 !== peg$FAILED) { | ||
s0.push(s1); | ||
if (peg$c88.test(input.charAt(peg$currPos))) { | ||
@@ -2208,6 +1908,3 @@ s1 = input.charAt(peg$currPos); | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c89); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c89); } | ||
} | ||
@@ -2218,22 +1915,17 @@ } | ||
} | ||
peg$silentFails--; | ||
if (s0 === peg$FAILED) { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c87); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c87); } | ||
} | ||
return s0; | ||
} // eslint-disable-next-line @typescript-eslint/camelcase | ||
} | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
function peg$parseEOL_ANY() { | ||
var s0, s1, s2, s3, s4, s5; | ||
s0 = peg$currPos; | ||
s1 = peg$parseEOL(); | ||
if (s1 !== peg$FAILED) { | ||
@@ -2243,7 +1935,7 @@ s2 = []; | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) s4 = null; | ||
if (s4 === peg$FAILED) | ||
s4 = null; | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseEOL(); | ||
if (s5 !== peg$FAILED) { | ||
@@ -2260,3 +1952,2 @@ s4 = [s4, s5]; | ||
} | ||
while (s3 !== peg$FAILED) { | ||
@@ -2266,7 +1957,7 @@ s2.push(s3); | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) s4 = null; | ||
if (s4 === peg$FAILED) | ||
s4 = null; | ||
if (s4 !== peg$FAILED) { | ||
s5 = peg$parseEOL(); | ||
if (s5 !== peg$FAILED) { | ||
@@ -2284,3 +1975,2 @@ s4 = [s4, s5]; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -2309,8 +1999,4 @@ s1 = [s1, s2]; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c91); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c91); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
@@ -2322,8 +2008,4 @@ if (input.charCodeAt(peg$currPos) === 10) { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c93); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c93); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
@@ -2335,6 +2017,3 @@ if (input.charCodeAt(peg$currPos) === 13) { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$c95); | ||
} | ||
if (peg$silentFails === 0) { peg$fail(peg$c95); } | ||
} | ||
@@ -2347,4 +2026,8 @@ } | ||
const INDENT_STEP = 2; | ||
let indentLevel = 0; | ||
peg$result = peg$startRuleFunction(); | ||
@@ -2355,4 +2038,13 @@ | ||
} else { | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) peg$fail(peg$endExpectation()); | ||
throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) | ||
peg$fail(peg$endExpectation()); | ||
throw peg$buildStructuredError( | ||
peg$maxFailExpected, | ||
peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, | ||
peg$maxFailPos < input.length | ||
? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) | ||
: peg$computeLocation(peg$maxFailPos, peg$maxFailPos) | ||
); | ||
} | ||
@@ -2363,3 +2055,3 @@ } | ||
SyntaxError: peg$SyntaxError, | ||
parse: peg$parse | ||
}; | ||
parse: peg$parse, | ||
}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "ArgumentSegment", { | ||
enumerable: true, | ||
get: function () { | ||
return _shell.ArgumentSegment; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Argument", { | ||
enumerable: true, | ||
get: function () { | ||
return _shell.Argument; | ||
} | ||
}); | ||
Object.defineProperty(exports, "CommandChain", { | ||
enumerable: true, | ||
get: function () { | ||
return _shell.CommandChain; | ||
} | ||
}); | ||
Object.defineProperty(exports, "CommandLine", { | ||
enumerable: true, | ||
get: function () { | ||
return _shell.CommandLine; | ||
} | ||
}); | ||
Object.defineProperty(exports, "EnvSegment", { | ||
enumerable: true, | ||
get: function () { | ||
return _shell.EnvSegment; | ||
} | ||
}); | ||
Object.defineProperty(exports, "ShellLine", { | ||
enumerable: true, | ||
get: function () { | ||
return _shell.ShellLine; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parseShell", { | ||
enumerable: true, | ||
get: function () { | ||
return _shell2.parseShell; | ||
} | ||
}); | ||
Object.defineProperty(exports, "Resolution", { | ||
enumerable: true, | ||
get: function () { | ||
return _resolution.Resolution; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parseResolution", { | ||
enumerable: true, | ||
get: function () { | ||
return _resolution.parseResolution; | ||
} | ||
}); | ||
Object.defineProperty(exports, "stringifyResolution", { | ||
enumerable: true, | ||
get: function () { | ||
return _resolution.stringifyResolution; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parseSyml", { | ||
enumerable: true, | ||
get: function () { | ||
return _syml.parseSyml; | ||
} | ||
}); | ||
Object.defineProperty(exports, "stringifySyml", { | ||
enumerable: true, | ||
get: function () { | ||
return _syml.stringifySyml; | ||
} | ||
}); | ||
var _shell = require("./grammars/shell"); | ||
var _shell2 = require("./shell"); | ||
var _resolution = require("./resolution"); | ||
var _syml = require("./syml"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var shell_1 = require("./shell"); | ||
exports.parseShell = shell_1.parseShell; | ||
var resolution_1 = require("./resolution"); | ||
exports.parseResolution = resolution_1.parseResolution; | ||
exports.stringifyResolution = resolution_1.stringifyResolution; | ||
var syml_1 = require("./syml"); | ||
exports.parseSyml = syml_1.parseSyml; | ||
exports.stringifySyml = syml_1.stringifySyml; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.parseResolution = parseResolution; | ||
exports.stringifyResolution = stringifyResolution; | ||
var _resolution = require("./grammars/resolution"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const resolution_1 = require("./grammars/resolution"); | ||
function parseResolution(source) { | ||
const legacyResolution = source.match(/^\*{1,2}\/(.*)/); | ||
if (legacyResolution) throw new Error(`The override for '${source}' includes a glob pattern. Glob patterns have been removed since their behaviours don't match what you'd expect. Set the override to '${legacyResolution[1]}' instead.`); | ||
try { | ||
return (0, _resolution.parse)(source); | ||
} catch (error) { | ||
if (error.location) error.message = error.message.replace(/(\.)?$/, ` (line ${error.location.start.line}, column ${error.location.start.column})$1`); | ||
throw error; | ||
} | ||
const legacyResolution = source.match(/^\*{1,2}\/(.*)/); | ||
if (legacyResolution) | ||
throw new Error(`The override for '${source}' includes a glob pattern. Glob patterns have been removed since their behaviours don't match what you'd expect. Set the override to '${legacyResolution[1]}' instead.`); | ||
try { | ||
return resolution_1.parse(source); | ||
} | ||
catch (error) { | ||
if (error.location) | ||
error.message = error.message.replace(/(\.)?$/, ` (line ${error.location.start.line}, column ${error.location.start.column})$1`); | ||
throw error; | ||
} | ||
} | ||
exports.parseResolution = parseResolution; | ||
function stringifyResolution(resolution) { | ||
let str = ``; | ||
if (resolution.from) { | ||
str += resolution.from.fullName; | ||
if (resolution.from.description) str += `@${resolution.from.description}`; | ||
str += `/`; | ||
} | ||
str += resolution.descriptor.fullName; | ||
if (resolution.descriptor.description) str += `@${resolution.descriptor.description}`; | ||
return str; | ||
} | ||
let str = ``; | ||
if (resolution.from) { | ||
str += resolution.from.fullName; | ||
if (resolution.from.description) | ||
str += `@${resolution.from.description}`; | ||
str += `/`; | ||
} | ||
str += resolution.descriptor.fullName; | ||
if (resolution.descriptor.description) | ||
str += `@${resolution.descriptor.description}`; | ||
return str; | ||
} | ||
exports.stringifyResolution = stringifyResolution; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const shell_1 = require("./grammars/shell"); | ||
function parseShell(source) { | ||
try { | ||
return shell_1.parse(source); | ||
} | ||
catch (error) { | ||
if (error.location) | ||
error.message = error.message.replace(/(\.)?$/, ` (line ${error.location.start.line}, column ${error.location.start.column})$1`); | ||
throw error; | ||
} | ||
} | ||
exports.parseShell = parseShell; | ||
var _shell = require("./grammars/shell"); | ||
function parseShell(source) { | ||
try { | ||
return (0, _shell.parse)(source); | ||
} catch (error) { | ||
if (error.location) error.message = error.message.replace(/(\.)?$/, ` (line ${error.location.start.line}, column ${error.location.start.column})$1`); | ||
throw error; | ||
} | ||
} |
217
lib/syml.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.stringifySyml = stringifySyml; | ||
exports.parseSyml = parseSyml; | ||
var _jsYaml = require("js-yaml"); | ||
var _syml = require("./grammars/syml"); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// @ts-ignore | ||
const simpleStringPattern = /^(?![-?:,\][{}#&*!|>'"%@` \t\r\n]).([ \t]*(?![,\][{}:# \t\r\n]).)*$/; // The following keys will always be stored at the top of the object, in the | ||
const js_yaml_1 = require("js-yaml"); | ||
const syml_1 = require("./grammars/syml"); | ||
const simpleStringPattern = /^(?![-?:,\][{}#&*!|>'"%@` \t\r\n]).([ \t]*(?![,\][{}:# \t\r\n]).)*$/; | ||
// The following keys will always be stored at the top of the object, in the | ||
// specified order. It's not fair but life isn't fair either. | ||
const specialObjectKeys = [`__metadata`, `version`, `resolution`, `dependencies`, `peerDependencies`, `dependenciesMeta`, `peerDependenciesMeta`, `binaries`]; | ||
class PreserveOrdering { | ||
constructor(data) { | ||
this.data = data; | ||
} | ||
constructor(data) { | ||
this.data = data; | ||
} | ||
} | ||
; | ||
exports.PreserveOrdering = PreserveOrdering; | ||
function stringifyString(value) { | ||
if (value.match(simpleStringPattern)) { | ||
return value; | ||
} else { | ||
return JSON.stringify(value); | ||
} | ||
if (value.match(simpleStringPattern)) { | ||
return value; | ||
} | ||
else { | ||
return JSON.stringify(value); | ||
} | ||
} | ||
function stringifyValue(value, indentLevel, newLineIfObject) { | ||
if (value === null) return `null\n`; | ||
if (typeof value === `number` || typeof value === `boolean`) return `${value.toString()}\n`; | ||
if (typeof value === `string`) return `${stringifyString(value)}\n`; | ||
if (Array.isArray(value)) { | ||
const indent = ` `.repeat(indentLevel); | ||
const serialized = value.map(sub => { | ||
return `${indent}- ${stringifyValue(sub, indentLevel + 1, false)}`; | ||
}).join(``); | ||
return `\n${serialized}`; | ||
} | ||
if (typeof value === `object` && value) { | ||
let data; | ||
let sort; | ||
if (value instanceof PreserveOrdering) { | ||
data = value.data; | ||
sort = false; | ||
} else { | ||
data = value; | ||
sort = true; | ||
if (value === null) | ||
return `null\n`; | ||
if (typeof value === `number` || typeof value === `boolean`) | ||
return `${value.toString()}\n`; | ||
if (typeof value === `string`) | ||
return `${stringifyString(value)}\n`; | ||
if (Array.isArray(value)) { | ||
const indent = ` `.repeat(indentLevel); | ||
const serialized = value.map(sub => { | ||
return `${indent}- ${stringifyValue(sub, indentLevel + 1, false)}`; | ||
}).join(``); | ||
return `\n${serialized}`; | ||
} | ||
const indent = ` `.repeat(indentLevel); | ||
const keys = Object.keys(data); | ||
if (sort) { | ||
keys.sort((a, b) => { | ||
const aIndex = specialObjectKeys.indexOf(a); | ||
const bIndex = specialObjectKeys.indexOf(b); | ||
if (aIndex === -1 && bIndex === -1) return a < b ? -1 : a > b ? +1 : 0; | ||
if (aIndex !== -1 && bIndex === -1) return -1; | ||
if (aIndex === -1 && bIndex !== -1) return +1; | ||
return aIndex - bIndex; | ||
}); | ||
if (typeof value === `object` && value) { | ||
let data; | ||
let sort; | ||
if (value instanceof PreserveOrdering) { | ||
data = value.data; | ||
sort = false; | ||
} | ||
else { | ||
data = value; | ||
sort = true; | ||
} | ||
const indent = ` `.repeat(indentLevel); | ||
const keys = Object.keys(data); | ||
if (sort) { | ||
keys.sort((a, b) => { | ||
const aIndex = specialObjectKeys.indexOf(a); | ||
const bIndex = specialObjectKeys.indexOf(b); | ||
if (aIndex === -1 && bIndex === -1) | ||
return a < b ? -1 : a > b ? +1 : 0; | ||
if (aIndex !== -1 && bIndex === -1) | ||
return -1; | ||
if (aIndex === -1 && bIndex !== -1) | ||
return +1; | ||
return aIndex - bIndex; | ||
}); | ||
} | ||
const fields = keys.filter(key => { | ||
return data[key] !== undefined; | ||
}).map((key, index) => { | ||
const value = data[key]; | ||
const stringifiedKey = stringifyString(key); | ||
const stringifiedValue = stringifyValue(value, indentLevel + 1, true); | ||
const recordIndentation = index > 0 || newLineIfObject | ||
? indent | ||
: ``; | ||
if (stringifiedValue.startsWith(`\n`)) { | ||
return `${recordIndentation}${stringifiedKey}:${stringifiedValue}`; | ||
} | ||
else { | ||
return `${recordIndentation}${stringifiedKey}: ${stringifiedValue}`; | ||
} | ||
}).join(indentLevel === 0 ? `\n` : ``) || `\n`; | ||
if (!newLineIfObject) { | ||
return `${fields}`; | ||
} | ||
else { | ||
return `\n${fields}`; | ||
} | ||
} | ||
const fields = keys.filter(key => { | ||
return data[key] !== undefined; | ||
}).map((key, index) => { | ||
const value = data[key]; | ||
const stringifiedKey = stringifyString(key); | ||
const stringifiedValue = stringifyValue(value, indentLevel + 1, true); | ||
const recordIndentation = index > 0 || newLineIfObject ? indent : ``; | ||
if (stringifiedValue.startsWith(`\n`)) { | ||
return `${recordIndentation}${stringifiedKey}:${stringifiedValue}`; | ||
} else { | ||
return `${recordIndentation}${stringifiedKey}: ${stringifiedValue}`; | ||
} | ||
}).join(indentLevel === 0 ? `\n` : ``) || `\n`; | ||
if (!newLineIfObject) { | ||
return `${fields}`; | ||
} else { | ||
return `\n${fields}`; | ||
} | ||
} | ||
throw new Error(`Unsupported value type (${value})`); | ||
throw new Error(`Unsupported value type (${value})`); | ||
} | ||
function stringifySyml(value) { | ||
try { | ||
return stringifyValue(value, 0, false); | ||
} catch (error) { | ||
if (error.location) error.message = error.message.replace(/(\.)?$/, ` (line ${error.location.start.line}, column ${error.location.start.column})$1`); | ||
throw error; | ||
} | ||
try { | ||
return stringifyValue(value, 0, false); | ||
} | ||
catch (error) { | ||
if (error.location) | ||
error.message = error.message.replace(/(\.)?$/, ` (line ${error.location.start.line}, column ${error.location.start.column})$1`); | ||
throw error; | ||
} | ||
} | ||
exports.stringifySyml = stringifySyml; | ||
stringifySyml.PreserveOrdering = PreserveOrdering; | ||
function parseViaPeg(source) { | ||
if (!source.endsWith(`\n`)) source += `\n`; | ||
return (0, _syml.parse)(source); | ||
if (!source.endsWith(`\n`)) | ||
source += `\n`; | ||
return syml_1.parse(source); | ||
} | ||
const LEGACY_REGEXP = /^(#.*(\r?\n))*?#\s+yarn\s+lockfile\s+v1\r?\n/i; | ||
function parseViaJsYaml(source) { | ||
if (LEGACY_REGEXP.test(source)) return parseViaPeg(source); | ||
let value = (0, _jsYaml.safeLoad)(source, { | ||
schema: _jsYaml.FAILSAFE_SCHEMA | ||
}); // Empty files are parsed as `undefined` instead of an empty object | ||
// Empty files with 2 newlines or more are `null` instead | ||
if (value === undefined || value === null) return {}; | ||
if (typeof value !== `object`) throw new Error(`Expected an indexed object, got a ${typeof value} instead. Does your file follow Yaml's rules?`); | ||
if (Array.isArray(value)) throw new Error(`Expected an indexed object, got an array instead. Does your file follow Yaml's rules?`); | ||
return value; | ||
if (LEGACY_REGEXP.test(source)) | ||
return parseViaPeg(source); | ||
let value = js_yaml_1.safeLoad(source, { | ||
schema: js_yaml_1.FAILSAFE_SCHEMA, | ||
}); | ||
// Empty files are parsed as `undefined` instead of an empty object | ||
// Empty files with 2 newlines or more are `null` instead | ||
if (value === undefined || value === null) | ||
return {}; | ||
if (typeof value !== `object`) | ||
throw new Error(`Expected an indexed object, got a ${typeof value} instead. Does your file follow Yaml's rules?`); | ||
if (Array.isArray(value)) | ||
throw new Error(`Expected an indexed object, got an array instead. Does your file follow Yaml's rules?`); | ||
return value; | ||
} | ||
function parseSyml(source) { | ||
return parseViaJsYaml(source); | ||
} | ||
return parseViaJsYaml(source); | ||
} | ||
exports.parseSyml = parseSyml; |
{ | ||
"name": "@yarnpkg/parsers", | ||
"version": "2.0.0-rc.8", | ||
"version": "2.0.0-rc.9", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
15
130043
4266