aboutsummaryrefslogtreecommitdiffstats
path: root/queries/swift
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /queries/swift
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'queries/swift')
-rw-r--r--queries/swift/folds.scm35
-rw-r--r--queries/swift/highlights.scm347
-rw-r--r--queries/swift/indents.scm122
-rw-r--r--queries/swift/injections.scm5
-rw-r--r--queries/swift/locals.scm21
5 files changed, 0 insertions, 530 deletions
diff --git a/queries/swift/folds.scm b/queries/swift/folds.scm
deleted file mode 100644
index cfbc6d0b1..000000000
--- a/queries/swift/folds.scm
+++ /dev/null
@@ -1,35 +0,0 @@
-; format-ignore
-[
- (protocol_body) ; protocol Foo { ... }
- (class_body) ; class Foo { ... }
- (enum_class_body) ; enum Foo { ... }
- (function_body) ; func Foo (...) {...}
- (computed_property) ; { ... }
-
- (computed_getter) ; get { ... }
- (computed_setter) ; set { ... }
-
- (do_statement)
- (if_statement)
- (for_statement)
- (switch_statement)
- (while_statement)
- (guard_statement)
- (switch_entry)
-
- (type_parameters) ; x<Foo>
- (tuple_type) ; (...)
- (array_type) ; [String]
- (dictionary_type) ; [Foo: Bar]
-
- (call_expression) ; callFunc(...)
- (tuple_expression) ; ( foo + bar )
- (array_literal) ; [ foo, bar ]
- (dictionary_literal) ; [ foo: bar, x: y ]
- (lambda_literal)
- (willset_didset_block)
- (willset_clause)
- (didset_clause)
-
- (import_declaration)+
-] @fold
diff --git a/queries/swift/highlights.scm b/queries/swift/highlights.scm
deleted file mode 100644
index 5c52ee9d6..000000000
--- a/queries/swift/highlights.scm
+++ /dev/null
@@ -1,347 +0,0 @@
-[
- "."
- ";"
- ":"
- ","
-] @punctuation.delimiter
-
-[
- "("
- ")"
- "["
- "]"
- "{"
- "}"
-] @punctuation.bracket
-
-; Identifiers
-(type_identifier) @type
-
-[
- (self_expression)
- (super_expression)
-] @variable.builtin
-
-; Declarations
-[
- "func"
- "deinit"
-] @keyword.function
-
-[
- (visibility_modifier)
- (member_modifier)
- (function_modifier)
- (property_modifier)
- (parameter_modifier)
- (inheritance_modifier)
- (mutation_modifier)
-] @keyword.modifier
-
-(simple_identifier) @variable
-
-(function_declaration
- (simple_identifier) @function.method)
-
-(protocol_function_declaration
- name: (simple_identifier) @function.method)
-
-(init_declaration
- "init" @constructor)
-
-(parameter
- external_name: (simple_identifier) @variable.parameter)
-
-(parameter
- name: (simple_identifier) @variable.parameter)
-
-(type_parameter
- (type_identifier) @variable.parameter)
-
-(inheritance_constraint
- (identifier
- (simple_identifier) @variable.parameter))
-
-(equality_constraint
- (identifier
- (simple_identifier) @variable.parameter))
-
-[
- "protocol"
- "extension"
- "indirect"
- "nonisolated"
- "override"
- "convenience"
- "required"
- "some"
- "any"
- "weak"
- "unowned"
- "didSet"
- "willSet"
- "subscript"
- "let"
- "var"
- (throws)
- (where_keyword)
- (getter_specifier)
- (setter_specifier)
- (modify_specifier)
- (else)
- (as_operator)
-] @keyword
-
-[
- "enum"
- "struct"
- "class"
- "typealias"
-] @keyword.type
-
-[
- "async"
- "await"
-] @keyword.coroutine
-
-(shebang_line) @keyword.directive
-
-(class_body
- (property_declaration
- (pattern
- (simple_identifier) @variable.member)))
-
-(protocol_property_declaration
- (pattern
- (simple_identifier) @variable.member))
-
-(navigation_expression
- (navigation_suffix
- (simple_identifier) @variable.member))
-
-(value_argument
- name: (value_argument_label
- (simple_identifier) @variable.member))
-
-(import_declaration
- "import" @keyword.import)
-
-(enum_entry
- "case" @keyword)
-
-(modifiers
- (attribute
- "@" @attribute
- (user_type
- (type_identifier) @attribute)))
-
-; Function calls
-(call_expression
- (simple_identifier) @function.call) ; foo()
-
-(call_expression
- ; foo.bar.baz(): highlight the baz()
- (navigation_expression
- (navigation_suffix
- (simple_identifier) @function.call)))
-
-(call_expression
- (prefix_expression
- (simple_identifier) @function.call)) ; .foo()
-
-((navigation_expression
- (simple_identifier) @type) ; SomeType.method(): highlight SomeType as a type
- (#lua-match? @type "^[A-Z]"))
-
-(directive) @keyword.directive
-
-; See https://docs.swift.org/swift-book/documentation/the-swift-programming-language/lexicalstructure/#Keywords-and-Punctuation
-[
- (diagnostic)
- "#available"
- "#unavailable"
- "#fileLiteral"
- "#colorLiteral"
- "#imageLiteral"
- "#keyPath"
- "#selector"
- "#externalMacro"
-] @function.macro
-
-[
- "#column"
- "#dsohandle"
- "#fileID"
- "#filePath"
- "#file"
- "#function"
- "#line"
-] @constant.macro
-
-; Statements
-(for_statement
- "for" @keyword.repeat)
-
-(for_statement
- "in" @keyword.repeat)
-
-[
- "while"
- "repeat"
- "continue"
- "break"
-] @keyword.repeat
-
-(guard_statement
- "guard" @keyword.conditional)
-
-(if_statement
- "if" @keyword.conditional)
-
-(switch_statement
- "switch" @keyword.conditional)
-
-(switch_entry
- "case" @keyword)
-
-(switch_entry
- "fallthrough" @keyword)
-
-(switch_entry
- (default_keyword) @keyword)
-
-"return" @keyword.return
-
-(ternary_expression
- [
- "?"
- ":"
- ] @keyword.conditional.ternary)
-
-[
- (try_operator)
- "do"
- (throw_keyword)
- (catch_keyword)
-] @keyword.exception
-
-(statement_label) @label
-
-; Comments
-[
- (comment)
- (multiline_comment)
-] @comment @spell
-
-((comment) @comment.documentation
- (#lua-match? @comment.documentation "^///[^/]"))
-
-((comment) @comment.documentation
- (#lua-match? @comment.documentation "^///$"))
-
-((multiline_comment) @comment.documentation
- (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
-
-; String literals
-(line_str_text) @string
-
-(str_escaped_char) @string.escape
-
-(multi_line_str_text) @string
-
-(raw_str_part) @string
-
-(raw_str_end_part) @string
-
-(line_string_literal
- [
- "\\("
- ")"
- ] @punctuation.special)
-
-(multi_line_string_literal
- [
- "\\("
- ")"
- ] @punctuation.special)
-
-(raw_str_interpolation
- [
- (raw_str_interpolation_start)
- ")"
- ] @punctuation.special)
-
-[
- "\""
- "\"\"\""
-] @string
-
-; Lambda literals
-(lambda_literal
- "in" @keyword.operator)
-
-; Basic literals
-[
- (integer_literal)
- (hex_literal)
- (oct_literal)
- (bin_literal)
-] @number
-
-(real_literal) @number.float
-
-(boolean_literal) @boolean
-
-"nil" @constant.builtin
-
-(wildcard_pattern) @character.special
-
-; Regex literals
-(regex_literal) @string.regexp
-
-; Operators
-(custom_operator) @operator
-
-[
- "+"
- "-"
- "*"
- "/"
- "%"
- "="
- "+="
- "-="
- "*="
- "/="
- "<"
- ">"
- "<<"
- ">>"
- "<="
- ">="
- "++"
- "--"
- "^"
- "&"
- "&&"
- "|"
- "||"
- "~"
- "%="
- "!="
- "!=="
- "=="
- "==="
- "?"
- "??"
- "->"
- "..<"
- "..."
- (bang)
-] @operator
-
-(type_arguments
- [
- "<"
- ">"
- ] @punctuation.bracket)
diff --git a/queries/swift/indents.scm b/queries/swift/indents.scm
deleted file mode 100644
index 2366c3bd6..000000000
--- a/queries/swift/indents.scm
+++ /dev/null
@@ -1,122 +0,0 @@
-; format-ignore
-[
- ; ... refers to the section that will get affected by this indent.begin capture
- (protocol_body) ; protocol Foo { ... }
- (class_body) ; class Foo { ... }
- (enum_class_body) ; enum Foo { ... }
- (function_declaration) ; func Foo (...) {...}
- (init_declaration) ; init(...) {...}
- (deinit_declaration) ; deinit {...}
- (computed_property) ; { ... }
- (subscript_declaration) ; subscript Foo(...) { ... }
-
- (computed_getter) ; get { ... }
- (computed_setter) ; set { ... }
-
- (assignment) ; a = b
-
- (control_transfer_statement) ; return ...
- (for_statement)
- (while_statement)
- (repeat_while_statement)
- (do_statement)
- (if_statement)
- (switch_statement)
- (guard_statement)
-
- (type_parameters) ; x<Foo>
- (tuple_type) ; (...)
- (array_type) ; [String]
- (dictionary_type) ; [Foo: Bar]
-
- (call_expression) ; callFunc(...)
- (tuple_expression) ; ( foo + bar )
- (array_literal) ; [ foo, bar ]
- (dictionary_literal) ; [ foo: bar, x: y ]
- (lambda_literal)
- (willset_didset_block)
- (willset_clause)
- (didset_clause)
-] @indent.begin
-
-(init_declaration) @indent.begin
-
-(init_declaration
- [
- "init"
- "("
- ] @indent.branch)
-
-; indentation for init parameters
-(init_declaration
- ")" @indent.branch @indent.end)
-
-(init_declaration
- (parameter) @indent.begin
- (#set! indent.immediate))
-
-; @something(...)
-(modifiers
- (attribute) @indent.begin)
-
-(function_declaration
- (modifiers
- .
- (attribute)
- (_)* @indent.branch)
- .
- _ @indent.branch
- (#not-kind-eq? @indent.branch "type_parameters" "parameter"))
-
-(ERROR
- [
- "<"
- "{"
- "("
- "["
- ]) @indent.begin
-
-; if-elseif
-(if_statement
- (if_statement) @indent.dedent)
-
-; case Foo:
-; default Foo:
-; @attribute default Foo:
-(switch_entry
- .
- _ @indent.branch)
-
-(function_declaration
- ")" @indent.branch)
-
-(type_parameters
- ">" @indent.branch @indent.end .)
-
-(tuple_expression
- ")" @indent.branch @indent.end)
-
-(value_arguments
- ")" @indent.branch @indent.end)
-
-(tuple_type
- ")" @indent.branch @indent.end)
-
-(modifiers
- (attribute
- ")" @indent.branch @indent.end))
-
-[
- "}"
- "]"
-] @indent.branch @indent.end
-
-[
- ; (ERROR)
- (comment)
- (multiline_comment)
- (raw_str_part)
- (multi_line_string_literal)
-] @indent.auto
-
-(directive) @indent.ignore
diff --git a/queries/swift/injections.scm b/queries/swift/injections.scm
deleted file mode 100644
index 19aae904e..000000000
--- a/queries/swift/injections.scm
+++ /dev/null
@@ -1,5 +0,0 @@
-([
- (comment)
- (multiline_comment)
-] @injection.content
- (#set! injection.language "comment"))
diff --git a/queries/swift/locals.scm b/queries/swift/locals.scm
deleted file mode 100644
index dc8a62e9e..000000000
--- a/queries/swift/locals.scm
+++ /dev/null
@@ -1,21 +0,0 @@
-(import_declaration
- (identifier) @local.definition.import)
-
-(function_declaration
- name: (simple_identifier) @local.definition.function)
-
-; Scopes
-[
- (statements)
- (for_statement)
- (while_statement)
- (repeat_while_statement)
- (do_statement)
- (if_statement)
- (guard_statement)
- (switch_statement)
- (property_declaration)
- (function_declaration)
- (class_declaration)
- (protocol_declaration)
-] @local.scope