-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Swift Grammar and Queries (#10802)
- Loading branch information
Arturs Krumins
authored
Jun 7, 2024
1 parent
44504b7
commit aa1630a
Showing
6 changed files
with
78 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/57c1c6d6ffa1c44b330182d41717e6fe37430704/queries/injections.scm | ||
|
||
; Parse regex syntax within regex literals | ||
|
||
((regex_literal) @injection.content | ||
(#set! injection.language "regex")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
; Upstream: https://github.com/alex-pinkus/tree-sitter-swift/blob/57c1c6d6ffa1c44b330182d41717e6fe37430704/queries/locals.scm | ||
(import_declaration (identifier) @definition.import) | ||
(function_declaration name: (simple_identifier) @definition.function) | ||
|
||
; Scopes | ||
[ | ||
(for_statement) | ||
(while_statement) | ||
(repeat_while_statement) | ||
(do_statement) | ||
(if_statement) | ||
(guard_statement) | ||
(switch_statement) | ||
(property_declaration) | ||
(function_declaration) | ||
(class_declaration) | ||
(protocol_declaration) | ||
(lambda_literal) | ||
] @local.scope | ||
|
||
(parameter name: (simple_identifier) @local.definition) | ||
|
||
(simple_identifier) @local.reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(class_declaration | ||
body: (_) @class.inside) @class.around | ||
|
||
(protocol_declaration | ||
body: (_) @class.inside) @class.around | ||
|
||
(function_declaration | ||
body: (_) @function.inside) @function.around | ||
|
||
(parameter | ||
(_) @parameter.inside) @parameter.around | ||
|
||
(lambda_parameter | ||
(_) @parameter.inside) @parameter.around | ||
|
||
[ | ||
(comment) | ||
(multiline_comment) | ||
] @comment.inside | ||
|
||
(comment)+ @comment.around | ||
|
||
(multiline_comment) @comment.around |