From 1d077f60d57c5271b911c459af7d2e58acfdd7c4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 29 Oct 2015 15:33:52 -0400 Subject: [PATCH] Get the language out of the table. --- prototype/doubt-difftool/main.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/prototype/doubt-difftool/main.swift b/prototype/doubt-difftool/main.swift index 7552f3e9f..e35e67f51 100644 --- a/prototype/doubt-difftool/main.swift +++ b/prototype/doubt-difftool/main.swift @@ -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(equal: Term.equals(annotation: const(true), leaf: ==), comparable: Interpreter.comparable { $0.extract.categories }, cost: Free.sum(Patch.sum)).run(a, b)