All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s
2323 lines
56 KiB
JavaScript
2323 lines
56 KiB
JavaScript
/*
|
|
* Generated by PEG.js 0.10.0.
|
|
*
|
|
* http://pegjs.org/
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
function peg$subclass(child, parent) {
|
|
function ctor() { this.constructor = child; }
|
|
ctor.prototype = parent.prototype;
|
|
child.prototype = new ctor();
|
|
}
|
|
|
|
function peg$SyntaxError(message, expected, found, location) {
|
|
this.message = message;
|
|
this.expected = expected;
|
|
this.found = found;
|
|
this.location = location;
|
|
this.name = "SyntaxError";
|
|
|
|
if (typeof Error.captureStackTrace === "function") {
|
|
Error.captureStackTrace(this, peg$SyntaxError);
|
|
}
|
|
}
|
|
|
|
peg$subclass(peg$SyntaxError, Error);
|
|
|
|
peg$SyntaxError.buildMessage = function(expected, found) {
|
|
var DESCRIBE_EXPECTATION_FNS = {
|
|
literal: function(expectation) {
|
|
return "\"" + literalEscape(expectation.text) + "\"";
|
|
},
|
|
|
|
"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]);
|
|
}
|
|
|
|
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
|
|
},
|
|
|
|
any: function(expectation) {
|
|
return "any character";
|
|
},
|
|
|
|
end: function(expectation) {
|
|
return "end of input";
|
|
},
|
|
|
|
other: function(expectation) {
|
|
return expectation.description;
|
|
}
|
|
};
|
|
|
|
function hex(ch) {
|
|
return ch.charCodeAt(0).toString(16).toUpperCase();
|
|
}
|
|
|
|
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); });
|
|
}
|
|
|
|
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); });
|
|
}
|
|
|
|
function describeExpectation(expectation) {
|
|
return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
|
|
}
|
|
|
|
function describeExpected(expected) {
|
|
var descriptions = new Array(expected.length),
|
|
i, j;
|
|
|
|
for (i = 0; i < expected.length; i++) {
|
|
descriptions[i] = describeExpectation(expected[i]);
|
|
}
|
|
|
|
descriptions.sort();
|
|
|
|
if (descriptions.length > 0) {
|
|
for (i = 1, j = 1; i < descriptions.length; i++) {
|
|
if (descriptions[i - 1] !== descriptions[i]) {
|
|
descriptions[j] = descriptions[i];
|
|
j++;
|
|
}
|
|
}
|
|
descriptions.length = j;
|
|
}
|
|
|
|
switch (descriptions.length) {
|
|
case 1:
|
|
return descriptions[0];
|
|
|
|
case 2:
|
|
return descriptions[0] + " or " + descriptions[1];
|
|
|
|
default:
|
|
return descriptions.slice(0, -1).join(", ")
|
|
+ ", or "
|
|
+ descriptions[descriptions.length - 1];
|
|
}
|
|
}
|
|
|
|
function describeFound(found) {
|
|
return found ? "\"" + literalEscape(found) + "\"" : "end of input";
|
|
}
|
|
|
|
return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
|
|
};
|
|
|
|
function peg$parse(input, options) {
|
|
options = options !== void 0 ? options : {};
|
|
|
|
var peg$FAILED = {},
|
|
|
|
peg$startRuleFunctions = { diffs: peg$parsediffs },
|
|
peg$startRuleFunction = peg$parsediffs,
|
|
|
|
peg$c0 = function(diffs) { return diffs },
|
|
peg$c1 = function(header, file_modes) { return postProcessDiff(header, file_modes, undefined, true) },
|
|
peg$c2 = "Binary files ",
|
|
peg$c3 = peg$literalExpectation("Binary files ", false),
|
|
peg$c4 = function(header, file_modes, patch) { return postProcessDiff(header, file_modes, patch) },
|
|
peg$c5 = function(path) { return postProcessMergeConflictDiff(path, undefined, true) },
|
|
peg$c6 = function(modes, similarity, copy_from, copy_to, index_modes, patch) {
|
|
return postProcessSimilarityDiff(copy_from.operation, similarity, copy_from.file, copy_to.file, modes || index_modes, patch)
|
|
},
|
|
peg$c7 = function(path, patch) { return postProcessMergeConflictDiff(path, patch) },
|
|
peg$c8 = "diff --cc ",
|
|
peg$c9 = peg$literalExpectation("diff --cc ", false),
|
|
peg$c10 = function(path) { return path },
|
|
peg$c11 = "* Unmerged path ",
|
|
peg$c12 = peg$literalExpectation("* Unmerged path ", false),
|
|
peg$c13 = function(path) { return postProcessMergeConflictDiff(path) },
|
|
peg$c14 = function(header, hunks) { return {hunks} },
|
|
peg$c15 = "--- ",
|
|
peg$c16 = peg$literalExpectation("--- ", false),
|
|
peg$c17 = "+++ ",
|
|
peg$c18 = peg$literalExpectation("+++ ", false),
|
|
peg$c19 = function(old_file_name, new_file_name) { return {old_file_name, new_file_name} },
|
|
peg$c20 = function(header, lines) {
|
|
return Object.assign({}, header, {
|
|
lines: lines
|
|
})
|
|
},
|
|
peg$c21 = "@@@ -",
|
|
peg$c22 = peg$literalExpectation("@@@ -", false),
|
|
peg$c23 = " -",
|
|
peg$c24 = peg$literalExpectation(" -", false),
|
|
peg$c25 = " +",
|
|
peg$c26 = peg$literalExpectation(" +", false),
|
|
peg$c27 = " @@@",
|
|
peg$c28 = peg$literalExpectation(" @@@", false),
|
|
peg$c29 = function(our_range, base_range, their_range, context) {
|
|
return {
|
|
ourStartLine: our_range.start,
|
|
ourLineCount: our_range.count,
|
|
theirStartLine: their_range.start,
|
|
theirLineCount: their_range.count,
|
|
baseStartLine: base_range.start,
|
|
baseLineCount: base_range.count,
|
|
heading: context ? context.trim() : '',
|
|
}
|
|
},
|
|
peg$c30 = "@@ -",
|
|
peg$c31 = peg$literalExpectation("@@ -", false),
|
|
peg$c32 = " @@",
|
|
peg$c33 = peg$literalExpectation(" @@", false),
|
|
peg$c34 = function(old_range, new_range, context) {
|
|
return {
|
|
oldStartLine: old_range.start,
|
|
oldLineCount: old_range.count,
|
|
newStartLine: new_range.start,
|
|
newLineCount: new_range.count,
|
|
heading: context ? context.trim() : '',
|
|
}
|
|
},
|
|
peg$c35 = ",",
|
|
peg$c36 = peg$literalExpectation(",", false),
|
|
peg$c37 = function(start, count) { return {start, count} },
|
|
peg$c38 = function(start) { return {start, count: 1} },
|
|
peg$c39 = "+",
|
|
peg$c40 = peg$literalExpectation("+", false),
|
|
peg$c41 = "-",
|
|
peg$c42 = peg$literalExpectation("-", false),
|
|
peg$c43 = " ",
|
|
peg$c44 = peg$literalExpectation(" ", false),
|
|
peg$c45 = "\\",
|
|
peg$c46 = peg$literalExpectation("\\", false),
|
|
peg$c47 = function(chars) { return chars.join('') },
|
|
peg$c48 = "diff ",
|
|
peg$c49 = peg$literalExpectation("diff ", false),
|
|
peg$c50 = function(options, file_name) { return {file_name} },
|
|
peg$c51 = function(str) { return str.substr(str.length/2 + 1) },
|
|
peg$c52 = "similarity index ",
|
|
peg$c53 = peg$literalExpectation("similarity index ", false),
|
|
peg$c54 = "%",
|
|
peg$c55 = peg$literalExpectation("%", false),
|
|
peg$c56 = function(idx) { return idx },
|
|
peg$c57 = function(explicit_file_modes, index_file_modes) { return explicit_file_modes || index_file_modes },
|
|
peg$c58 = "new",
|
|
peg$c59 = peg$literalExpectation("new", false),
|
|
peg$c60 = "deleted",
|
|
peg$c61 = peg$literalExpectation("deleted", false),
|
|
peg$c62 = " file mode ",
|
|
peg$c63 = peg$literalExpectation(" file mode ", false),
|
|
peg$c64 = function(type, file_mode) {
|
|
if (type === 'new') return {old_mode: null, new_mode: file_mode}
|
|
else return {old_mode: file_mode, new_mode: null}
|
|
},
|
|
peg$c65 = "old mode ",
|
|
peg$c66 = peg$literalExpectation("old mode ", false),
|
|
peg$c67 = "new mode ",
|
|
peg$c68 = peg$literalExpectation("new mode ", false),
|
|
peg$c69 = function(old_mode, new_mode) { return {old_mode, new_mode} },
|
|
peg$c70 = "rename",
|
|
peg$c71 = peg$literalExpectation("rename", false),
|
|
peg$c72 = "copy",
|
|
peg$c73 = peg$literalExpectation("copy", false),
|
|
peg$c74 = " from ",
|
|
peg$c75 = peg$literalExpectation(" from ", false),
|
|
peg$c76 = function(operation, file) { return {operation, file} },
|
|
peg$c77 = " to ",
|
|
peg$c78 = peg$literalExpectation(" to ", false),
|
|
peg$c79 = "index ",
|
|
peg$c80 = peg$literalExpectation("index ", false),
|
|
peg$c81 = function(file_mode) { return {old_mode: file_mode, new_mode: file_mode} },
|
|
peg$c82 = /^[ \t]/,
|
|
peg$c83 = peg$classExpectation([" ", "\t"], false, false),
|
|
peg$c84 = "\n",
|
|
peg$c85 = peg$literalExpectation("\n", false),
|
|
peg$c86 = "\r\n",
|
|
peg$c87 = peg$literalExpectation("\r\n", false),
|
|
peg$c88 = peg$anyExpectation(),
|
|
peg$c89 = /^[^\r\n]/,
|
|
peg$c90 = peg$classExpectation(["\r", "\n"], true, false),
|
|
peg$c91 = /^[^ \t\r\n]/,
|
|
peg$c92 = peg$classExpectation([" ", "\t", "\r", "\n"], true, false),
|
|
peg$c93 = /^[0-9]/,
|
|
peg$c94 = peg$classExpectation([["0", "9"]], false, false),
|
|
peg$c95 = function(chars) { return parseInt(chars.join(''), 10) },
|
|
|
|
peg$currPos = 0,
|
|
peg$savedPos = 0,
|
|
peg$posDetailsCache = [{ line: 1, column: 1 }],
|
|
peg$maxFailPos = 0,
|
|
peg$maxFailExpected = [],
|
|
peg$silentFails = 0,
|
|
|
|
peg$resultsCache = {},
|
|
|
|
peg$result;
|
|
|
|
if ("startRule" in options) {
|
|
if (!(options.startRule in peg$startRuleFunctions)) {
|
|
throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
}
|
|
|
|
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
}
|
|
|
|
function text() {
|
|
return input.substring(peg$savedPos, peg$currPos);
|
|
}
|
|
|
|
function location() {
|
|
return peg$computeLocation(peg$savedPos, peg$currPos);
|
|
}
|
|
|
|
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
|
|
);
|
|
}
|
|
|
|
function error(message, location) {
|
|
location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
|
|
|
|
throw peg$buildSimpleError(message, location);
|
|
}
|
|
|
|
function peg$literalExpectation(text, ignoreCase) {
|
|
return { type: "literal", text: text, ignoreCase: ignoreCase };
|
|
}
|
|
|
|
function peg$classExpectation(parts, inverted, ignoreCase) {
|
|
return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
|
|
}
|
|
|
|
function peg$anyExpectation() {
|
|
return { type: "any" };
|
|
}
|
|
|
|
function peg$endExpectation() {
|
|
return { type: "end" };
|
|
}
|
|
|
|
function peg$otherExpectation(description) {
|
|
return { type: "other", description: description };
|
|
}
|
|
|
|
function peg$computePosDetails(pos) {
|
|
var details = peg$posDetailsCache[pos], p;
|
|
|
|
if (details) {
|
|
return details;
|
|
} else {
|
|
p = pos - 1;
|
|
while (!peg$posDetailsCache[p]) {
|
|
p--;
|
|
}
|
|
|
|
details = peg$posDetailsCache[p];
|
|
details = {
|
|
line: details.line,
|
|
column: details.column
|
|
};
|
|
|
|
while (p < pos) {
|
|
if (input.charCodeAt(p) === 10) {
|
|
details.line++;
|
|
details.column = 1;
|
|
} else {
|
|
details.column++;
|
|
}
|
|
|
|
p++;
|
|
}
|
|
|
|
peg$posDetailsCache[pos] = details;
|
|
return details;
|
|
}
|
|
}
|
|
|
|
function peg$computeLocation(startPos, endPos) {
|
|
var startPosDetails = peg$computePosDetails(startPos),
|
|
endPosDetails = peg$computePosDetails(endPos);
|
|
|
|
return {
|
|
start: {
|
|
offset: startPos,
|
|
line: startPosDetails.line,
|
|
column: startPosDetails.column
|
|
},
|
|
end: {
|
|
offset: endPos,
|
|
line: endPosDetails.line,
|
|
column: endPosDetails.column
|
|
}
|
|
};
|
|
}
|
|
|
|
function peg$fail(expected) {
|
|
if (peg$currPos < peg$maxFailPos) { return; }
|
|
|
|
if (peg$currPos > peg$maxFailPos) {
|
|
peg$maxFailPos = peg$currPos;
|
|
peg$maxFailExpected = [];
|
|
}
|
|
|
|
peg$maxFailExpected.push(expected);
|
|
}
|
|
|
|
function peg$buildSimpleError(message, location) {
|
|
return new peg$SyntaxError(message, null, null, location);
|
|
}
|
|
|
|
function peg$buildStructuredError(expected, found, location) {
|
|
return new peg$SyntaxError(
|
|
peg$SyntaxError.buildMessage(expected, found),
|
|
expected,
|
|
found,
|
|
location
|
|
);
|
|
}
|
|
|
|
function peg$parsediffs() {
|
|
var s0, s1, s2;
|
|
|
|
var key = peg$currPos * 35 + 0,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
s2 = peg$parsediff();
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
s2 = peg$parsediff();
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c0(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsediff() {
|
|
var s0;
|
|
|
|
var key = peg$currPos * 35 + 1,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$parsebinary_merge_conflict_diff();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parserename_or_copy_diff();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsemerge_conflict_diff();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseunmerged_path();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parsebinary_diff();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseregular_diff();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsebinary_diff() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
var key = peg$currPos * 35 + 2,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsediff_header_line();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsefile_mode_section();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = null;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsepatch_header();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsebinary_declaration();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c1(s1, s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsebinary_declaration() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 3,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 13) === peg$c2) {
|
|
s1 = peg$c2;
|
|
peg$currPos += 13;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c3); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseNL();
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseregular_diff() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 4,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsediff_header_line();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsefile_mode_section();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = null;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsepatch();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c4(s1, s2, s3);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsebinary_merge_conflict_diff() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 5,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsemerge_conflict_header_line();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseindex_line();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsebinary_declaration();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c5(s1);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parserename_or_copy_diff() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
var key = peg$currPos * 35 + 6,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parserename_or_copy_diff_header_line();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsechanged_file_modes();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = null;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsesimilarity_index();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parserename_copy_from();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parserename_copy_to();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseindex_line();
|
|
if (s6 === peg$FAILED) {
|
|
s6 = null;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parsebinary_declaration();
|
|
if (s7 === peg$FAILED) {
|
|
s7 = peg$parsepatch();
|
|
}
|
|
if (s7 === peg$FAILED) {
|
|
s7 = null;
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c6(s2, s3, s4, s5, s6, s7);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemerge_conflict_diff() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 7,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsemerge_conflict_header_line();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseindex_line();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parsepatch();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c7(s1, s3);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemerge_conflict_header_line() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 8,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 10) === peg$c8) {
|
|
s1 = peg$c8;
|
|
peg$currPos += 10;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c9); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseNL();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c10(s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseunmerged_path() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 9,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 16) === peg$c11) {
|
|
s1 = peg$c11;
|
|
peg$currPos += 16;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c12); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseNL();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c13(s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepatch() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 10,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsepatch_header();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parsehunk();
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parsehunk();
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c14(s1, s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsepatch_header() {
|
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
var key = peg$currPos * 35 + 11,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4) === peg$c15) {
|
|
s1 = peg$c15;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c16); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseNL();
|
|
if (s3 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4) === peg$c17) {
|
|
s4 = peg$c17;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c18); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseTEXT();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseNL();
|
|
if (s6 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c19(s2, s5);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsehunk() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 12,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsehunk_header();
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = [];
|
|
s3 = peg$parsehunk_line();
|
|
if (s3 !== peg$FAILED) {
|
|
while (s3 !== peg$FAILED) {
|
|
s2.push(s3);
|
|
s3 = peg$parsehunk_line();
|
|
}
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c20(s1, s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsehunk_header() {
|
|
var s0;
|
|
|
|
var key = peg$currPos * 35 + 13,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$parsemerge_conflict_hunk_header();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseregular_hunk_header();
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsemerge_conflict_hunk_header() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
|
|
|
var key = peg$currPos * 35 + 14,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5) === peg$c21) {
|
|
s1 = peg$c21;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c22); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsehunk_range();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c23) {
|
|
s3 = peg$c23;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c24); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsehunk_range();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c25) {
|
|
s5 = peg$c25;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c26); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parsehunk_range();
|
|
if (s6 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4) === peg$c27) {
|
|
s7 = peg$c27;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s7 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c28); }
|
|
}
|
|
if (s7 !== peg$FAILED) {
|
|
s8 = peg$parseTEXT();
|
|
if (s8 === peg$FAILED) {
|
|
s8 = null;
|
|
}
|
|
if (s8 !== peg$FAILED) {
|
|
s9 = peg$parseNL();
|
|
if (s9 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c29(s2, s4, s6, s8);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseregular_hunk_header() {
|
|
var s0, s1, s2, s3, s4, s5, s6, s7;
|
|
|
|
var key = peg$currPos * 35 + 15,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 4) === peg$c30) {
|
|
s1 = peg$c30;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c31); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parsehunk_range();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c25) {
|
|
s3 = peg$c25;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c26); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsehunk_range();
|
|
if (s4 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 3) === peg$c32) {
|
|
s5 = peg$c32;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s5 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c33); }
|
|
}
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseTEXT();
|
|
if (s6 === peg$FAILED) {
|
|
s6 = null;
|
|
}
|
|
if (s6 !== peg$FAILED) {
|
|
s7 = peg$parseNL();
|
|
if (s7 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c34(s2, s4, s6);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsehunk_range() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 16,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseNUMBER();
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 44) {
|
|
s2 = peg$c35;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c36); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseNUMBER();
|
|
if (s3 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c37(s1, s3);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseNUMBER();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c38(s1);
|
|
}
|
|
s0 = s1;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsehunk_line() {
|
|
var s0, s1, s2, s3;
|
|
|
|
var key = peg$currPos * 35 + 17,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$currPos;
|
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
s2 = peg$c39;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c40); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 45) {
|
|
s2 = peg$c41;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c42); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s2 = peg$c43;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
|
}
|
|
if (s2 === peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 92) {
|
|
s2 = peg$c45;
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c46); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseTEXT();
|
|
if (s3 === peg$FAILED) {
|
|
s3 = null;
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s2 = [s2, s3];
|
|
s1 = s2;
|
|
} else {
|
|
peg$currPos = s1;
|
|
s1 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s1;
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseNL();
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c47(s1);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsediff_header_line() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
var key = peg$currPos * 35 + 18,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5) === peg$c48) {
|
|
s1 = peg$c48;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT_NO_SPACES();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s3 = peg$c43;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parsefile_name_str();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseNL();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c50(s2, s4);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parserename_or_copy_diff_header_line() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
var key = peg$currPos * 35 + 19,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 5) === peg$c48) {
|
|
s1 = peg$c48;
|
|
peg$currPos += 5;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c49); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT_NO_SPACES();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s3 = peg$c43;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseTEXT();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseNL();
|
|
if (s5 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3, s4, s5];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsefile_name_str() {
|
|
var s0, s1;
|
|
|
|
var key = peg$currPos * 35 + 20,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parseTEXT();
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c51(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsesimilarity_index() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
var key = peg$currPos * 35 + 21,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 17) === peg$c52) {
|
|
s1 = peg$c52;
|
|
peg$currPos += 17;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c53); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseNUMBER();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 37) {
|
|
s3 = peg$c54;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseNL();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c56(s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsefile_mode_section() {
|
|
var s0, s1, s2;
|
|
|
|
var key = peg$currPos * 35 + 22,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = peg$parsenew_or_deleted_file_mode();
|
|
if (s1 === peg$FAILED) {
|
|
s1 = peg$parsechanged_file_modes();
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
s1 = null;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseindex_line();
|
|
if (s2 === peg$FAILED) {
|
|
s2 = null;
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c57(s1, s2);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsenew_or_deleted_file_mode() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
var key = peg$currPos * 35 + 23,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 3) === peg$c58) {
|
|
s1 = peg$c58;
|
|
peg$currPos += 3;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c59); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 7) === peg$c60) {
|
|
s1 = peg$c60;
|
|
peg$currPos += 7;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c61); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 11) === peg$c62) {
|
|
s2 = peg$c62;
|
|
peg$currPos += 11;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c63); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseTEXT();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseNL();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c64(s1, s3);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parsechanged_file_modes() {
|
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
|
|
var key = peg$currPos * 35 + 24,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 9) === peg$c65) {
|
|
s1 = peg$c65;
|
|
peg$currPos += 9;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c66); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseNL();
|
|
if (s3 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 9) === peg$c67) {
|
|
s4 = peg$c67;
|
|
peg$currPos += 9;
|
|
} else {
|
|
s4 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c68); }
|
|
}
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseTEXT();
|
|
if (s5 !== peg$FAILED) {
|
|
s6 = peg$parseNL();
|
|
if (s6 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c69(s2, s5);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parserename_copy_from() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
var key = peg$currPos * 35 + 25,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6) === peg$c70) {
|
|
s1 = peg$c70;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c71); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4) === peg$c72) {
|
|
s1 = peg$c72;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c73); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 6) === peg$c74) {
|
|
s2 = peg$c74;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c75); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseTEXT();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseNL();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c76(s1, s3);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parserename_copy_to() {
|
|
var s0, s1, s2, s3, s4;
|
|
|
|
var key = peg$currPos * 35 + 26,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6) === peg$c70) {
|
|
s1 = peg$c70;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c71); }
|
|
}
|
|
if (s1 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4) === peg$c72) {
|
|
s1 = peg$c72;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c73); }
|
|
}
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
if (input.substr(peg$currPos, 4) === peg$c77) {
|
|
s2 = peg$c77;
|
|
peg$currPos += 4;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c78); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseTEXT();
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseNL();
|
|
if (s4 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c76(s1, s3);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseindex_line() {
|
|
var s0, s1, s2, s3, s4, s5;
|
|
|
|
var key = peg$currPos * 35 + 27,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6) === peg$c79) {
|
|
s1 = peg$c79;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c80); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT_NO_SPACES();
|
|
if (s2 !== peg$FAILED) {
|
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
s3 = peg$c43;
|
|
peg$currPos++;
|
|
} else {
|
|
s3 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
|
}
|
|
if (s3 !== peg$FAILED) {
|
|
s4 = peg$parseTEXT();
|
|
if (s4 !== peg$FAILED) {
|
|
s5 = peg$parseNL();
|
|
if (s5 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c81(s4);
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$currPos;
|
|
if (input.substr(peg$currPos, 6) === peg$c79) {
|
|
s1 = peg$c79;
|
|
peg$currPos += 6;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c80); }
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
s2 = peg$parseTEXT_NO_SPACES();
|
|
if (s2 !== peg$FAILED) {
|
|
s3 = peg$parseNL();
|
|
if (s3 !== peg$FAILED) {
|
|
s1 = [s1, s2, s3];
|
|
s0 = s1;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseS() {
|
|
var s0;
|
|
|
|
var key = peg$currPos * 35 + 28,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
if (peg$c82.test(input.charAt(peg$currPos))) {
|
|
s0 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c83); }
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseNL() {
|
|
var s0;
|
|
|
|
var key = peg$currPos * 35 + 29,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
if (input.charCodeAt(peg$currPos) === 10) {
|
|
s0 = peg$c84;
|
|
peg$currPos++;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c85); }
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
if (input.substr(peg$currPos, 2) === peg$c86) {
|
|
s0 = peg$c86;
|
|
peg$currPos += 2;
|
|
} else {
|
|
s0 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c87); }
|
|
}
|
|
}
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseEOF();
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseNLS() {
|
|
var s0;
|
|
|
|
var key = peg$currPos * 35 + 30,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$parseNL();
|
|
if (s0 === peg$FAILED) {
|
|
s0 = peg$parseS();
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseEOF() {
|
|
var s0, s1;
|
|
|
|
var key = peg$currPos * 35 + 31,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
peg$silentFails++;
|
|
if (input.length > peg$currPos) {
|
|
s1 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c88); }
|
|
}
|
|
peg$silentFails--;
|
|
if (s1 === peg$FAILED) {
|
|
s0 = void 0;
|
|
} else {
|
|
peg$currPos = s0;
|
|
s0 = peg$FAILED;
|
|
}
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseTEXT() {
|
|
var s0, s1, s2;
|
|
|
|
var key = peg$currPos * 35 + 32,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
if (peg$c89.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
if (peg$c89.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c90); }
|
|
}
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c47(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseTEXT_NO_SPACES() {
|
|
var s0, s1, s2;
|
|
|
|
var key = peg$currPos * 35 + 33,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
if (peg$c91.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c92); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
if (peg$c91.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c92); }
|
|
}
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c47(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
function peg$parseNUMBER() {
|
|
var s0, s1, s2;
|
|
|
|
var key = peg$currPos * 35 + 34,
|
|
cached = peg$resultsCache[key];
|
|
|
|
if (cached) {
|
|
peg$currPos = cached.nextPos;
|
|
|
|
return cached.result;
|
|
}
|
|
|
|
s0 = peg$currPos;
|
|
s1 = [];
|
|
if (peg$c93.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
|
}
|
|
if (s2 !== peg$FAILED) {
|
|
while (s2 !== peg$FAILED) {
|
|
s1.push(s2);
|
|
if (peg$c93.test(input.charAt(peg$currPos))) {
|
|
s2 = input.charAt(peg$currPos);
|
|
peg$currPos++;
|
|
} else {
|
|
s2 = peg$FAILED;
|
|
if (peg$silentFails === 0) { peg$fail(peg$c94); }
|
|
}
|
|
}
|
|
} else {
|
|
s1 = peg$FAILED;
|
|
}
|
|
if (s1 !== peg$FAILED) {
|
|
peg$savedPos = s0;
|
|
s1 = peg$c95(s1);
|
|
}
|
|
s0 = s1;
|
|
|
|
peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
|
|
|
|
return s0;
|
|
}
|
|
|
|
|
|
function postProcessDiff (header, file_modes, patch, binary) {
|
|
let status
|
|
if (file_modes.old_mode && !file_modes.new_mode) {
|
|
return {
|
|
newPath: null,
|
|
oldPath: header.file_name,
|
|
newMode: null,
|
|
oldMode: file_modes.old_mode,
|
|
hunks: patch ? patch.hunks : [],
|
|
status: 'deleted',
|
|
binary: !!binary
|
|
}
|
|
} else if (!file_modes.old_mode && file_modes.new_mode) {
|
|
return {
|
|
oldPath: null,
|
|
newPath: header.file_name,
|
|
oldMode: null,
|
|
newMode: file_modes.new_mode,
|
|
hunks: patch ? patch.hunks : [],
|
|
status: 'added',
|
|
binary: !!binary
|
|
}
|
|
} else if (file_modes.old_mode && file_modes.new_mode) {
|
|
return {
|
|
newPath: header.file_name,
|
|
oldPath: header.file_name,
|
|
oldMode: file_modes.old_mode,
|
|
newMode: file_modes.new_mode,
|
|
hunks: patch ? patch.hunks : [],
|
|
status: 'modified',
|
|
binary: !!binary
|
|
}
|
|
} else {
|
|
throw new Error('file modes missing')
|
|
}
|
|
}
|
|
|
|
function postProcessMergeConflictDiff (filePath, patch, binary) {
|
|
patch = patch || {}
|
|
patch.filePath = filePath
|
|
patch.status = 'unmerged'
|
|
patch.binary = !!binary
|
|
return patch
|
|
}
|
|
|
|
function postProcessSimilarityDiff (rename_or_copy, similarity_index, old_file, new_file, file_modes, patch) {
|
|
const diff = {
|
|
oldPath: old_file,
|
|
newPath: new_file,
|
|
hunks: patch ? patch.hunks : [],
|
|
status: rename_or_copy === 'copy' ? 'copied' : 'renamed',
|
|
similarity: similarity_index,
|
|
}
|
|
if (file_modes) {
|
|
diff.oldMode = file_modes.old_mode
|
|
diff.newMode = file_modes.new_mode
|
|
}
|
|
return diff
|
|
}
|
|
|
|
|
|
peg$result = peg$startRuleFunction();
|
|
|
|
if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
|
return peg$result;
|
|
} 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)
|
|
);
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
SyntaxError: peg$SyntaxError,
|
|
parse: peg$parse
|
|
};
|