Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/swift/highlights.scm')
-rw-r--r--runtime/queries/swift/highlights.scm123
1 files changed, 47 insertions, 76 deletions
diff --git a/runtime/queries/swift/highlights.scm b/runtime/queries/swift/highlights.scm
index ecafde40..5560010b 100644
--- a/runtime/queries/swift/highlights.scm
+++ b/runtime/queries/swift/highlights.scm
@@ -1,57 +1,15 @@
-; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/57c1c6d6ffa1c44b330182d41717e6fe37430704/queries/highlights.scm
+; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/8d2fd80e3322df51e3f70952e60d57f5d4077eb8/queries/highlights.scm
(line_string_literal
["\\(" ")"] @punctuation.special)
["." ";" ":" "," ] @punctuation.delimiter
-["(" ")" "[" "]" "{" "}" "<" ">"] @punctuation.bracket
-
-; Operators
-[
- "!"
- "?"
- "+"
- "-"
- "\\"
- "*"
- "/"
- "%"
- "="
- "+="
- "-="
- "*="
- "/="
- "<"
- ">"
- "<="
- ">="
- "++"
- "--"
- "&"
- "~"
- "%="
- "!="
- "!=="
- "=="
- "==="
- "??"
-
- "->"
-
- "..<"
- "..."
- (custom_operator)
-] @operator
-
-"?" @type
-(type_annotation "!" @type)
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket ; TODO: "\\(" ")" in interpolations should be @punctuation.special
; Identifiers
-(simple_identifier) @variable
(attribute) @variable
(type_identifier) @type
(self_expression) @variable.builtin
-(user_type (type_identifier) @variable.builtin (#eq? @variable.builtin "Self"))
; Declarations
"func" @keyword.function
@@ -65,13 +23,9 @@
] @keyword
(function_declaration (simple_identifier) @function.method)
-(protocol_function_declaration (simple_identifier) @function.method)
-(init_declaration ["init" @constructor])
-(deinit_declaration ["deinit" @constructor])
-
+(function_declaration "init" @constructor)
(throws) @keyword
"async" @keyword
-"await" @keyword
(where_keyword) @keyword
(parameter external_name: (simple_identifier) @variable.parameter)
(parameter name: (simple_identifier) @variable.parameter)
@@ -93,23 +47,9 @@
"override"
"convenience"
"required"
- "mutating"
- "associatedtype"
- "package"
- "any"
+ "some"
] @keyword
-(opaque_type ["some" @keyword])
-(existential_type ["any" @keyword])
-
-(precedence_group_declaration
- ["precedencegroup" @keyword]
- (simple_identifier) @type)
-(precedence_group_attribute
- (simple_identifier) @keyword
- [(simple_identifier) @type
- (boolean_literal) @constant.builtin.boolean])
-
[
(getter_specifier)
(setter_specifier)
@@ -131,13 +71,6 @@
((navigation_expression
(simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type
(#match? @type "^[A-Z]"))
-(call_expression (simple_identifier) @keyword (#eq? @keyword "defer")) ; defer { ... }
-
-(navigation_suffix
- (simple_identifier) @variable.other.member)
-
-(try_operator) @operator
-(try_operator ["try" @keyword])
(directive) @function.macro
(diagnostic) @function.macro
@@ -192,9 +125,47 @@
(integer_literal) @constant.numeric.integer
(real_literal) @constant.numeric.float
(boolean_literal) @constant.builtin.boolean
-"nil" @constant.builtin
+"nil" @variable.builtin
+
+"?" @type
+(type_annotation "!" @type)
-(value_parameter_pack ["each" @keyword])
-(value_pack_expansion ["repeat" @keyword])
-(type_parameter_pack ["each" @keyword])
-(type_pack_expansion ["repeat" @keyword])
+(simple_identifier) @variable
+
+; Operators
+[
+ "try"
+ "try?"
+ "try!"
+ "!"
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ "="
+ "+="
+ "-="
+ "*="
+ "/="
+ "<"
+ ">"
+ "<="
+ ">="
+ "++"
+ "--"
+ "&"
+ "~"
+ "%="
+ "!="
+ "!=="
+ "=="
+ "==="
+ "??"
+
+ "->"
+
+ "..<"
+ "..."
+ (custom_operator)
+] @operator