mirror of
https://github.com/github/semantic.git
synced 2024-12-26 08:25:19 +03:00
Diff two terms.
This commit is contained in:
parent
abfe582247
commit
33de066844
@ -1,5 +1,6 @@
|
|||||||
import Cocoa
|
import Cocoa
|
||||||
import Doubt
|
import Doubt
|
||||||
|
import Prelude
|
||||||
|
|
||||||
func readFile(path: String) -> String? {
|
func readFile(path: String) -> String? {
|
||||||
guard let data = try? NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) else { return nil }
|
guard let data = try? NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) else { return nil }
|
||||||
@ -33,6 +34,8 @@ func termWithInput(string: String) -> Term? {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let arguments = BoundsCheckedArray(array: Process.arguments)
|
let arguments = BoundsCheckedArray(array: Process.arguments)
|
||||||
if let a = arguments[1].flatMap(readFile).flatMap(termWithInput) {
|
if let aString = arguments[1].flatMap(readFile), bString = arguments[2].flatMap(readFile), c = arguments[3] {
|
||||||
print(a)
|
if let a = termWithInput(aString), b = termWithInput(bString) {
|
||||||
|
let diff = Interpreter<Term>(equal: Term.equals(annotation: const(true), leaf: ==), comparable: const(true), cost: Free.sum(Patch.difference)).run(a, b)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user