From ab893c684dd7eeb7c249139e29e931334316fda7 Mon Sep 17 00:00:00 2001 From: Jacob Bandes-Storch Date: Tue, 12 Dec 2023 16:40:20 -0800 Subject: [PATCH] Fix invalid.illegal `await try` matching even with no word boundary (#6) Fixes #5: ```swift await tryFoo() ``` --- Swift.tmLanguage.json | 2 +- Swift.tmLanguage.yaml | 2 +- Syntaxes/Swift.tmLanguage | 2 +- grammar-test.swift | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Swift.tmLanguage.json b/Swift.tmLanguage.json index a7fa2e9..cc0d07b 100644 --- a/Swift.tmLanguage.json +++ b/Swift.tmLanguage.json @@ -2051,7 +2051,7 @@ }, { - "match": "(? match - (?<!\.)\b(?:(await\s+try)|(await)\b) + (?<!\.)\b(?:(await\s+try)|(await))\b captures 1 diff --git a/grammar-test.swift b/grammar-test.swift index d9177d6..80c2292 100644 --- a/grammar-test.swift +++ b/grammar-test.swift @@ -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()