Skip to content

Commit

Permalink
Fix invalid.illegal await try matching even with no word boundary (#6)
Browse files Browse the repository at this point in the history
Fixes #5:

```swift
await tryFoo()
```
  • Loading branch information
jtbandes authored Dec 13, 2023
1 parent a032cf0 commit ab893c6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Swift.tmLanguage.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Swift.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ repository:
- name: keyword.control.defer.swift
match: (?<!\.)\bdefer\b

- match: (?<!\.)\b(?:(await\s+try)|(await)\b)
- match: (?<!\.)\b(?:(await\s+try)|(await))\b
captures:
1: { name: invalid.illegal.try-must-precede-await.swift }
2: { name: keyword.control.await.swift }
Expand Down
2 changes: 1 addition & 1 deletion Syntaxes/Swift.tmLanguage

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions grammar-test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ func foo() async {
let newURL = await server.redirectURL(for: url)
let (data, response) = try await session.dataTask(with: newURL)
let (data, response) = await try session.dataTask(with: newURL) // not allowed
let (data, response) = await tryFoo() // ok
let (data, response) = await (try session.dataTask(with: newURL)) // ok
async let dog = getDoggo()
async let pup: Dog = getDoggo()
Expand Down

0 comments on commit ab893c6

Please sign in to comment.