-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathswift.scm
110 lines (90 loc) · 2.1 KB
/
swift.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
[
(import_declaration)
(property_declaration)
(typealias_declaration)
(switch_entry)
] @statement
(function_declaration
name: (_) @functionName
) @namedFunction @functionName.domain
(class_declaration
name: (_) @className
) @class @className.domain
(protocol_declaration
name: (_) @className
) @class @className.domain
[
(class_declaration)
(protocol_declaration)
] @namedFunction.iteration @functionName.iteration
(array_literal) @list
(dictionary_literal) @map
(regex_literal) @regularExpression
[
(class_declaration)
(protocol_declaration)
(function_declaration)
] @statement.iteration
(
(value_arguments
(_)? @_.leading.endOf
.
(_) @argumentOrParameter
.
(_)? @_.trailing.startOf
) @_dummy
(#not-type? @argumentOrParameter "comment")
(#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n")
)
(
(type_arguments
(_)? @_.leading.endOf
.
(_) @argumentOrParameter
.
(_)? @_.trailing.startOf
) @_dummy
(#not-type? @argumentOrParameter "comment")
(#single-or-multi-line-delimiter! @argumentOrParameter @_dummy ", " ",\n")
)
(value_arguments
"(" @argumentOrParameter.iteration.start.endOf
")" @argumentOrParameter.iteration.end.startOf
) @argumentOrParameter.iteration.domain
(type_arguments
"<" @argumentOrParameter.iteration.start.endOf
">" @argumentOrParameter.iteration.end.startOf
) @argumentOrParameter.iteration.domain
[
(comment)
(multiline_comment)
] @comment @textFragment
[
(line_string_literal)
(multi_line_string_literal)
(raw_string_literal)
] @string @textFragment
;; (line_string_literal
;; "\"" @textFragment.start.endOf
;; "\"" @textFragment.end.startOf
;; ) @string
[
(if_statement)
(guard_statement)
] @ifStatement
(switch_statement
expr: (_) @private.switchStatementSubject
(#child-range! @private.switchStatementSubject 0 -1 true true)
) @_.domain
(switch_pattern) @condition
;;!! true ? 0 : 1;
;;! ^^^^
;;! ^ ^
;;! --------------
(ternary_expression
condition: (_) @condition
if_true: (_) @branch
) @condition.domain
(ternary_expression
if_false: (_) @branch
)