|
2 | 2 | ;
|
3 | 3 | ; This source file is part of the Swift.org open source project
|
4 | 4 | ;
|
5 |
| -; Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors |
| 5 | +; Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors |
6 | 6 | ; Licensed under Apache License v2.0 with Runtime Library Exception
|
7 | 7 | ;
|
8 | 8 | ; See https://swift.org/LICENSE.txt for license information
|
|
48 | 48 | ;; Integer literals
|
49 | 49 | '("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
|
50 | 50 | ;; Decl and type keywords
|
51 |
| - `(,(regexp-opt '("class" "init" "deinit" "extension" "fileprivate" "func" |
52 |
| - "import" "let" "protocol" "static" "struct" "subscript" |
53 |
| - "typealias" "enum" "var" "lazy" "where" "private" "public" |
54 |
| - "internal" "override" "open" "associatedtype" "inout" |
55 |
| - "indirect" "final") |
| 51 | + `(,(regexp-opt '("import" |
| 52 | + "class" "struct" "enum" "extension" "protocol" "typealias" "var" "let" "actor" |
| 53 | + "func" "init" "deinit" "subscript" "associatedtype" |
| 54 | + "public" "internal" "private" "fileprivate" "package" |
| 55 | + "static" |
| 56 | + "where") |
56 | 57 | 'words) . font-lock-keyword-face)
|
57 | 58 | ;; Variable decl keywords
|
58 |
| - `("\\b\\(?:[^a-zA-Z_0-9]*\\)\\(get\\|set\\)\\(?:[^a-zA-Z_0-9]*\\)\\b" 1 font-lock-keyword-face) |
| 59 | + `("\\b\\(?:[^a-zA-Z_0-9]*\\)\\(get\\|set\\|_read\\|_modify\\|unsafe\\(Mutable\\)?Address\\)\\(?:[^a-zA-Z_0-9]*\\)\\b" 1 font-lock-keyword-face) |
59 | 60 | `(,(regexp-opt '("willSet" "didSet") 'words) . font-lock-keyword-face)
|
60 | 61 | ;; Operators
|
61 | 62 | `("\\b\\(?:\\(?:pre\\|post\\|in\\)fix\\s-+\\)operator\\b" . font-lock-keyword-face)
|
62 | 63 | ;; Keywords that begin with a number sign
|
63 | 64 | `("#\\(if\\|endif\\|elseif\\|else\\|available\\|error\\|warning\\)\\b" . font-lock-string-face)
|
64 | 65 | `("#\\(file\\|line\\|column\\|function\\|selector\\)\\b" . font-lock-keyword-face)
|
65 | 66 | ;; Infix operator attributes
|
66 |
| - `(,(regexp-opt '("precedence" "associativity" "left" "right" "none") |
| 67 | + `(,(regexp-opt '("precedence" "associativity" "left" "right" "none" "precedencegroup") |
67 | 68 | 'words) . font-lock-keyword-face)
|
68 | 69 | ;; Statements
|
69 | 70 | `(,(regexp-opt '("if" "guard" "in" "else" "for" "do" "repeat" "while"
|
70 | 71 | "return" "break" "continue" "fallthrough" "switch" "case"
|
71 |
| - "default" "defer" "catch") |
| 72 | + "default" "defer" "catch" "yield") |
72 | 73 | 'words) . font-lock-keyword-face)
|
73 | 74 | ;; Decl modifier keywords
|
74 |
| - `(,(regexp-opt '("convenience" "dynamic" "mutating" "nonmutating" "optional" |
75 |
| - "required" "weak" "unowned" "safe" "unsafe") |
| 75 | + `(,(regexp-opt '("mutating" "nonmutating" "__consuming" "consuming" "borrowing" "inout" |
| 76 | + "convenience" "dynamic" "optional" |
| 77 | + "indirect" "override" "open" "final" |
| 78 | + "required" "lazy" "weak" |
| 79 | + "_compilerInitialized" "_const" "_local" "_resultDependsOnSelf" |
| 80 | + "nonisolated" "distributed") |
76 | 81 | 'words) . font-lock-keyword-face)
|
| 82 | + `("\\<unowned\\((\\(un\\)?safe)\\)?\\>" . font-lock-keyword-face) |
77 | 83 | ;; Expression keywords: "Any" and "Self" are included in "Types" above
|
78 | 84 | `(,(regexp-opt '("as" "false" "is" "nil" "rethrows" "super" "self" "throw"
|
79 |
| - "true" "try" "throws") |
| 85 | + "true" "try" "throws" "async" "await" |
| 86 | + "consume" "copy" "_move" "_borrow" "discard" |
| 87 | + "any" "some" "repeat" "each") |
80 | 88 | 'words) . font-lock-keyword-face)
|
81 | 89 | ;; Expressions
|
82 | 90 | `(,(regexp-opt '("new") 'words) . font-lock-keyword-face)
|
|
0 commit comments