mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Merge branch 'master' into show-empty-space
This commit is contained in:
commit
c8e12176e3
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,3 +13,6 @@
|
||||
[submodule "prototype/External/tree-sitter"]
|
||||
path = prototype/External/tree-sitter
|
||||
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
|
||||
|
@ -60,8 +60,8 @@
|
||||
D4FB2CDA1BDEBC9D00B3CCE0 /* Stream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D42F096A1BCCC41600B95610 /* Stream.framework */; };
|
||||
D4FB2CDC1BDEBCCD00B3CCE0 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */; };
|
||||
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 */; };
|
||||
D4FB2CFA1BE28F6D00B3CCE0 /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = D4FB2CF91BE28F6D00B3CCE0 /* parser.c */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -128,8 +128,8 @@
|
||||
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; };
|
||||
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>"; };
|
||||
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 */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -282,8 +282,8 @@
|
||||
children = (
|
||||
D4FB2CDB1BDEBCCD00B3CCE0 /* main.swift */,
|
||||
D4FB2CF71BE1560400B3CCE0 /* TSNode.swift */,
|
||||
D4FB2CE91BDEC7FA00B3CCE0 /* javascript.c */,
|
||||
D4FB2CE51BDEBE7900B3CCE0 /* doubt-difftool-Bridging-Header.h */,
|
||||
D4FB2CF91BE28F6D00B3CCE0 /* parser.c */,
|
||||
D4FB2CDE1BDEBD1C00B3CCE0 /* libruntime.a */,
|
||||
);
|
||||
path = "doubt-difftool";
|
||||
@ -509,8 +509,8 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
D4FB2CEA1BDEC7FA00B3CCE0 /* javascript.c in Sources */,
|
||||
D4FB2CF81BE1560400B3CCE0 /* TSNode.swift in Sources */,
|
||||
D4FB2CFA1BE28F6D00B3CCE0 /* parser.c in Sources */,
|
||||
D4FB2CDC1BDEBCCD00B3CCE0 /* main.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -33,9 +33,14 @@ public func SES<Term, Leaf, Annotation>(a: [Term], _ b: [Term], cost: Free<Leaf,
|
||||
let diagonal = matrix[i + 1, j + 1]
|
||||
|
||||
if let right = right, down = down, diagonal = diagonal {
|
||||
let here = recur(a[i], b[j])
|
||||
// If the diff at this vertex is zero-cost, we’re 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 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`.
|
||||
let (best, diff, _) = diagonal
|
||||
.map { min($0, right, down) { $0.2 < $1.2 } }
|
||||
|
1
prototype/External/node-tree-sitter-javascript
vendored
Submodule
1
prototype/External/node-tree-sitter-javascript
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5acee08f86a848f56560548004422f989169042d
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user