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

Add Swift 5.5 keywords #1715

Merged
merged 1 commit into from
Sep 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/rouge/lexers/swift.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ class Swift < RegexLexer
id = /#{id_head}#{id_rest}*/

keywords = Set.new %w(
break case continue default do else fallthrough if in for return switch where while try catch throw guard defer repeat
await break case continue default do else fallthrough if in for return switch where while try catch throw guard defer repeat

as dynamicType is new super self Self Type __COLUMN__ __FILE__ __FUNCTION__ __LINE__

associativity didSet get infix inout mutating none nonmutating operator override postfix precedence prefix set unowned weak willSet throws rethrows precedencegroup
associativity async didSet get infix inout isolated mutating none nonmutating operator override postfix precedence prefix set unowned weak willSet throws rethrows precedencegroup

#available #colorLiteral #column #else #elseif #endif #error #file #fileLiteral #function #if #imageLiteral #line #selector #sourceLocation #warning
)

declarations = Set.new %w(
class deinit enum convenience extension final func import init internal lazy let optional private protocol public required static struct subscript typealias var dynamic indirect associatedtype open fileprivate some
actor class deinit enum convenience extension final func import init internal lazy let nonisolated optional private protocol public required static struct subscript typealias var dynamic indirect associatedtype open fileprivate some
)

constants = Set.new %w(
Expand Down
8 changes: 8 additions & 0 deletions spec/visual/samples/swift
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,12 @@ func test(t: Types?) -> Bool {
}
}

actor AnActor {
nonisolated func funcA() {}
func funcB(otherActor: isolated AnActor) async {
await otherActor.funcB()
async let v = funcA()
}
}

foo() // end-of-file comment