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:
parent
aa78a266dd
commit
1d077f60d5
@ -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 "can’t tell what type we have here" }
|
||||
guard aType == bType else { throw "can’t compare files of different types" }
|
||||
guard let language = languagesByFileExtension[aType] else { throw "don’t 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)
|
||||
|
Loading…
Reference in New Issue
Block a user