1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Get the language out of the table.

This commit is contained in:
Rob Rix 2015-10-29 15:33:52 -04:00
parent aa78a266dd
commit 1d077f60d5

View File

@ -76,6 +76,7 @@ let arguments = BoundsCheckedArray(array: Process.arguments)
if let aURL = arguments[1].flatMap(NSURL.init), aString = readFile(aURL), bURL = arguments[2].flatMap(NSURL.init), bString = readFile(bURL), c = arguments[3], ui = arguments[4] {
guard let aType = aURL.pathExtension, bType = bURL.pathExtension else { throw "cant tell what type we have here" }
guard aType == bType else { throw "cant compare files of different types" }
guard let language = languagesByFileExtension[aType] else { throw "dont know how to parse files of type \(aType)" }
let parser: String -> Term? = termWithInput(ts_language_javascript())
if let a = parser(aString), b = parser(bString) {
let diff = Interpreter<Term>(equal: Term.equals(annotation: const(true), leaf: ==), comparable: Interpreter<Term>.comparable { $0.extract.categories }, cost: Free.sum(Patch.sum)).run(a, b)