1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Do SES on the substrings.

This commit is contained in:
Rob Rix 2015-11-05 16:53:16 -05:00
parent 8872c67c52
commit e9e962dfe5

View File

@ -147,6 +147,11 @@ func parserForType(type: String) -> String throws -> Term {
func refineLeafReplacement(diff: Diff, aString: String, bString: String) -> Diff {
switch diff {
case let .Pure(.Replace(.Unroll(aExtract, .Leaf), .Unroll(bExtract, .Leaf))):
let aSubstring = aString.utf16[aExtract.range]
let bSubstring = bString.utf16[bExtract.range]
let children = SES(aSubstring, bSubstring, cost: const(1)) { (a: (String.UTF16Index, UTF16.CodeUnit), b: (String.UTF16Index, UTF16.CodeUnit)) -> Free<UTF16.CodeUnit, String.UTF16Index, Patch<UTF16.CodeUnit>>? in
return nil
}
return .Roll((aExtract, bExtract), .Indexed([]))
default:
return diff