@yarnpkg/parsers
Advanced tools
Comparing version 2.4.0-rc.7 to 2.4.0-rc.8
@@ -31,32 +31,32 @@ /* | ||
var DESCRIBE_EXPECTATION_FNS = { | ||
literal: function(expectation) { | ||
return `"${literalEscape(expectation.text)}"`; | ||
}, | ||
literal: function(expectation) { | ||
return "\"" + literalEscape(expectation.text) + "\""; | ||
}, | ||
"class": function(expectation) { | ||
var escapedParts = "", | ||
i; | ||
"class": function(expectation) { | ||
var escapedParts = "", | ||
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 + "]"; | ||
}, | ||
return `[${expectation.inverted ? "^" : ""}${escapedParts}]`; | ||
}, | ||
any: function(expectation) { | ||
return "any character"; | ||
}, | ||
any: function(expectation) { | ||
return "any character"; | ||
}, | ||
end: function(expectation) { | ||
return "end of input"; | ||
}, | ||
end: function(expectation) { | ||
return "end of input"; | ||
}, | ||
other: function(expectation) { | ||
return expectation.description; | ||
} | ||
}; | ||
other: function(expectation) { | ||
return expectation.description; | ||
}, | ||
}; | ||
function hex(ch) { | ||
@@ -74,4 +74,4 @@ return ch.charCodeAt(0).toString(16).toUpperCase(); | ||
.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)}`; }); | ||
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); | ||
} | ||
@@ -89,4 +89,4 @@ | ||
.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)}`; }); | ||
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); | ||
} | ||
@@ -100,8 +100,8 @@ | ||
var descriptions = new Array(expected.length), | ||
i, j; | ||
i, j; | ||
for (i = 0; i < expected.length; i++) | ||
for (i = 0; i < expected.length; i++) { | ||
descriptions[i] = describeExpectation(expected[i]); | ||
} | ||
descriptions.sort(); | ||
@@ -124,8 +124,8 @@ | ||
case 2: | ||
return `${descriptions[0]} or ${descriptions[1]}`; | ||
return descriptions[0] + " or " + descriptions[1]; | ||
default: | ||
return `${descriptions.slice(0, -1).join(", ") | ||
}, or ${ | ||
descriptions[descriptions.length - 1]}`; | ||
return descriptions.slice(0, -1).join(", ") | ||
+ ", or " | ||
+ descriptions[descriptions.length - 1]; | ||
} | ||
@@ -135,6 +135,6 @@ } | ||
function describeFound(found) { | ||
return found ? `"${literalEscape(found)}"` : "end of input"; | ||
return found ? "\"" + literalEscape(found) + "\"" : "end of input"; | ||
} | ||
return `Expected ${describeExpected(expected)} but ${describeFound(found)} found.`; | ||
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; | ||
}; | ||
@@ -147,33 +147,33 @@ | ||
peg$startRuleFunctions = {resolution: peg$parseresolution}, | ||
peg$startRuleFunction = peg$parseresolution, | ||
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$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$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{ line: 1, column: 1 }], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
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]; | ||
@@ -186,3 +186,2 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function location() { | ||
@@ -192,5 +191,4 @@ return peg$computeLocation(peg$savedPos, peg$currPos); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function expected(description, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) | ||
@@ -204,5 +202,4 @@ throw peg$buildStructuredError( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function error(message, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) | ||
@@ -213,20 +210,19 @@ throw peg$buildSimpleError(message, location); | ||
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 }; | ||
} | ||
// 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 }; | ||
} | ||
@@ -241,10 +237,10 @@ | ||
p = pos - 1; | ||
while (!peg$posDetailsCache[p]) | ||
while (!peg$posDetailsCache[p]) { | ||
p--; | ||
} | ||
details = peg$posDetailsCache[p]; | ||
details = { | ||
line: details.line, | ||
column: details.column, | ||
column: details.column | ||
}; | ||
@@ -270,3 +266,3 @@ | ||
var startPosDetails = peg$computePosDetails(startPos), | ||
endPosDetails = peg$computePosDetails(endPos); | ||
endPosDetails = peg$computePosDetails(endPos); | ||
@@ -277,3 +273,3 @@ return { | ||
line: startPosDetails.line, | ||
column: startPosDetails.column, | ||
column: startPosDetails.column | ||
}, | ||
@@ -283,4 +279,4 @@ end: { | ||
line: endPosDetails.line, | ||
column: endPosDetails.column, | ||
}, | ||
column: endPosDetails.column | ||
} | ||
}; | ||
@@ -290,3 +286,3 @@ } | ||
function peg$fail(expected) { | ||
if (peg$currPos < peg$maxFailPos) return; | ||
if (peg$currPos < peg$maxFailPos) { return; } | ||
@@ -533,6 +529,6 @@ if (peg$currPos > peg$maxFailPos) { | ||
} else { | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) { | ||
peg$fail(peg$endExpectation()); | ||
} | ||
throw peg$buildStructuredError( | ||
@@ -550,3 +546,3 @@ peg$maxFailExpected, | ||
SyntaxError: peg$SyntaxError, | ||
parse: peg$parse, | ||
parse: peg$parse | ||
}; |
@@ -31,32 +31,32 @@ /* | ||
var DESCRIBE_EXPECTATION_FNS = { | ||
literal: function(expectation) { | ||
return `"${literalEscape(expectation.text)}"`; | ||
}, | ||
literal: function(expectation) { | ||
return "\"" + literalEscape(expectation.text) + "\""; | ||
}, | ||
"class": function(expectation) { | ||
var escapedParts = "", | ||
i; | ||
"class": function(expectation) { | ||
var escapedParts = "", | ||
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 + "]"; | ||
}, | ||
return `[${expectation.inverted ? "^" : ""}${escapedParts}]`; | ||
}, | ||
any: function(expectation) { | ||
return "any character"; | ||
}, | ||
any: function(expectation) { | ||
return "any character"; | ||
}, | ||
end: function(expectation) { | ||
return "end of input"; | ||
}, | ||
end: function(expectation) { | ||
return "end of input"; | ||
}, | ||
other: function(expectation) { | ||
return expectation.description; | ||
} | ||
}; | ||
other: function(expectation) { | ||
return expectation.description; | ||
}, | ||
}; | ||
function hex(ch) { | ||
@@ -74,4 +74,4 @@ return ch.charCodeAt(0).toString(16).toUpperCase(); | ||
.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)}`; }); | ||
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); | ||
} | ||
@@ -89,4 +89,4 @@ | ||
.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)}`; }); | ||
.replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) | ||
.replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); | ||
} | ||
@@ -100,8 +100,8 @@ | ||
var descriptions = new Array(expected.length), | ||
i, j; | ||
i, j; | ||
for (i = 0; i < expected.length; i++) | ||
for (i = 0; i < expected.length; i++) { | ||
descriptions[i] = describeExpectation(expected[i]); | ||
} | ||
descriptions.sort(); | ||
@@ -124,8 +124,8 @@ | ||
case 2: | ||
return `${descriptions[0]} or ${descriptions[1]}`; | ||
return descriptions[0] + " or " + descriptions[1]; | ||
default: | ||
return `${descriptions.slice(0, -1).join(", ") | ||
}, or ${ | ||
descriptions[descriptions.length - 1]}`; | ||
return descriptions.slice(0, -1).join(", ") | ||
+ ", or " | ||
+ descriptions[descriptions.length - 1]; | ||
} | ||
@@ -135,6 +135,6 @@ } | ||
function describeFound(found) { | ||
return found ? `"${literalEscape(found)}"` : "end of input"; | ||
return found ? "\"" + literalEscape(found) + "\"" : "end of input"; | ||
} | ||
return `Expected ${describeExpected(expected)} but ${describeFound(found)} found.`; | ||
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; | ||
}; | ||
@@ -147,118 +147,118 @@ | ||
peg$startRuleFunctions = {Start: peg$parseStart}, | ||
peg$startRuleFunction = peg$parseStart, | ||
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$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$currPos = 0, | ||
peg$savedPos = 0, | ||
peg$posDetailsCache = [{ line: 1, column: 1 }], | ||
peg$maxFailPos = 0, | ||
peg$maxFailExpected = [], | ||
peg$silentFails = 0, | ||
peg$result; | ||
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]; | ||
@@ -271,3 +271,2 @@ } | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function location() { | ||
@@ -277,5 +276,4 @@ return peg$computeLocation(peg$savedPos, peg$currPos); | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function expected(description, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) | ||
@@ -289,5 +287,4 @@ throw peg$buildStructuredError( | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function error(message, location) { | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); | ||
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) | ||
@@ -298,19 +295,19 @@ throw peg$buildSimpleError(message, location); | ||
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 }; | ||
} | ||
@@ -325,10 +322,10 @@ | ||
p = pos - 1; | ||
while (!peg$posDetailsCache[p]) | ||
while (!peg$posDetailsCache[p]) { | ||
p--; | ||
} | ||
details = peg$posDetailsCache[p]; | ||
details = { | ||
line: details.line, | ||
column: details.column, | ||
column: details.column | ||
}; | ||
@@ -354,3 +351,3 @@ | ||
var startPosDetails = peg$computePosDetails(startPos), | ||
endPosDetails = peg$computePosDetails(endPos); | ||
endPosDetails = peg$computePosDetails(endPos); | ||
@@ -361,3 +358,3 @@ return { | ||
line: startPosDetails.line, | ||
column: startPosDetails.column, | ||
column: startPosDetails.column | ||
}, | ||
@@ -367,4 +364,4 @@ end: { | ||
line: endPosDetails.line, | ||
column: endPosDetails.column, | ||
}, | ||
column: endPosDetails.column | ||
} | ||
}; | ||
@@ -374,3 +371,3 @@ } | ||
function peg$fail(expected) { | ||
if (peg$currPos < peg$maxFailPos) return; | ||
if (peg$currPos < peg$maxFailPos) { return; } | ||
@@ -490,5 +487,5 @@ if (peg$currPos > peg$maxFailPos) { | ||
s1 = peg$parseB(); | ||
if (s1 === peg$FAILED) | ||
if (s1 === peg$FAILED) { | ||
s1 = null; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -583,5 +580,5 @@ s2 = peg$currPos; | ||
} | ||
if (s2 === peg$FAILED) | ||
if (s2 === peg$FAILED) { | ||
s2 = null; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -621,5 +618,5 @@ s3 = []; | ||
s3 = peg$parseB(); | ||
if (s3 === peg$FAILED) | ||
if (s3 === peg$FAILED) { | ||
s3 = null; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -635,5 +632,5 @@ if (input.charCodeAt(peg$currPos) === 58) { | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) | ||
if (s5 === peg$FAILED) { | ||
s5 = null; | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -676,5 +673,5 @@ s6 = peg$parseExpression(); | ||
s3 = peg$parseB(); | ||
if (s3 === peg$FAILED) | ||
if (s3 === peg$FAILED) { | ||
s3 = null; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
@@ -690,5 +687,5 @@ if (input.charCodeAt(peg$currPos) === 58) { | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) | ||
if (s5 === peg$FAILED) { | ||
s5 = null; | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -777,5 +774,5 @@ s6 = peg$parseExpression(); | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) | ||
if (s5 === peg$FAILED) { | ||
s5 = null; | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -791,5 +788,5 @@ if (input.charCodeAt(peg$currPos) === 44) { | ||
s7 = peg$parseB(); | ||
if (s7 === peg$FAILED) | ||
if (s7 === peg$FAILED) { | ||
s7 = null; | ||
} | ||
if (s7 !== peg$FAILED) { | ||
@@ -822,5 +819,5 @@ s8 = peg$parseLegacyName(); | ||
s5 = peg$parseB(); | ||
if (s5 === peg$FAILED) | ||
if (s5 === peg$FAILED) { | ||
s5 = null; | ||
} | ||
if (s5 !== peg$FAILED) { | ||
@@ -836,5 +833,5 @@ if (input.charCodeAt(peg$currPos) === 44) { | ||
s7 = peg$parseB(); | ||
if (s7 === peg$FAILED) | ||
if (s7 === peg$FAILED) { | ||
s7 = null; | ||
} | ||
if (s7 !== peg$FAILED) { | ||
@@ -868,5 +865,5 @@ s8 = peg$parseLegacyName(); | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) | ||
if (s4 === peg$FAILED) { | ||
s4 = null; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -882,5 +879,5 @@ if (input.charCodeAt(peg$currPos) === 58) { | ||
s6 = peg$parseB(); | ||
if (s6 === peg$FAILED) | ||
if (s6 === peg$FAILED) { | ||
s6 = null; | ||
} | ||
if (s6 !== peg$FAILED) { | ||
@@ -1093,7 +1090,7 @@ s7 = peg$parseExpression(); | ||
s2 = peg$c21(s1); | ||
if (s2) | ||
if (s2) { | ||
s2 = void 0; | ||
else | ||
} else { | ||
s2 = peg$FAILED; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1144,7 +1141,7 @@ s1 = [s1, s2]; | ||
s2 = peg$c22(s1); | ||
if (s2) | ||
if (s2) { | ||
s2 = void 0; | ||
else | ||
} else { | ||
s2 = peg$FAILED; | ||
} | ||
if (s2 !== peg$FAILED) { | ||
@@ -1170,8 +1167,8 @@ s1 = [s1, s2]; | ||
s0 = peg$c23(); | ||
if (s0) | ||
if (s0) { | ||
s0 = void 0; | ||
else | ||
} else { | ||
s0 = peg$FAILED; | ||
} | ||
return s0; | ||
@@ -1185,8 +1182,8 @@ } | ||
s0 = peg$c24(); | ||
if (s0) | ||
if (s0) { | ||
s0 = void 0; | ||
else | ||
} else { | ||
s0 = peg$FAILED; | ||
} | ||
return s0; | ||
@@ -1199,6 +1196,6 @@ } | ||
s0 = peg$parsestring(); | ||
if (s0 === peg$FAILED) | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsepseudostring(); | ||
} | ||
return s0; | ||
@@ -1280,5 +1277,5 @@ } | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) | ||
if (s4 === peg$FAILED) { | ||
s4 = null; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1307,5 +1304,5 @@ if (peg$c29.test(input.charAt(peg$currPos))) { | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) | ||
if (s4 === peg$FAILED) { | ||
s4 = null; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1363,5 +1360,5 @@ if (peg$c29.test(input.charAt(peg$currPos))) { | ||
} | ||
if (s1 === peg$FAILED) | ||
if (s1 === peg$FAILED) { | ||
s1 = null; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
@@ -1794,3 +1791,2 @@ if (peg$c34.test(input.charAt(peg$currPos))) { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function peg$parseS() { | ||
@@ -1831,3 +1827,2 @@ var s0, s1; | ||
// eslint-disable-next-line @typescript-eslint/camelcase | ||
function peg$parseEOL_ANY() { | ||
@@ -1842,5 +1837,5 @@ var s0, s1, s2, s3, s4, s5; | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) | ||
if (s4 === peg$FAILED) { | ||
s4 = null; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1863,5 +1858,5 @@ s5 = peg$parseEOL(); | ||
s4 = peg$parseB(); | ||
if (s4 === peg$FAILED) | ||
if (s4 === peg$FAILED) { | ||
s4 = null; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
@@ -1929,5 +1924,5 @@ s5 = peg$parseEOL(); | ||
const INDENT_STEP = 2; | ||
const INDENT_STEP = 2; | ||
let indentLevel = 0; | ||
let indentLevel = 0; | ||
@@ -1940,6 +1935,6 @@ | ||
} else { | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) | ||
if (peg$result !== peg$FAILED && peg$currPos < input.length) { | ||
peg$fail(peg$endExpectation()); | ||
} | ||
throw peg$buildStructuredError( | ||
@@ -1957,3 +1952,3 @@ peg$maxFailExpected, | ||
SyntaxError: peg$SyntaxError, | ||
parse: peg$parse, | ||
parse: peg$parse | ||
}; |
{ | ||
"name": "@yarnpkg/parsers", | ||
"version": "2.4.0-rc.7", | ||
"version": "2.4.0-rc.8", | ||
"license": "BSD-2-Clause", | ||
@@ -18,2 +18,3 @@ "main": "./lib/index.js", | ||
"grammar:syml": "run pegjs -o sources/grammars/syml.js sources/grammars/syml.pegjs", | ||
"grammar:all": "run grammar:shell & run grammar:resolution & run grammar:syml &", | ||
"postpack": "rm -rf lib", | ||
@@ -20,0 +21,0 @@ "prepack": "run build:compile \"$(pwd)\"", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
173731
5470