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:
parent
2dc23c1409
commit
d1d59c61ac
@ -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" }
|
||||
|
Loading…
Reference in New Issue
Block a user