-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathswift.ts
188 lines (166 loc) · 5.95 KB
/
swift.ts
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import type { LanguageScopeSupportFacetMap } from "./scopeSupportFacets.types";
import { ScopeSupportFacetLevel } from "./scopeSupportFacets.types";
const { supported, unsupported, notApplicable } = ScopeSupportFacetLevel;
export const swiftScopeSupport: LanguageScopeSupportFacetMap = {
// Command related
command: notApplicable,
// XML/HTML related
element: notApplicable,
startTag: notApplicable,
endTag: notApplicable,
tags: notApplicable,
attribute: supported, // Swift has attributes like @available, @objc
environment: notApplicable,
// Document structure
section: notApplicable,
// Data structures and control flow
list: supported,
map: supported,
ifStatement: supported,
regularExpression: supported,
switchStatementSubject: supported,
fieldAccess: supported,
// Statements and classes
statement: supported,
"statement.class": supported,
"statement.iteration.document": supported,
"statement.iteration.block": supported,
class: supported,
"class.iteration.document": supported,
"class.iteration.block": supported,
className: supported,
"className.iteration.document": supported,
"className.iteration.block": supported,
// Functions
namedFunction: supported,
"namedFunction.method": supported,
"namedFunction.method.iteration.class": supported,
"namedFunction.constructor": supported, // Swift has initializers
"namedFunction.iteration": supported,
"namedFunction.iteration.document": supported,
anonymousFunction: supported, // Swift has closures
functionName: supported,
"functionName.method": supported,
"functionName.method.iteration.class": supported,
"functionName.constructor": supported,
"functionName.iteration": supported,
"functionName.iteration.document": supported,
// Function calls
functionCall: supported,
"functionCall.constructor": supported,
functionCallee: supported,
"functionCallee.constructor": supported,
// Arguments
"argument.actual": supported,
"argument.actual.iteration": supported,
"argument.actual.method": supported,
"argument.actual.method.iteration": supported,
"argument.actual.constructor": supported,
"argument.actual.constructor.iteration": supported,
"argument.formal": supported,
"argument.formal.iteration": supported,
"argument.formal.method": supported,
"argument.formal.method.iteration": supported,
"argument.formal.constructor": supported,
"argument.formal.constructor.iteration": supported,
// Comments
"comment.line": supported,
"comment.block": supported,
// Strings
"string.singleLine": supported,
"string.multiLine": supported,
// Text fragments
"textFragment.comment.line": supported,
"textFragment.comment.block": supported,
"textFragment.string.singleLine": supported,
"textFragment.string.multiLine": supported,
// Delimiters
disqualifyDelimiter: supported,
pairDelimiter: supported,
// Branches
"branch.if": supported,
"branch.loop": supported,
"branch.if.iteration": supported,
"branch.try": supported,
"branch.try.iteration": supported,
"branch.switchCase": supported,
"branch.switchCase.iteration": supported,
"branch.ternary": supported,
// Collection items
"collectionItem.unenclosed": supported,
"collectionItem.unenclosed.iteration": supported,
// Conditions
"condition.if": supported,
"condition.while": supported,
"condition.doWhile": unsupported, // Swift doesn't have do-while loops
"condition.for": supported,
"condition.ternary": supported,
"condition.switchCase": supported,
"condition.switchCase.iteration": supported,
// Names
"name.assignment": supported,
"name.assignment.pattern": supported,
"name.variable": supported,
"name.variable.pattern": supported,
"name.foreach": supported,
"name.function": supported,
"name.method": supported,
"name.constructor": supported,
"name.class": supported,
"name.field": supported,
"name.resource": unsupported, // Swift doesn't have explicit resource management blocks
"name.resource.iteration": unsupported,
"name.argument.formal": supported,
"name.argument.formal.iteration": supported,
"name.argument.formal.method": supported,
"name.argument.formal.method.iteration": supported,
"name.argument.formal.constructor": supported,
"name.argument.formal.constructor.iteration": supported,
"name.iteration.block": supported,
"name.iteration.document": supported,
// Keys
"key.attribute": supported,
"key.mapPair": supported,
"key.mapPair.iteration": supported,
// Values
"value.assignment": supported,
"value.variable": supported,
"value.variable.pattern": supported,
"value.mapPair": supported,
"value.mapPair.iteration": supported,
"value.foreach": supported,
"value.attribute": supported,
"value.return": supported,
"value.return.lambda": supported,
"value.field": supported,
"value.yield": unsupported, // Swift doesn't have yield statements
"value.resource": unsupported,
"value.resource.iteration": unsupported,
"value.argument.formal": supported,
"value.argument.formal.iteration": supported,
"value.argument.formal.method": supported,
"value.argument.formal.method.iteration": supported,
"value.argument.formal.constructor": supported,
"value.argument.formal.constructor.iteration": supported,
"value.typeAlias": supported,
// Types
"type.variable": supported,
"type.argument.formal": supported,
"type.argument.formal.iteration": supported,
"type.argument.formal.method": supported,
"type.argument.formal.method.iteration": supported,
"type.argument.formal.constructor": supported,
"type.argument.formal.constructor.iteration": supported,
"type.return": supported,
"type.field": supported,
"type.field.iteration": supported,
"type.foreach": supported,
"type.interface": supported, // Swift has protocols which are similar to interfaces
"type.class": supported,
"type.alias": supported,
"type.cast": supported,
"type.typeArgument": supported,
"type.typeArgument.iteration": supported,
// Notebook
notebookCell: notApplicable,
};