Skip to content

Commit 26ca920

Browse files
authored
Merge pull request #10 from wickwirew/missing-semi-colon
Add semicolon if needed
2 parents ca34696 + f8d6e46 commit 26ca920

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

Sources/Compiler/Config.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,14 @@ public struct Config: Codable {
3131
}
3232

3333
public init(at path: String) throws {
34-
guard var url = URL(string: path) else {
35-
throw ConfigError.invalidURL(path)
34+
var url: URL
35+
if path.hasPrefix("file://") {
36+
guard let u = URL(string: path) else {
37+
throw ConfigError.invalidURL(path)
38+
}
39+
url = u
40+
} else {
41+
url = URL(fileURLWithPath: path)
3642
}
3743

3844
if url.lastPathComponent != "puresql.yaml" {

Sources/Compiler/Gen/Rewriter.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ struct Rewriter {
4040
final.append(contentsOf: source[start..<stmt.location.upperBound])
4141
}
4242

43-
return final.trimmingCharacters(in: .whitespaces)
43+
// Looks like the parser can sometimes pickup the ; and sometimes not.
44+
// So make sure to append the ; if it is not there.
45+
var stripped = final.trimmingCharacters(in: .whitespaces)
46+
if stripped.last != ";" {
47+
stripped.append(";")
48+
}
49+
return stripped
4450
}
4551

4652
/// Splits the source into segments where each segment is either

0 commit comments

Comments
 (0)