what-the-diff
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -150,16 +150,19 @@ /* | ||
peg$c5 = function(path) { return postProcessMergeConflictDiff(path, undefined, true) }, | ||
peg$c6 = function(path, patch) { return postProcessMergeConflictDiff(path, patch) }, | ||
peg$c7 = "diff --cc ", | ||
peg$c8 = peg$literalExpectation("diff --cc ", false), | ||
peg$c9 = function(path) { return path }, | ||
peg$c10 = "* Unmerged path ", | ||
peg$c11 = peg$literalExpectation("* Unmerged path ", false), | ||
peg$c12 = function(path) { return postProcessMergeConflictDiff(path) }, | ||
peg$c13 = function(header, hunks) { return {hunks} }, | ||
peg$c14 = "--- ", | ||
peg$c15 = peg$literalExpectation("--- ", false), | ||
peg$c16 = "+++ ", | ||
peg$c17 = peg$literalExpectation("+++ ", false), | ||
peg$c18 = function(old_file_name, new_file_name) { return {old_file_name, new_file_name} }, | ||
peg$c19 = function(header, lines) { | ||
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, { | ||
@@ -169,11 +172,11 @@ lines: lines | ||
}, | ||
peg$c20 = "@@@ -", | ||
peg$c21 = peg$literalExpectation("@@@ -", false), | ||
peg$c22 = " -", | ||
peg$c23 = peg$literalExpectation(" -", false), | ||
peg$c24 = " +", | ||
peg$c25 = peg$literalExpectation(" +", false), | ||
peg$c26 = " @@@", | ||
peg$c27 = peg$literalExpectation(" @@@", false), | ||
peg$c28 = function(our_range, base_range, their_range, context) { | ||
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 { | ||
@@ -189,7 +192,7 @@ ourStartLine: our_range.start, | ||
}, | ||
peg$c29 = "@@ -", | ||
peg$c30 = peg$literalExpectation("@@ -", false), | ||
peg$c31 = " @@", | ||
peg$c32 = peg$literalExpectation(" @@", false), | ||
peg$c33 = function(old_range, new_range, context) { | ||
peg$c30 = "@@ -", | ||
peg$c31 = peg$literalExpectation("@@ -", false), | ||
peg$c32 = " @@", | ||
peg$c33 = peg$literalExpectation(" @@", false), | ||
peg$c34 = function(old_range, new_range, context) { | ||
return { | ||
@@ -203,52 +206,66 @@ oldStartLine: old_range.start, | ||
}, | ||
peg$c34 = ",", | ||
peg$c35 = peg$literalExpectation(",", false), | ||
peg$c36 = function(start, count) { return {start, count} }, | ||
peg$c37 = function(start) { return {start, count: 1} }, | ||
peg$c38 = "+", | ||
peg$c39 = peg$literalExpectation("+", false), | ||
peg$c40 = "-", | ||
peg$c41 = peg$literalExpectation("-", false), | ||
peg$c42 = " ", | ||
peg$c43 = peg$literalExpectation(" ", false), | ||
peg$c44 = "\\", | ||
peg$c45 = peg$literalExpectation("\\", false), | ||
peg$c46 = function(chars) { return chars.join('') }, | ||
peg$c47 = "diff ", | ||
peg$c48 = peg$literalExpectation("diff ", false), | ||
peg$c49 = function(options, file_name) { return {file_name} }, | ||
peg$c50 = function(str) { return str.substr(str.length/2 + 1) }, | ||
peg$c51 = function(explicit_file_modes, index_file_modes) { return explicit_file_modes || index_file_modes }, | ||
peg$c52 = "new", | ||
peg$c53 = peg$literalExpectation("new", false), | ||
peg$c54 = "deleted", | ||
peg$c55 = peg$literalExpectation("deleted", false), | ||
peg$c56 = " file mode ", | ||
peg$c57 = peg$literalExpectation(" file mode ", false), | ||
peg$c58 = function(type, file_mode) { | ||
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$c59 = "old mode ", | ||
peg$c60 = peg$literalExpectation("old mode ", false), | ||
peg$c61 = "new mode ", | ||
peg$c62 = peg$literalExpectation("new mode ", false), | ||
peg$c63 = function(old_mode, new_mode) { return {old_mode, new_mode} }, | ||
peg$c64 = "index ", | ||
peg$c65 = peg$literalExpectation("index ", false), | ||
peg$c66 = function(file_mode) { return {old_mode: file_mode, new_mode: file_mode} }, | ||
peg$c67 = /^[ \t]/, | ||
peg$c68 = peg$classExpectation([" ", "\t"], false, false), | ||
peg$c69 = "\n", | ||
peg$c70 = peg$literalExpectation("\n", false), | ||
peg$c71 = "\r\n", | ||
peg$c72 = peg$literalExpectation("\r\n", false), | ||
peg$c73 = peg$anyExpectation(), | ||
peg$c74 = /^[^\r\n]/, | ||
peg$c75 = peg$classExpectation(["\r", "\n"], true, false), | ||
peg$c76 = /^[^ \t\r\n]/, | ||
peg$c77 = peg$classExpectation([" ", "\t", "\r", "\n"], true, false), | ||
peg$c78 = /^[0-9]/, | ||
peg$c79 = peg$classExpectation([["0", "9"]], false, false), | ||
peg$c80 = function(chars) { return parseInt(chars.join(''), 10) }, | ||
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) }, | ||
@@ -396,3 +413,3 @@ peg$currPos = 0, | ||
var key = peg$currPos * 30 + 0, | ||
var key = peg$currPos * 35 + 0, | ||
cached = peg$resultsCache[key]; | ||
@@ -427,3 +444,3 @@ | ||
var key = peg$currPos * 30 + 1, | ||
var key = peg$currPos * 35 + 1, | ||
cached = peg$resultsCache[key]; | ||
@@ -439,9 +456,12 @@ | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsemerge_conflict_diff(); | ||
s0 = peg$parserename_or_copy_diff(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseunmerged_path(); | ||
s0 = peg$parsemerge_conflict_diff(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parsebinary_diff(); | ||
s0 = peg$parseunmerged_path(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseregular_diff(); | ||
s0 = peg$parsebinary_diff(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseregular_diff(); | ||
} | ||
} | ||
@@ -460,3 +480,3 @@ } | ||
var key = peg$currPos * 30 + 2, | ||
var key = peg$currPos * 35 + 2, | ||
cached = peg$resultsCache[key]; | ||
@@ -504,3 +524,3 @@ | ||
var key = peg$currPos * 30 + 3, | ||
var key = peg$currPos * 35 + 3, | ||
cached = peg$resultsCache[key]; | ||
@@ -550,3 +570,3 @@ | ||
var key = peg$currPos * 30 + 4, | ||
var key = peg$currPos * 35 + 4, | ||
cached = peg$resultsCache[key]; | ||
@@ -597,3 +617,3 @@ | ||
var key = peg$currPos * 30 + 5, | ||
var key = peg$currPos * 35 + 5, | ||
cached = peg$resultsCache[key]; | ||
@@ -635,6 +655,79 @@ | ||
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$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 * 30 + 6, | ||
var key = peg$currPos * 35 + 7, | ||
cached = peg$resultsCache[key]; | ||
@@ -659,3 +752,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c6(s1, s3); | ||
s1 = peg$c7(s1, s3); | ||
s0 = s1; | ||
@@ -683,3 +776,3 @@ } else { | ||
var key = peg$currPos * 30 + 7, | ||
var key = peg$currPos * 35 + 8, | ||
cached = peg$resultsCache[key]; | ||
@@ -694,8 +787,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 10) === peg$c7) { | ||
s1 = peg$c7; | ||
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$c8); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c9); } | ||
} | ||
@@ -708,3 +801,3 @@ if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c9(s2); | ||
s1 = peg$c10(s2); | ||
s0 = s1; | ||
@@ -732,3 +825,3 @@ } else { | ||
var key = peg$currPos * 30 + 8, | ||
var key = peg$currPos * 35 + 9, | ||
cached = peg$resultsCache[key]; | ||
@@ -743,8 +836,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 16) === peg$c10) { | ||
s1 = peg$c10; | ||
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$c11); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c12); } | ||
} | ||
@@ -757,3 +850,3 @@ if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c12(s2); | ||
s1 = peg$c13(s2); | ||
s0 = s1; | ||
@@ -781,3 +874,3 @@ } else { | ||
var key = peg$currPos * 30 + 9, | ||
var key = peg$currPos * 35 + 10, | ||
cached = peg$resultsCache[key]; | ||
@@ -796,13 +889,9 @@ | ||
s3 = peg$parsehunk(); | ||
if (s3 !== peg$FAILED) { | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsehunk(); | ||
} | ||
} else { | ||
s2 = peg$FAILED; | ||
while (s3 !== peg$FAILED) { | ||
s2.push(s3); | ||
s3 = peg$parsehunk(); | ||
} | ||
if (s2 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c13(s1, s2); | ||
s1 = peg$c14(s1, s2); | ||
s0 = s1; | ||
@@ -826,3 +915,3 @@ } else { | ||
var key = peg$currPos * 30 + 10, | ||
var key = peg$currPos * 35 + 11, | ||
cached = peg$resultsCache[key]; | ||
@@ -837,8 +926,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 4) === peg$c14) { | ||
s1 = peg$c14; | ||
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$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
@@ -850,8 +939,8 @@ if (s1 !== peg$FAILED) { | ||
if (s3 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 4) === peg$c16) { | ||
s4 = peg$c16; | ||
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$c17); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c18); } | ||
} | ||
@@ -864,3 +953,3 @@ if (s4 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c18(s2, s5); | ||
s1 = peg$c19(s2, s5); | ||
s0 = s1; | ||
@@ -900,3 +989,3 @@ } else { | ||
var key = peg$currPos * 30 + 11, | ||
var key = peg$currPos * 35 + 12, | ||
cached = peg$resultsCache[key]; | ||
@@ -925,3 +1014,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c19(s1, s2); | ||
s1 = peg$c20(s1, s2); | ||
s0 = s1; | ||
@@ -945,3 +1034,3 @@ } else { | ||
var key = peg$currPos * 30 + 12, | ||
var key = peg$currPos * 35 + 13, | ||
cached = peg$resultsCache[key]; | ||
@@ -968,3 +1057,3 @@ | ||
var key = peg$currPos * 30 + 13, | ||
var key = peg$currPos * 35 + 14, | ||
cached = peg$resultsCache[key]; | ||
@@ -979,8 +1068,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 5) === peg$c20) { | ||
s1 = peg$c20; | ||
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$c21); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
} | ||
@@ -990,8 +1079,8 @@ if (s1 !== peg$FAILED) { | ||
if (s2 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 2) === peg$c22) { | ||
s3 = peg$c22; | ||
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$c23); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
} | ||
@@ -1001,8 +1090,8 @@ if (s3 !== peg$FAILED) { | ||
if (s4 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 2) === peg$c24) { | ||
s5 = peg$c24; | ||
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$c25); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
} | ||
@@ -1012,8 +1101,8 @@ if (s5 !== peg$FAILED) { | ||
if (s6 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 4) === peg$c26) { | ||
s7 = peg$c26; | ||
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$c27); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
} | ||
@@ -1029,3 +1118,3 @@ if (s7 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c28(s2, s4, s6, s8); | ||
s1 = peg$c29(s2, s4, s6, s8); | ||
s0 = s1; | ||
@@ -1077,3 +1166,3 @@ } else { | ||
var key = peg$currPos * 30 + 14, | ||
var key = peg$currPos * 35 + 15, | ||
cached = peg$resultsCache[key]; | ||
@@ -1088,8 +1177,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 4) === peg$c29) { | ||
s1 = peg$c29; | ||
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$c30); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
} | ||
@@ -1099,8 +1188,8 @@ if (s1 !== peg$FAILED) { | ||
if (s2 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 2) === peg$c24) { | ||
s3 = peg$c24; | ||
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$c25); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
} | ||
@@ -1110,8 +1199,8 @@ if (s3 !== peg$FAILED) { | ||
if (s4 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 3) === peg$c31) { | ||
s5 = peg$c31; | ||
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$c32); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
} | ||
@@ -1127,3 +1216,3 @@ if (s5 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c33(s2, s4, s6); | ||
s1 = peg$c34(s2, s4, s6); | ||
s0 = s1; | ||
@@ -1167,3 +1256,3 @@ } else { | ||
var key = peg$currPos * 30 + 15, | ||
var key = peg$currPos * 35 + 16, | ||
cached = peg$resultsCache[key]; | ||
@@ -1181,7 +1270,7 @@ | ||
if (input.charCodeAt(peg$currPos) === 44) { | ||
s2 = peg$c34; | ||
s2 = peg$c35; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c35); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
} | ||
@@ -1192,3 +1281,3 @@ if (s2 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c36(s1, s3); | ||
s1 = peg$c37(s1, s3); | ||
s0 = s1; | ||
@@ -1212,3 +1301,3 @@ } else { | ||
peg$savedPos = s0; | ||
s1 = peg$c37(s1); | ||
s1 = peg$c38(s1); | ||
} | ||
@@ -1226,3 +1315,3 @@ s0 = s1; | ||
var key = peg$currPos * 30 + 16, | ||
var key = peg$currPos * 35 + 17, | ||
cached = peg$resultsCache[key]; | ||
@@ -1239,31 +1328,31 @@ | ||
if (input.charCodeAt(peg$currPos) === 43) { | ||
s2 = peg$c38; | ||
s2 = peg$c39; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c40); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 45) { | ||
s2 = peg$c40; | ||
s2 = peg$c41; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
s2 = peg$c42; | ||
s2 = peg$c43; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
if (s2 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s2 = peg$c44; | ||
s2 = peg$c45; | ||
peg$currPos++; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c45); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c46); } | ||
} | ||
@@ -1293,3 +1382,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$c46(s1); | ||
s1 = peg$c47(s1); | ||
s0 = s1; | ||
@@ -1313,3 +1402,3 @@ } else { | ||
var key = peg$currPos * 30 + 17, | ||
var key = peg$currPos * 35 + 18, | ||
cached = peg$resultsCache[key]; | ||
@@ -1324,8 +1413,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 5) === peg$c47) { | ||
s1 = peg$c47; | ||
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$c48); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
@@ -1336,7 +1425,7 @@ if (s1 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
s3 = peg$c42; | ||
s3 = peg$c43; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
@@ -1349,3 +1438,3 @@ if (s3 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c49(s2, s4); | ||
s1 = peg$c50(s2, s4); | ||
s0 = s1; | ||
@@ -1378,6 +1467,69 @@ } else { | ||
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 * 30 + 18, | ||
var key = peg$currPos * 35 + 20, | ||
cached = peg$resultsCache[key]; | ||
@@ -1395,3 +1547,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c50(s1); | ||
s1 = peg$c51(s1); | ||
} | ||
@@ -1405,6 +1557,64 @@ s0 = s1; | ||
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 * 30 + 19, | ||
var key = peg$currPos * 35 + 22, | ||
cached = peg$resultsCache[key]; | ||
@@ -1433,3 +1643,3 @@ | ||
peg$savedPos = s0; | ||
s1 = peg$c51(s1, s2); | ||
s1 = peg$c57(s1, s2); | ||
s0 = s1; | ||
@@ -1453,3 +1663,3 @@ } else { | ||
var key = peg$currPos * 30 + 20, | ||
var key = peg$currPos * 35 + 23, | ||
cached = peg$resultsCache[key]; | ||
@@ -1464,25 +1674,25 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 3) === peg$c52) { | ||
s1 = peg$c52; | ||
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$c53); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c59); } | ||
} | ||
if (s1 === peg$FAILED) { | ||
if (input.substr(peg$currPos, 7) === peg$c54) { | ||
s1 = peg$c54; | ||
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$c55); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c61); } | ||
} | ||
} | ||
if (s1 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 11) === peg$c56) { | ||
s2 = peg$c56; | ||
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$c57); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c63); } | ||
} | ||
@@ -1495,3 +1705,3 @@ if (s2 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c58(s1, s3); | ||
s1 = peg$c64(s1, s3); | ||
s0 = s1; | ||
@@ -1523,3 +1733,3 @@ } else { | ||
var key = peg$currPos * 30 + 21, | ||
var key = peg$currPos * 35 + 24, | ||
cached = peg$resultsCache[key]; | ||
@@ -1534,8 +1744,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 9) === peg$c59) { | ||
s1 = peg$c59; | ||
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$c60); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c66); } | ||
} | ||
@@ -1547,8 +1757,8 @@ if (s1 !== peg$FAILED) { | ||
if (s3 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 9) === peg$c61) { | ||
s4 = peg$c61; | ||
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$c62); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c68); } | ||
} | ||
@@ -1561,3 +1771,3 @@ if (s4 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c63(s2, s5); | ||
s1 = peg$c69(s2, s5); | ||
s0 = s1; | ||
@@ -1594,6 +1804,140 @@ } else { | ||
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 * 30 + 22, | ||
var key = peg$currPos * 35 + 27, | ||
cached = peg$resultsCache[key]; | ||
@@ -1608,8 +1952,8 @@ | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 6) === peg$c64) { | ||
s1 = peg$c64; | ||
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$c65); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c80); } | ||
} | ||
@@ -1620,7 +1964,7 @@ if (s1 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 32) { | ||
s3 = peg$c42; | ||
s3 = peg$c43; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
@@ -1633,3 +1977,3 @@ if (s3 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$c66(s4); | ||
s1 = peg$c81(s4); | ||
s0 = s1; | ||
@@ -1658,8 +2002,8 @@ } else { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 6) === peg$c64) { | ||
s1 = peg$c64; | ||
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$c65); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c80); } | ||
} | ||
@@ -1695,3 +2039,3 @@ if (s1 !== peg$FAILED) { | ||
var key = peg$currPos * 30 + 23, | ||
var key = peg$currPos * 35 + 28, | ||
cached = peg$resultsCache[key]; | ||
@@ -1705,3 +2049,3 @@ | ||
if (peg$c67.test(input.charAt(peg$currPos))) { | ||
if (peg$c82.test(input.charAt(peg$currPos))) { | ||
s0 = input.charAt(peg$currPos); | ||
@@ -1711,3 +2055,3 @@ peg$currPos++; | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c68); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c83); } | ||
} | ||
@@ -1723,3 +2067,3 @@ | ||
var key = peg$currPos * 30 + 24, | ||
var key = peg$currPos * 35 + 29, | ||
cached = peg$resultsCache[key]; | ||
@@ -1734,15 +2078,15 @@ | ||
if (input.charCodeAt(peg$currPos) === 10) { | ||
s0 = peg$c69; | ||
s0 = peg$c84; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c70); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c85); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (input.substr(peg$currPos, 2) === peg$c71) { | ||
s0 = peg$c71; | ||
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$c72); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c87); } | ||
} | ||
@@ -1762,3 +2106,3 @@ } | ||
var key = peg$currPos * 30 + 25, | ||
var key = peg$currPos * 35 + 30, | ||
cached = peg$resultsCache[key]; | ||
@@ -1785,3 +2129,3 @@ | ||
var key = peg$currPos * 30 + 26, | ||
var key = peg$currPos * 35 + 31, | ||
cached = peg$resultsCache[key]; | ||
@@ -1802,3 +2146,3 @@ | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c73); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c88); } | ||
} | ||
@@ -1821,3 +2165,3 @@ peg$silentFails--; | ||
var key = peg$currPos * 30 + 27, | ||
var key = peg$currPos * 35 + 32, | ||
cached = peg$resultsCache[key]; | ||
@@ -1833,3 +2177,3 @@ | ||
s1 = []; | ||
if (peg$c74.test(input.charAt(peg$currPos))) { | ||
if (peg$c89.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1839,3 +2183,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c75); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c90); } | ||
} | ||
@@ -1845,3 +2189,3 @@ if (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c74.test(input.charAt(peg$currPos))) { | ||
if (peg$c89.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1851,3 +2195,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c75); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c90); } | ||
} | ||
@@ -1860,3 +2204,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$c46(s1); | ||
s1 = peg$c47(s1); | ||
} | ||
@@ -1873,3 +2217,3 @@ s0 = s1; | ||
var key = peg$currPos * 30 + 28, | ||
var key = peg$currPos * 35 + 33, | ||
cached = peg$resultsCache[key]; | ||
@@ -1885,3 +2229,3 @@ | ||
s1 = []; | ||
if (peg$c76.test(input.charAt(peg$currPos))) { | ||
if (peg$c91.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1891,3 +2235,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c77); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c92); } | ||
} | ||
@@ -1897,3 +2241,3 @@ if (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c76.test(input.charAt(peg$currPos))) { | ||
if (peg$c91.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1903,3 +2247,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c77); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c92); } | ||
} | ||
@@ -1912,3 +2256,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$c46(s1); | ||
s1 = peg$c47(s1); | ||
} | ||
@@ -1925,3 +2269,3 @@ s0 = s1; | ||
var key = peg$currPos * 30 + 29, | ||
var key = peg$currPos * 35 + 34, | ||
cached = peg$resultsCache[key]; | ||
@@ -1937,3 +2281,3 @@ | ||
s1 = []; | ||
if (peg$c78.test(input.charAt(peg$currPos))) { | ||
if (peg$c93.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1943,3 +2287,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c79); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c94); } | ||
} | ||
@@ -1949,3 +2293,3 @@ if (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c78.test(input.charAt(peg$currPos))) { | ||
if (peg$c93.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -1955,3 +2299,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c79); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c94); } | ||
} | ||
@@ -1964,3 +2308,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$c80(s1); | ||
s1 = peg$c95(s1); | ||
} | ||
@@ -2020,3 +2364,18 @@ s0 = s1; | ||
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(); | ||
@@ -2023,0 +2382,0 @@ |
{ | ||
"name": "what-the-diff", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "diff parsing library", | ||
@@ -16,2 +16,8 @@ "main": "index.js", | ||
], | ||
"files": [ | ||
"index.js", | ||
"lib/**/*", | ||
"src/**/*", | ||
"test/**/*" | ||
], | ||
"author": "Katrina Uychaco <kuychaco@gmail.com>", | ||
@@ -18,0 +24,0 @@ "license": "MIT", |
@@ -56,1 +56,3 @@ # JavaScript Diff Parser | ||
``` | ||
If the diff includes a similarity index line (from a detected copy or rename), the `similarity` property will be set, and will be a number. |
@@ -545,1 +545,94 @@ var diff = require('../') | ||
} | ||
exports.testRenameCopy = function(test) { | ||
var str = dedent` | ||
diff --git old/file.png new/file.png | ||
similarity index 90% | ||
rename from old/file.png | ||
rename to new/file.png | ||
diff --git copy/file.png copy/file2.png | ||
similarity index 100% | ||
copy from copy/file.png | ||
copy to copy/file2.png | ||
` | ||
const output = diff.parse(str) | ||
assert.deepEqual(output, [ | ||
{ | ||
oldPath: 'old/file.png', | ||
newPath: 'new/file.png', | ||
status: 'renamed', | ||
similarity: 90, | ||
hunks: [], | ||
}, | ||
{ | ||
oldPath: 'copy/file.png', | ||
newPath: 'copy/file2.png', | ||
status: 'copied', | ||
similarity: 100, | ||
hunks: [], | ||
}, | ||
]) | ||
test.done() | ||
} | ||
exports.testRenameWithChangedLinesAndModeChange = function(test) { | ||
var str = dedent` | ||
diff --git file.txt rename-file.txt | ||
old mode 100644 | ||
new mode 100755 | ||
similarity index 76% | ||
rename from file.txt | ||
rename to rename-file.txt | ||
index 471a7b8..3e32ec2 | ||
--- file.txt | ||
+++ rename-file.txt | ||
@@ -1,4 +1,5 @@ | ||
foo | ||
bar | ||
baz | ||
+qux | ||
`; | ||
const output = diff.parse(str) | ||
assert.deepEqual(output, [ | ||
{ | ||
oldPath: "file.txt", | ||
newPath: "rename-file.txt", | ||
oldMode: "100644", | ||
newMode: "100755", | ||
status: "renamed", | ||
similarity: 76, | ||
hunks: [{ | ||
oldStartLine: 1, | ||
oldLineCount: 4, | ||
newStartLine: 1, | ||
newLineCount: 5, | ||
heading: '', | ||
lines: [' foo', ' bar', ' baz', '+qux'] | ||
}] | ||
} | ||
]); | ||
test.done() | ||
} | ||
exports.testMergeConflictNoPatch = function(test) { | ||
var str = dedent` | ||
diff --cc file-0.txt | ||
index 1fbec74,3bfc451..0000000 | ||
--- file-0.txt | ||
+++ file-0.txt | ||
` | ||
const output = diff.parse(str) | ||
assert.deepEqual(output, [ | ||
{ | ||
filePath: 'file-0.txt', | ||
status: 'unmerged', | ||
hunks: [], | ||
binary: false | ||
} | ||
]) | ||
test.done() | ||
} |
Sorry, the diff of this file is not supported yet
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
2607
58
78478
8