1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

Merge branch 'master' into show-empty-space

This commit is contained in:
joshvera 2015-10-29 15:11:20 -04:00
commit c8e12176e3
5 changed files with 14 additions and 74495 deletions

3
.gitmodules vendored
View File

@ -13,3 +13,6 @@
[submodule "prototype/External/tree-sitter"] [submodule "prototype/External/tree-sitter"]
path = prototype/External/tree-sitter path = prototype/External/tree-sitter
url = https://github.com/maxbrunsfeld/tree-sitter.git url = https://github.com/maxbrunsfeld/tree-sitter.git
[submodule "prototype/External/node-tree-sitter-javascript"]
path = prototype/External/node-tree-sitter-javascript
url = https://github.com/maxbrunsfeld/node-tree-sitter-javascript.git

View File

@ -60,8 +60,8 @@
D4FB2CDA1BDEBC9D00B3CCE0 /* Stream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D42F096A1BCCC41600B95610 /* Stream.framework */; }; D4FB2CDA1BDEBC9D00B3CCE0 /* Stream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D42F096A1BCCC41600B95610 /* Stream.framework */; };
D4FB2CDC1BDEBCCD00B3CCE0 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */; }; D4FB2CDC1BDEBCCD00B3CCE0 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */; };
D4FB2CE01BDEBD1C00B3CCE0 /* libruntime.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D4FB2CDE1BDEBD1C00B3CCE0 /* libruntime.a */; }; D4FB2CE01BDEBD1C00B3CCE0 /* libruntime.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D4FB2CDE1BDEBD1C00B3CCE0 /* libruntime.a */; };
D4FB2CEA1BDEC7FA00B3CCE0 /* javascript.c in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CE91BDEC7FA00B3CCE0 /* javascript.c */; };
D4FB2CF81BE1560400B3CCE0 /* TSNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CF71BE1560400B3CCE0 /* TSNode.swift */; }; D4FB2CF81BE1560400B3CCE0 /* TSNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CF71BE1560400B3CCE0 /* TSNode.swift */; };
D4FB2CFA1BE28F6D00B3CCE0 /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CF91BE28F6D00B3CCE0 /* parser.c */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@ -128,8 +128,8 @@
D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; }; D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
D4FB2CDE1BDEBD1C00B3CCE0 /* libruntime.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libruntime.a; path = "External/tree-sitter/out/Release/libruntime.a"; sourceTree = SOURCE_ROOT; }; D4FB2CDE1BDEBD1C00B3CCE0 /* libruntime.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libruntime.a; path = "External/tree-sitter/out/Release/libruntime.a"; sourceTree = SOURCE_ROOT; };
D4FB2CE51BDEBE7900B3CCE0 /* doubt-difftool-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "doubt-difftool-Bridging-Header.h"; sourceTree = "<group>"; }; D4FB2CE51BDEBE7900B3CCE0 /* doubt-difftool-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "doubt-difftool-Bridging-Header.h"; sourceTree = "<group>"; };
D4FB2CE91BDEC7FA00B3CCE0 /* javascript.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = javascript.c; sourceTree = "<group>"; };
D4FB2CF71BE1560400B3CCE0 /* TSNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TSNode.swift; sourceTree = "<group>"; }; D4FB2CF71BE1560400B3CCE0 /* TSNode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TSNode.swift; sourceTree = "<group>"; };
D4FB2CF91BE28F6D00B3CCE0 /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = parser.c; path = "External/node-tree-sitter-javascript/src/parser.c"; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -282,8 +282,8 @@
children = ( children = (
D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */, D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */,
D4FB2CF71BE1560400B3CCE0 /* TSNode.swift */, D4FB2CF71BE1560400B3CCE0 /* TSNode.swift */,
D4FB2CE91BDEC7FA00B3CCE0 /* javascript.c */,
D4FB2CE51BDEBE7900B3CCE0 /* doubt-difftool-Bridging-Header.h */, D4FB2CE51BDEBE7900B3CCE0 /* doubt-difftool-Bridging-Header.h */,
D4FB2CF91BE28F6D00B3CCE0 /* parser.c */,
D4FB2CDE1BDEBD1C00B3CCE0 /* libruntime.a */, D4FB2CDE1BDEBD1C00B3CCE0 /* libruntime.a */,
); );
path = "doubt-difftool"; path = "doubt-difftool";
@ -509,8 +509,8 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D4FB2CEA1BDEC7FA00B3CCE0 /* javascript.c in Sources */,
D4FB2CF81BE1560400B3CCE0 /* TSNode.swift in Sources */, D4FB2CF81BE1560400B3CCE0 /* TSNode.swift in Sources */,
D4FB2CFA1BE28F6D00B3CCE0 /* parser.c in Sources */,
D4FB2CDC1BDEBCCD00B3CCE0 /* main.swift in Sources */, D4FB2CDC1BDEBCCD00B3CCE0 /* main.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

View File

@ -33,9 +33,14 @@ public func SES<Term, Leaf, Annotation>(a: [Term], _ b: [Term], cost: Free<Leaf,
let diagonal = matrix[i + 1, j + 1] let diagonal = matrix[i + 1, j + 1]
if let right = right, down = down, diagonal = diagonal { if let right = right, down = down, diagonal = diagonal {
let here = recur(a[i], b[j])
// If the diff at this vertex is zero-cost, were not going to find a cheaper one either rightwards or downwards. We can therefore short-circuit selecting the best outgoing edge and save ourselves evaluating the entire row rightwards and the entire column downwards from this point.
//
// Thus, in the best case (two equal sequences), we now complete in O(n + m). However, this optimization only applies to equalities at the beginning of the edit graph; once inequalities are encountered, the remainder of the diff is effectively O(nm).
if let here = here where cost(here) == 0 { return cons(here, rest: diagonal) }
let right = (right, Diff.Delete(a[i]), costOfStream(right)) let right = (right, Diff.Delete(a[i]), costOfStream(right))
let down = (down, Diff.Insert(b[j]), costOfStream(down)) let down = (down, Diff.Insert(b[j]), costOfStream(down))
let diagonal = recur(a[i], b[j]).map { (diagonal, $0, costOfStream(diagonal)) } let diagonal = here.map { (diagonal, $0, costOfStream(diagonal)) }
// nominate the best edge to continue along, not considering diagonal if `recur` returned `nil`. // nominate the best edge to continue along, not considering diagonal if `recur` returned `nil`.
let (best, diff, _) = diagonal let (best, diff, _) = diagonal
.map { min($0, right, down) { $0.2 < $1.2 } } .map { min($0, right, down) { $0.2 < $1.2 } }

@ -0,0 +1 @@
Subproject commit 5acee08f86a848f56560548004422f989169042d

File diff suppressed because it is too large Load Diff