1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 17:04:47 +03:00

Abstract a function to select the parser.

This commit is contained in:
Rob Rix 2015-10-30 13:58:19 -04:00
parent 2dc23c1409
commit d1d59c61ac

View File

@ -82,6 +82,10 @@ func termWithInput(language: TSLanguage)(_ string: String) throws -> Term {
}
}
func parserForType(type: String) -> (String throws -> Term)? {
return Source.languagesByType[type].map(termWithInput)
}
let arguments = BoundsCheckedArray(array: Process.arguments)
guard let aSource = try arguments[1].map(Source.init) else { throw "need source A" }
guard let bSource = try arguments[2].map(Source.init) else { throw "need source B" }