Skip to content

Commit

Permalink
enh(swift): add async/await keywords (#3048)
Browse files Browse the repository at this point in the history
* (swift) add async/await keywords
* (swift) add test case for async/await
  • Loading branch information
bradleymackey authored Mar 17, 2021
1 parent 230f2a1 commit bf5b00f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Language grammar improvements:
- enh(css) Add `font-smoothing` to attributes list for CSS (#3027) [AndyKIron][]
- fix(python) Highlight `print` and `exec` as a builtin (#1468) [Samuel Colvin][]
- fix(csharp) Fix unit being highlighted instead of uint (#3046) [Spacehamster][]
- enh(swift) add async/await keywords (#3048) [Bradley Mackey][]

Deprecations:

Expand Down
2 changes: 2 additions & 0 deletions src/languages/lib/kws_swift.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const keywords = [
// will result in additional modes being created to scan for those keywords to
// avoid conflicts with other rules
'associatedtype',
'async',
'await',
/as\?/, // operator
/as!/, // operator
'as', // operator
Expand Down
1 change: 1 addition & 0 deletions test/markup/swift/keywords.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ x <span class="hljs-keyword">is</span> <span class="hljs-type">String</span>
<span class="hljs-literal">true</span> <span class="hljs-literal">false</span> <span class="hljs-literal">nil</span>
<span class="hljs-keyword">fileprivate(set)</span> <span class="hljs-keyword">internal(set)</span> <span class="hljs-keyword">open(set)</span> <span class="hljs-keyword">private(set)</span> <span class="hljs-keyword">public(set)</span>
<span class="hljs-keyword">unowned(safe)</span> <span class="hljs-keyword">unowned(unsafe)</span>
<span class="hljs-keyword">async</span> <span class="hljs-keyword">await</span>

<span class="hljs-keyword">#if</span>
<span class="hljs-keyword">#error</span>(<span class="hljs-string">&quot;Error&quot;</span>)
Expand Down
1 change: 1 addition & 0 deletions test/markup/swift/keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ try? try! try
true false nil
fileprivate(set) internal(set) open(set) private(set) public(set)
unowned(safe) unowned(unsafe)
async await

#if
#error("Error")
Expand Down

0 comments on commit bf5b00f

Please sign in to comment.