mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +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 {
|
struct Source {
|
||||||
init(_ argument: String) throws {
|
init(_ argument: String) throws {
|
||||||
URL = NSURL(string: argument) ?? NSURL(fileURLWithPath: argument)
|
let URL = NSURL(string: argument) ?? NSURL(fileURLWithPath: argument)
|
||||||
guard let type = URL.pathExtension else { throw "cannot tell the type of \(URL)" }
|
guard let type = URL.pathExtension ?? URL.fragment else { throw "cannot tell the type of \(URL)" }
|
||||||
|
self.URL = URL
|
||||||
self.type = type
|
self.type = type
|
||||||
contents = try NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding) as String
|
contents = try NSString(contentsOfURL: URL, encoding: NSUTF8StringEncoding) as String
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user