Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh(swift) add actor keyword #3171

Merged
merged 11 commits into from
May 2, 2021
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Parser:

Grammars:

- enh(swift) add `actor` keyword (#3171) [Bradley Mackey][]
- enh(crystal) highlight variables (#3154) [Josh Goebel][]
- fix(ruby) Heredoc without interpolation (#3154) [Josh Goebel][]
- enh(swift) add `@resultBuilder` attribute (#3151) [Bradley Mackey][]
Expand Down
1 change: 1 addition & 0 deletions src/languages/lib/kws_swift.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const keywords = [
// strings below will be fed into the regular `keywords` engine while regex
// will result in additional modes being created to scan for those keywords to
// avoid conflicts with other rules
'actor',
'associatedtype',
'async',
'await',
Expand Down
2 changes: 1 addition & 1 deletion src/languages/swift.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ export default function(hljs) {
FUNCTION,
INIT_SUBSCRIPT,
{
beginKeywords: 'struct protocol class extension enum',
beginKeywords: 'struct protocol class extension enum actor',
end: '\\{',
excludeEnd: true,
keywords: KEYWORDS,
Expand Down
6 changes: 6 additions & 0 deletions test/markup/swift/type-definition.expect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<span class="hljs-keyword">class</span> <span class="hljs-title class_">TestClass</span> {}
<span class="hljs-keyword">struct</span> <span class="hljs-title class_">TestStruct</span> {}
<span class="hljs-keyword">enum</span> <span class="hljs-title class_">TestEnum</span> {}
<span class="hljs-keyword">actor</span> <span class="hljs-title class_">TestActor</span> {}
<span class="hljs-keyword">extension</span> <span class="hljs-title class_">TestExtension</span> {}
<span class="hljs-keyword">protocol</span> <span class="hljs-title class_">TestProtocol</span> {}
6 changes: 6 additions & 0 deletions test/markup/swift/type-definition.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class TestClass {}
struct TestStruct {}
enum TestEnum {}
actor TestActor {}
extension TestExtension {}
protocol TestProtocol {}