mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Allow the fragment to specify a type.
This commit is contained in:
parent
ff760d67b3
commit
ec579b2053
@ -18,8 +18,9 @@ typealias Parser = String throws -> Term
|
||||
|
||||
struct Source {
|
||||
init(_ argument: String) throws {
|
||||
URL = NSURL(string: argument) ?? NSURL(fileURLWithPath: argument)
|
||||
guard let type = URL.pathExtension else { throw "cannot tell the type of \(URL)" }
|
||||
let URL = NSURL(string: argument) ?? NSURL(fileURLWithPath: argument)
|
||||
guard let type = URL.pathExtension ?? URL.fragment else { throw "cannot tell the type of \(URL)" }
|
||||
self.URL = URL
|
||||
self.type = type
|
||||
contents = try NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding) as String
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user