@codingame/monaco-vscode-swift-default-extension 1.85.1 → 1.85.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4209 +0,0 @@
1
- {
2
- "information_for_contributors": [
3
- "This file has been converted from https://github.com/jtbandes/swift-tmlanguage/blob/master/Swift.tmLanguage.json",
4
- "If you want to provide a fix or improvement, please create a pull request against the original repository.",
5
- "Once accepted there, we are happy to receive an update request."
6
- ],
7
- "version": "https://github.com/jtbandes/swift-tmlanguage/commit/806e024d8ea2478596d7e0ab871d2b1436e6fead",
8
- "name": "Swift",
9
- "scopeName": "source.swift",
10
- "comment": "See swift.tmbundle/grammar-test.swift for test cases.",
11
- "patterns": [
12
- {
13
- "include": "#root"
14
- }
15
- ],
16
- "repository": {
17
- "async-throws": {
18
- "match": "\\b(?:(throws\\s+async|rethrows\\s+async)|(throws|rethrows)|(async))\\b",
19
- "captures": {
20
- "1": {
21
- "name": "invalid.illegal.await-must-precede-throws.swift"
22
- },
23
- "2": {
24
- "name": "storage.modifier.exception.swift"
25
- },
26
- "3": {
27
- "name": "storage.modifier.async.swift"
28
- }
29
- }
30
- },
31
- "attributes": {
32
- "patterns": [
33
- {
34
- "name": "meta.attribute.available.swift",
35
- "begin": "((@)available)(\\()",
36
- "end": "\\)",
37
- "beginCaptures": {
38
- "1": {
39
- "name": "storage.modifier.attribute.swift"
40
- },
41
- "2": {
42
- "name": "punctuation.definition.attribute.swift"
43
- },
44
- "3": {
45
- "name": "punctuation.definition.arguments.begin.swift"
46
- }
47
- },
48
- "endCaptures": {
49
- "0": {
50
- "name": "punctuation.definition.arguments.end.swift"
51
- }
52
- },
53
- "patterns": [
54
- {
55
- "match": "\\b(swift|(?:iOS|macOS|OSX|watchOS|tvOS|UIKitForMac)(?:ApplicationExtension)?)\\b(?:\\s+([0-9]+(?:\\.[0-9]+)*\\b))?",
56
- "captures": {
57
- "1": {
58
- "name": "keyword.other.platform.os.swift"
59
- },
60
- "2": {
61
- "name": "constant.numeric.swift"
62
- }
63
- }
64
- },
65
- {
66
- "begin": "\\b(introduced|deprecated|obsoleted)\\s*(:)\\s*",
67
- "end": "(?!\\G)",
68
- "beginCaptures": {
69
- "1": {
70
- "name": "keyword.other.swift"
71
- },
72
- "2": {
73
- "name": "punctuation.separator.key-value.swift"
74
- }
75
- },
76
- "patterns": [
77
- {
78
- "name": "constant.numeric.swift",
79
- "match": "\\b[0-9]+(?:\\.[0-9]+)*\\b"
80
- }
81
- ]
82
- },
83
- {
84
- "begin": "\\b(message|renamed)\\s*(:)\\s*(?=\")",
85
- "end": "(?!\\G)",
86
- "beginCaptures": {
87
- "1": {
88
- "name": "keyword.other.swift"
89
- },
90
- "2": {
91
- "name": "punctuation.separator.key-value.swift"
92
- }
93
- },
94
- "patterns": [
95
- {
96
- "include": "#literals"
97
- }
98
- ]
99
- },
100
- {
101
- "match": "(?:(\\*)|\\b(deprecated|unavailable|noasync)\\b)\\s*(.*?)(?=[,)])",
102
- "captures": {
103
- "1": {
104
- "name": "keyword.other.platform.all.swift"
105
- },
106
- "2": {
107
- "name": "keyword.other.swift"
108
- },
109
- "3": {
110
- "name": "invalid.illegal.character-not-allowed-here.swift"
111
- }
112
- }
113
- }
114
- ]
115
- },
116
- {
117
- "name": "meta.attribute.objc.swift",
118
- "begin": "((@)objc)(\\()",
119
- "end": "\\)",
120
- "beginCaptures": {
121
- "1": {
122
- "name": "storage.modifier.attribute.swift"
123
- },
124
- "2": {
125
- "name": "punctuation.definition.attribute.swift"
126
- },
127
- "3": {
128
- "name": "punctuation.definition.arguments.begin.swift"
129
- }
130
- },
131
- "endCaptures": {
132
- "0": {
133
- "name": "punctuation.definition.arguments.end.swift"
134
- }
135
- },
136
- "patterns": [
137
- {
138
- "name": "entity.name.function.swift",
139
- "match": "\\w*(?::(?:\\w*:)*(\\w*))?",
140
- "captures": {
141
- "1": {
142
- "name": "invalid.illegal.missing-colon-after-selector-piece.swift"
143
- }
144
- }
145
- }
146
- ]
147
- },
148
- {
149
- "comment": "any other attribute",
150
- "name": "meta.attribute.swift",
151
- "begin": "(@)(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)",
152
- "end": "(?!\\G\\()",
153
- "beginCaptures": {
154
- "0": {
155
- "name": "storage.modifier.attribute.swift"
156
- },
157
- "1": {
158
- "name": "punctuation.definition.attribute.swift"
159
- },
160
- "2": {
161
- "name": "punctuation.definition.identifier.swift"
162
- },
163
- "3": {
164
- "name": "punctuation.definition.identifier.swift"
165
- }
166
- },
167
- "patterns": [
168
- {
169
- "name": "meta.arguments.attribute.swift",
170
- "begin": "\\(",
171
- "end": "\\)",
172
- "beginCaptures": {
173
- "0": {
174
- "name": "punctuation.definition.arguments.begin.swift"
175
- }
176
- },
177
- "endCaptures": {
178
- "0": {
179
- "name": "punctuation.definition.arguments.end.swift"
180
- }
181
- },
182
- "patterns": [
183
- {
184
- "include": "#expressions"
185
- }
186
- ]
187
- }
188
- ]
189
- }
190
- ]
191
- },
192
- "builtin-functions": {
193
- "patterns": [
194
- {
195
- "comment": "Member functions in the standard library in Swift 3 which may be used with trailing closures and no parentheses",
196
- "name": "support.function.swift",
197
- "match": "(?<=\\.)(?:s(?:ort(?:ed)?|plit)|contains|index|partition|f(?:i(?:lter|rst)|orEach|latMap)|with(?:MutableCharacters|CString|U(?:nsafe(?:Mutable(?:BufferPointer|Pointer(?:s|To(?:Header|Elements)))|BufferPointer)|TF8Buffer))|m(?:in|a(?:p|x)))(?=\\s*[({])\\b"
198
- },
199
- {
200
- "comment": "Member functions in the standard library in Swift 3",
201
- "name": "support.function.swift",
202
- "match": "(?<=\\.)(?:s(?:ymmetricDifference|t(?:oreBytes|arts|ride)|ortInPlace|u(?:ccessor|ffix|btract(?:ing|InPlace|WithOverflow)?)|quareRoot|amePosition)|h(?:oldsUnique(?:Reference|OrPinnedReference)|as(?:Suffix|Prefix))|ne(?:gate(?:d)?|xt)|c(?:o(?:untByEnumerating|py(?:Bytes)?)|lamp(?:ed)?|reate)|t(?:o(?:IntMax|Opaque|UIntMax)|ake(?:RetainedValue|UnretainedValue)|r(?:uncatingRemainder|a(?:nscodedLength|ilSurrogate)))|i(?:s(?:MutableAndUniquelyReferenced(?:OrPinned)?|S(?:trictSu(?:perset(?:Of)?|bset(?:Of)?)|u(?:perset(?:Of)?|bset(?:Of)?))|Continuation|T(?:otallyOrdered|railSurrogate)|Disjoint(?:With)?|Unique(?:Reference|lyReferenced(?:OrPinned)?)|Equal|Le(?:ss(?:ThanOrEqualTo)?|adSurrogate))|n(?:sert(?:ContentsOf)?|tersect(?:ion|InPlace)?|itialize(?:Memory|From)?|dex(?:Of|ForKey)))|o(?:verlaps|bjectAt)|d(?:i(?:stance(?:To)?|vide(?:d|WithOverflow)?)|e(?:s(?:cendant|troy)|code(?:CString)?|initialize|alloc(?:ate(?:Capacity)?)?)|rop(?:First|Last))|u(?:n(?:ion(?:InPlace)?|derestimateCount|wrappedOrError)|p(?:date(?:Value)?|percased))|join(?:ed|WithSeparator)|p(?:op(?:First|Last)|ass(?:Retained|Unretained)|re(?:decessor|fix))|e(?:scape(?:d)?|n(?:code|umerate(?:d)?)|lementsEqual|xclusiveOr(?:InPlace)?)|f(?:orm(?:Remainder|S(?:ymmetricDifference|quareRoot)|TruncatingRemainder|In(?:tersection|dex)|Union)|latten|rom(?:CString(?:RepairingIllFormedUTF8)?|Opaque))|w(?:i(?:thMemoryRebound|dth)|rite(?:To)?)|l(?:o(?:wercased|ad)|e(?:adSurrogate|xicographical(?:Compare|lyPrecedes)))|a(?:ss(?:ign(?:BackwardFrom|From)?|umingMemoryBound)|d(?:d(?:ing(?:Product)?|Product|WithOverflow)?|vanced(?:By)?)|utorelease|ppend(?:ContentsOf)?|lloc(?:ate)?|bs)|r(?:ound(?:ed)?|e(?:serveCapacity|tain|duce|place(?:Range|Subrange)?|verse(?:d)?|quest(?:NativeBuffer|UniqueMutableBackingBuffer)|lease|m(?:ove(?:Range|Subrange|Value(?:ForKey)?|First|Last|A(?:tIndex|ll))?|ainder(?:WithOverflow)?)))|ge(?:nerate|t(?:Objects|Element))|m(?:in(?:imum(?:Magnitude)?|Element)|ove(?:Initialize(?:Memory|BackwardFrom|From)?|Assign(?:From)?)?|ultipl(?:y(?:WithOverflow)?|ied)|easure|a(?:ke(?:Iterator|Description)|x(?:imum(?:Magnitude)?|Element)))|bindMemory)(?=\\s*\\()"
203
- },
204
- {
205
- "comment": "Member functions in the standard library in Swift 2 only",
206
- "name": "support.function.swift",
207
- "match": "(?<=\\.)(?:s(?:uperclassMirror|amePositionIn|tartsWith)|nextObject|c(?:haracterAtIndex|o(?:untByEnumeratingWithState|pyWithZone)|ustom(?:Mirror|PlaygroundQuickLook))|is(?:EmptyInput|ASCII)|object(?:Enumerator|ForKey|AtIndex)|join|put|keyEnumerator|withUnsafeMutablePointerToValue|length|getMirror|m(?:oveInitializeAssignFrom|ember))(?=\\s*\\()"
208
- }
209
- ]
210
- },
211
- "builtin-global-functions": {
212
- "patterns": [
213
- {
214
- "begin": "\\b(type)(\\()\\s*(of)(:)",
215
- "end": "\\)",
216
- "beginCaptures": {
217
- "1": {
218
- "name": "support.function.dynamic-type.swift"
219
- },
220
- "2": {
221
- "name": "punctuation.definition.arguments.begin.swift"
222
- },
223
- "3": {
224
- "name": "support.variable.parameter.swift"
225
- },
226
- "4": {
227
- "name": "punctuation.separator.argument-label.begin.swift"
228
- }
229
- },
230
- "endCaptures": {
231
- "0": {
232
- "name": "punctuation.definition.arguments.end.swift"
233
- }
234
- },
235
- "patterns": [
236
- {
237
- "include": "#expressions"
238
- }
239
- ]
240
- },
241
- {
242
- "comment": "Global functions available in Swift 3 which may be used with trailing closures and no parentheses",
243
- "name": "support.function.swift",
244
- "match": "\\b(?:anyGenerator|autoreleasepool)(?=\\s*[({])\\b"
245
- },
246
- {
247
- "comment": "Global functions available in Swift 3",
248
- "name": "support.function.swift",
249
- "match": "\\b(?:s(?:tride(?:of(?:Value)?)?|izeof(?:Value)?|equence|wap)|numericCast|transcode|is(?:UniquelyReferenced(?:NonObjC)?|KnownUniquelyReferenced)|zip|d(?:ump|ebugPrint)|unsafe(?:BitCast|Downcast|Unwrap|Address(?:Of)?)|pr(?:int|econdition(?:Failure)?)|fatalError|with(?:Unsafe(?:MutablePointer|Pointer)|ExtendedLifetime|VaList)|a(?:ssert(?:ionFailure)?|lignof(?:Value)?|bs)|re(?:peatElement|adLine)|getVaList|m(?:in|ax))(?=\\s*\\()"
250
- },
251
- {
252
- "comment": "Global functions available in Swift 2 only",
253
- "name": "support.function.swift",
254
- "match": "\\b(?:s(?:ort|uffix|pli(?:ce|t))|insert|overlaps|d(?:istance|rop(?:First|Last))|join|prefix|extend|withUnsafe(?:MutablePointers|Pointers)|lazy|advance|re(?:flect|move(?:Range|Last|A(?:tIndex|ll))))(?=\\s*\\()"
255
- }
256
- ]
257
- },
258
- "builtin-properties": {
259
- "patterns": [
260
- {
261
- "comment": "The simpler (?<=\\bProcess\\.|\\bCommandLine\\.) breaks VS Code / Atom, see https://github.com/textmate/swift.tmbundle/issues/29",
262
- "name": "support.variable.swift",
263
- "match": "(?<=^Process\\.|\\WProcess\\.|^CommandLine\\.|\\WCommandLine\\.)(arguments|argc|unsafeArgv)"
264
- },
265
- {
266
- "comment": "Properties in the standard library in Swift 3",
267
- "name": "support.variable.swift",
268
- "match": "(?<=\\.)(?:s(?:t(?:artIndex|ri(?:ngValue|de))|i(?:ze|gn(?:BitIndex|ificand(?:Bit(?:Count|Pattern)|Width)?|alingNaN)?)|u(?:perclassMirror|mmary|bscriptBaseAddress))|h(?:eader|as(?:hValue|PointerRepresentation))|n(?:ulTerminatedUTF8|ext(?:Down|Up)|a(?:n|tiveOwner))|c(?:haracters|ount(?:TrailingZeros)?|ustom(?:Mirror|PlaygroundQuickLook)|apacity)|i(?:s(?:S(?:ign(?:Minus|aling(?:NaN)?)|ubnormal)|N(?:ormal|aN)|Canonical|Infinite|Zero|Empty|Finite|ASCII)|n(?:dices|finity)|dentity)|owner|de(?:scription|bugDescription)|u(?:n(?:safelyUnwrapped|icodeScalar(?:s)?|derestimatedCount)|tf(?:16|8(?:Start|C(?:String|odeUnitCount))?)|intValue|ppercaseString|lp(?:OfOne)?)|p(?:i|ointee)|e(?:ndIndex|lements|xponent(?:Bit(?:Count|Pattern))?)|value(?:s)?|keys|quietNaN|f(?:irst(?:ElementAddress(?:IfContiguous)?)?|loatingPointClass)|l(?:ittleEndian|owercaseString|eastNo(?:nzeroMagnitude|rmalMagnitude)|a(?:st|zy))|a(?:l(?:ignment|l(?:ocatedElementCount|Zeros))|rray(?:PropertyIsNativeTypeChecked)?)|ra(?:dix|wValue)|greatestFiniteMagnitude|m(?:in|emory|ax)|b(?:yteS(?:ize|wapped)|i(?:nade|tPattern|gEndian)|uffer|ase(?:Address)?))\\b"
269
- },
270
- {
271
- "comment": "Properties in the standard library in Swift 2 only",
272
- "name": "support.variable.swift",
273
- "match": "(?<=\\.)(?:boolValue|disposition|end|objectIdentifier|quickLookObject|start|valueType)\\b"
274
- },
275
- {
276
- "comment": "Enum cases in the standard library - note that there is some overlap between these and the properties",
277
- "name": "support.variable.swift",
278
- "match": "(?<=\\.)(?:s(?:calarValue|i(?:ze|gnalingNaN)|o(?:und|me)|uppressed|prite|et)|n(?:one|egative(?:Subnormal|Normal|Infinity|Zero))|c(?:ol(?:or|lection)|ustomized)|t(?:o(?:NearestOr(?:Even|AwayFromZero)|wardZero)|uple|ext)|i(?:nt|mage)|optional|d(?:ictionary|o(?:uble|wn))|u(?:Int|p|rl)|p(?:o(?:sitive(?:Subnormal|Normal|Infinity|Zero)|int)|lus)|e(?:rror|mptyInput)|view|quietNaN|float|a(?:ttributedString|wayFromZero)|r(?:ectangle|ange)|generated|minus|b(?:ool|ezierPath))\\b"
279
- }
280
- ]
281
- },
282
- "builtin-types": {
283
- "comment": "Types provided in the standard library",
284
- "patterns": [
285
- {
286
- "include": "#builtin-types-builtin-class-type"
287
- },
288
- {
289
- "include": "#builtin-types-builtin-enum-type"
290
- },
291
- {
292
- "include": "#builtin-types-builtin-protocol-type"
293
- },
294
- {
295
- "include": "#builtin-types-builtin-struct-type"
296
- },
297
- {
298
- "include": "#builtin-types-builtin-typealias"
299
- },
300
- {
301
- "name": "support.type.any.swift",
302
- "match": "\\bAny\\b"
303
- }
304
- ]
305
- },
306
- "builtin-types-builtin-class-type": {
307
- "comment": "Builtin class types",
308
- "name": "support.class.swift",
309
- "match": "\\b(Managed(Buffer|ProtoBuffer)|NonObjectiveCBase|AnyGenerator)\\b"
310
- },
311
- "builtin-types-builtin-enum-type": {
312
- "patterns": [
313
- {
314
- "comment": "CommandLine is an enum, but it acts like a constant",
315
- "name": "support.constant.swift",
316
- "match": "\\b(?:CommandLine|Process(?=\\.))\\b"
317
- },
318
- {
319
- "comment": "The return type of a function that never returns",
320
- "name": "support.constant.never.swift",
321
- "match": "\\bNever\\b"
322
- },
323
- {
324
- "comment": "Enum types in the standard library in Swift 3",
325
- "name": "support.type.swift",
326
- "match": "\\b(?:ImplicitlyUnwrappedOptional|Representation|MemoryLayout|FloatingPointClassification|SetIndexRepresentation|SetIteratorRepresentation|FloatingPointRoundingRule|UnicodeDecodingResult|Optional|DictionaryIndexRepresentation|AncestorRepresentation|DisplayStyle|PlaygroundQuickLook|Never|FloatingPointSign|Bit|DictionaryIteratorRepresentation)\\b"
327
- },
328
- {
329
- "comment": "Enum types in the standard library in Swift 2 only",
330
- "name": "support.type.swift",
331
- "match": "\\b(?:MirrorDisposition|QuickLookObject)\\b"
332
- }
333
- ]
334
- },
335
- "builtin-types-builtin-protocol-type": {
336
- "patterns": [
337
- {
338
- "comment": "Protocols in the standard library in Swift 3",
339
- "name": "support.type.swift",
340
- "match": "\\b(?:Ra(?:n(?:domAccess(?:Collection|Indexable)|geReplaceable(?:Collection|Indexable))|wRepresentable)|M(?:irrorPath|utable(?:Collection|Indexable))|Bi(?:naryFloatingPoint|twiseOperations|directional(?:Collection|Indexable))|S(?:tr(?:ideable|eamable)|igned(?:Number|Integer)|e(?:tAlgebra|quence))|Hashable|C(?:o(?:llection|mparable)|ustom(?:Reflectable|StringConvertible|DebugStringConvertible|PlaygroundQuickLookable|LeafReflectable)|VarArg)|TextOutputStream|I(?:n(?:teger(?:Arithmetic)?|dexable(?:Base)?)|teratorProtocol)|OptionSet|Un(?:signedInteger|icodeCodec)|E(?:quatable|rror|xpressibleBy(?:BooleanLiteral|String(?:Interpolation|Literal)|NilLiteral|IntegerLiteral|DictionaryLiteral|UnicodeScalarLiteral|ExtendedGraphemeClusterLiteral|FloatLiteral|ArrayLiteral))|FloatingPoint|L(?:osslessStringConvertible|azy(?:SequenceProtocol|CollectionProtocol))|A(?:nyObject|bsoluteValuable))\\b"
341
- },
342
- {
343
- "comment": "Protocols in the standard library in Swift 2 only",
344
- "name": "support.type.swift",
345
- "match": "\\b(?:Ran(?:domAccessIndexType|geReplaceableCollectionType)|GeneratorType|M(?:irror(?:Type|PathType)|utable(?:Sliceable|CollectionType))|B(?:i(?:twiseOperationsType|directionalIndexType)|oolean(?:Type|LiteralConvertible))|S(?:tring(?:InterpolationConvertible|LiteralConvertible)|i(?:nkType|gned(?:NumberType|IntegerType))|e(?:tAlgebraType|quenceType)|liceable)|NilLiteralConvertible|C(?:ollectionType|VarArgType)|Inte(?:rvalType|ger(?:Type|LiteralConvertible|ArithmeticType))|O(?:utputStreamType|ptionSetType)|DictionaryLiteralConvertible|Un(?:signedIntegerType|icode(?:ScalarLiteralConvertible|CodecType))|E(?:rrorType|xten(?:sibleCollectionType|dedGraphemeClusterLiteralConvertible))|F(?:orwardIndexType|loat(?:ingPointType|LiteralConvertible))|A(?:nyCollectionType|rrayLiteralConvertible))\\b"
346
- }
347
- ]
348
- },
349
- "builtin-types-builtin-struct-type": {
350
- "patterns": [
351
- {
352
- "comment": "Structs in the standard library in Swift 3",
353
- "name": "support.type.swift",
354
- "match": "\\b(?:R(?:e(?:peat(?:ed)?|versed(?:RandomAccess(?:Collection|Index)|Collection|Index))|an(?:domAccessSlice|ge(?:Replaceable(?:RandomAccessSlice|BidirectionalSlice|Slice)|Generator)?))|Generator(?:Sequence|OfOne)|M(?:irror|utable(?:Ran(?:domAccessSlice|geReplaceable(?:RandomAccessSlice|BidirectionalSlice|Slice))|BidirectionalSlice|Slice)|anagedBufferPointer)|B(?:idirectionalSlice|ool)|S(?:t(?:aticString|ri(?:ng|deT(?:hrough(?:Generator|Iterator)?|o(?:Generator|Iterator)?)))|et(?:I(?:ndex|terator))?|lice)|HalfOpenInterval|C(?:haracter(?:View)?|o(?:ntiguousArray|untable(?:Range|ClosedRange)|llectionOfOne)|OpaquePointer|losed(?:Range(?:I(?:ndex|terator))?|Interval)|VaListPointer)|I(?:n(?:t(?:16|8|32|64)?|d(?:ices|ex(?:ing(?:Generator|Iterator))?))|terator(?:Sequence|OverOne)?)|Zip2(?:Sequence|Iterator)|O(?:paquePointer|bjectIdentifier)|D(?:ictionary(?:I(?:ndex|terator)|Literal)?|ouble|efault(?:RandomAccessIndices|BidirectionalIndices|Indices))|U(?:n(?:safe(?:RawPointer|Mutable(?:RawPointer|BufferPointer|Pointer)|BufferPointer(?:Generator|Iterator)?|Pointer)|icodeScalar(?:View)?|foldSequence|managed)|TF(?:16(?:View)?|8(?:View)?|32)|Int(?:16|8|32|64)?)|Join(?:Generator|ed(?:Sequence|Iterator))|PermutationGenerator|E(?:numerate(?:Generator|Sequence|d(?:Sequence|Iterator))|mpty(?:Generator|Collection|Iterator))|Fl(?:oat(?:80)?|atten(?:Generator|BidirectionalCollection(?:Index)?|Sequence|Collection(?:Index)?|Iterator))|L(?:egacyChildren|azy(?:RandomAccessCollection|Map(?:RandomAccessCollection|Generator|BidirectionalCollection|Sequence|Collection|Iterator)|BidirectionalCollection|Sequence|Collection|Filter(?:Generator|BidirectionalCollection|Sequence|Collection|I(?:ndex|terator))))|A(?:ny(?:RandomAccessCollection|Generator|BidirectionalCollection|Sequence|Hashable|Collection|I(?:ndex|terator))|utoreleasingUnsafeMutablePointer|rray(?:Slice)?))\\b"
355
- },
356
- {
357
- "comment": "Structs in the standard library in Swift 2 only",
358
- "name": "support.type.swift",
359
- "match": "\\b(?:R(?:everse(?:RandomAccess(?:Collection|Index)|Collection|Index)|awByte)|Map(?:Generator|Sequence|Collection)|S(?:inkOf|etGenerator)|Zip2Generator|DictionaryGenerator|Filter(?:Generator|Sequence|Collection(?:Index)?)|LazyForwardCollection|Any(?:RandomAccessIndex|BidirectionalIndex|Forward(?:Collection|Index)))\\b"
360
- }
361
- ]
362
- },
363
- "builtin-types-builtin-typealias": {
364
- "patterns": [
365
- {
366
- "comment": "Typealiases in the standard library in Swift 3",
367
- "name": "support.type.swift",
368
- "match": "\\b(?:Raw(?:Significand|Exponent|Value)|B(?:ooleanLiteralType|uffer|ase)|S(?:t(?:orage|r(?:i(?:ngLiteralType|de)|eam(?:1|2)))|ubSequence)|NativeBuffer|C(?:hild(?:ren)?|Bool|S(?:hort|ignedChar)|odeUnit|Char(?:16|32)?|Int|Double|Unsigned(?:Short|Char|Int|Long(?:Long)?)|Float|WideChar|Long(?:Long)?)|I(?:n(?:t(?:Max|egerLiteralType)|d(?:ices|ex(?:Distance)?))|terator)|Distance|U(?:n(?:icodeScalar(?:Type|Index|View|LiteralType)|foldFirstSequence)|TF(?:16(?:Index|View)|8Index)|IntMax)|E(?:lement(?:s)?|x(?:tendedGraphemeCluster(?:Type|LiteralType)|ponent))|V(?:oid|alue)|Key|Float(?:32|LiteralType|64)|AnyClass)\\b"
369
- },
370
- {
371
- "comment": "Typealiases in the standard library in Swift 2 only",
372
- "name": "support.type.swift",
373
- "match": "\\b(?:Generator|PlaygroundQuickLook|UWord|Word)\\b"
374
- }
375
- ]
376
- },
377
- "code-block": {
378
- "begin": "\\{",
379
- "end": "\\}",
380
- "beginCaptures": {
381
- "0": {
382
- "name": "punctuation.section.scope.begin.swift"
383
- }
384
- },
385
- "endCaptures": {
386
- "0": {
387
- "name": "punctuation.section.scope.end.swift"
388
- }
389
- },
390
- "patterns": [
391
- {
392
- "include": "$self"
393
- }
394
- ]
395
- },
396
- "comments": {
397
- "patterns": [
398
- {
399
- "name": "comment.line.number-sign.swift",
400
- "match": "\\A^(#!).*$\\n?",
401
- "captures": {
402
- "1": {
403
- "name": "punctuation.definition.comment.swift"
404
- }
405
- }
406
- },
407
- {
408
- "name": "comment.block.documentation.swift",
409
- "begin": "/\\*\\*(?!/)",
410
- "end": "\\*/",
411
- "beginCaptures": {
412
- "0": {
413
- "name": "punctuation.definition.comment.begin.swift"
414
- }
415
- },
416
- "endCaptures": {
417
- "0": {
418
- "name": "punctuation.definition.comment.end.swift"
419
- }
420
- },
421
- "patterns": [
422
- {
423
- "include": "#comments-nested"
424
- }
425
- ]
426
- },
427
- {
428
- "name": "comment.block.documentation.playground.swift",
429
- "begin": "/\\*:",
430
- "end": "\\*/",
431
- "beginCaptures": {
432
- "0": {
433
- "name": "punctuation.definition.comment.begin.swift"
434
- }
435
- },
436
- "endCaptures": {
437
- "0": {
438
- "name": "punctuation.definition.comment.end.swift"
439
- }
440
- },
441
- "patterns": [
442
- {
443
- "include": "#comments-nested"
444
- }
445
- ]
446
- },
447
- {
448
- "name": "comment.block.swift",
449
- "begin": "/\\*",
450
- "end": "\\*/",
451
- "beginCaptures": {
452
- "0": {
453
- "name": "punctuation.definition.comment.begin.swift"
454
- }
455
- },
456
- "endCaptures": {
457
- "0": {
458
- "name": "punctuation.definition.comment.end.swift"
459
- }
460
- },
461
- "patterns": [
462
- {
463
- "include": "#comments-nested"
464
- }
465
- ]
466
- },
467
- {
468
- "name": "invalid.illegal.unexpected-end-of-block-comment.swift",
469
- "match": "\\*/"
470
- },
471
- {
472
- "begin": "(^[ \\t]+)?(?=//)",
473
- "end": "(?!\\G)",
474
- "beginCaptures": {
475
- "1": {
476
- "name": "punctuation.whitespace.comment.leading.swift"
477
- }
478
- },
479
- "patterns": [
480
- {
481
- "name": "comment.line.triple-slash.documentation.swift",
482
- "begin": "///",
483
- "end": "$",
484
- "beginCaptures": {
485
- "0": {
486
- "name": "punctuation.definition.comment.swift"
487
- }
488
- }
489
- },
490
- {
491
- "name": "comment.line.double-slash.documentation.swift",
492
- "begin": "//:",
493
- "end": "$",
494
- "beginCaptures": {
495
- "0": {
496
- "name": "punctuation.definition.comment.swift"
497
- }
498
- }
499
- },
500
- {
501
- "name": "comment.line.double-slash.swift",
502
- "begin": "//",
503
- "end": "$",
504
- "beginCaptures": {
505
- "0": {
506
- "name": "punctuation.definition.comment.swift"
507
- }
508
- }
509
- }
510
- ]
511
- }
512
- ]
513
- },
514
- "comments-nested": {
515
- "begin": "/\\*",
516
- "end": "\\*/",
517
- "patterns": [
518
- {
519
- "include": "#comments-nested"
520
- }
521
- ]
522
- },
523
- "compiler-control": {
524
- "patterns": [
525
- {
526
- "contentName": "comment.block.preprocessor.swift",
527
- "begin": "^\\s*(#)(if|elseif)\\s+(false)\\b.*?(?=$|//|/\\*)",
528
- "end": "(?=^\\s*(#(elseif|else|endif)\\b))",
529
- "beginCaptures": {
530
- "0": {
531
- "name": "meta.preprocessor.conditional.swift"
532
- },
533
- "1": {
534
- "name": "punctuation.definition.preprocessor.swift"
535
- },
536
- "2": {
537
- "name": "keyword.control.import.preprocessor.conditional.swift"
538
- },
539
- "3": {
540
- "name": "constant.language.boolean.swift"
541
- }
542
- }
543
- },
544
- {
545
- "name": "meta.preprocessor.conditional.swift",
546
- "captures": {
547
- "1": {
548
- "name": "punctuation.definition.preprocessor.swift"
549
- },
550
- "2": {
551
- "name": "keyword.control.import.preprocessor.conditional.swift"
552
- }
553
- },
554
- "begin": "^\\s*(#)(if|elseif)\\s+",
555
- "end": "(?=\\s*(?://|/\\*))|$",
556
- "patterns": [
557
- {
558
- "name": "keyword.operator.logical.swift",
559
- "match": "(&&|\\|\\|)"
560
- },
561
- {
562
- "name": "constant.language.boolean.swift",
563
- "match": "\\b(true|false)\\b"
564
- },
565
- {
566
- "match": "\\b(arch)\\s*(\\()\\s*(?:(arm|arm64|powerpc64|powerpc64le|i386|x86_64|s390x)|\\w+)\\s*(\\))",
567
- "captures": {
568
- "1": {
569
- "name": "keyword.other.condition.swift"
570
- },
571
- "2": {
572
- "name": "punctuation.definition.parameters.begin.swift"
573
- },
574
- "3": {
575
- "name": "support.constant.platform.architecture.swift"
576
- },
577
- "4": {
578
- "name": "punctuation.definition.parameters.end.swift"
579
- }
580
- }
581
- },
582
- {
583
- "match": "\\b(os)\\s*(\\()\\s*(?:(macOS|OSX|iOS|tvOS|watchOS|Android|Linux|FreeBSD|Windows|PS4)|\\w+)\\s*(\\))",
584
- "captures": {
585
- "1": {
586
- "name": "keyword.other.condition.swift"
587
- },
588
- "2": {
589
- "name": "punctuation.definition.parameters.begin.swift"
590
- },
591
- "3": {
592
- "name": "support.constant.platform.os.swift"
593
- },
594
- "4": {
595
- "name": "punctuation.definition.parameters.end.swift"
596
- }
597
- }
598
- },
599
- {
600
- "match": "\\b(canImport)\\s*(\\()([\\p{L}_][\\p{L}_\\p{N}\\p{M}]*)(\\))",
601
- "captures": {
602
- "1": {
603
- "name": "keyword.other.condition.swift"
604
- },
605
- "2": {
606
- "name": "punctuation.definition.parameters.begin.swift"
607
- },
608
- "3": {
609
- "name": "entity.name.type.module.swift"
610
- },
611
- "4": {
612
- "name": "punctuation.definition.parameters.end.swift"
613
- }
614
- }
615
- },
616
- {
617
- "begin": "\\b(targetEnvironment)\\s*(\\()",
618
- "end": "(\\))|$",
619
- "beginCaptures": {
620
- "1": {
621
- "name": "keyword.other.condition.swift"
622
- },
623
- "2": {
624
- "name": "punctuation.definition.parameters.begin.swift"
625
- }
626
- },
627
- "endCaptures": {
628
- "1": {
629
- "name": "punctuation.definition.parameters.end.swift"
630
- }
631
- },
632
- "patterns": [
633
- {
634
- "name": "support.constant.platform.environment.swift",
635
- "match": "\\b(simulator|UIKitForMac)\\b"
636
- }
637
- ]
638
- },
639
- {
640
- "begin": "\\b(swift|compiler)\\s*(\\()",
641
- "end": "(\\))|$",
642
- "beginCaptures": {
643
- "1": {
644
- "name": "keyword.other.condition.swift"
645
- },
646
- "2": {
647
- "name": "punctuation.definition.parameters.begin.swift"
648
- }
649
- },
650
- "endCaptures": {
651
- "1": {
652
- "name": "punctuation.definition.parameters.end.swift"
653
- }
654
- },
655
- "patterns": [
656
- {
657
- "name": "keyword.operator.comparison.swift",
658
- "match": ">=|<"
659
- },
660
- {
661
- "name": "constant.numeric.swift",
662
- "match": "\\b[0-9]+(?:\\.[0-9]+)*\\b"
663
- }
664
- ]
665
- }
666
- ]
667
- },
668
- {
669
- "name": "meta.preprocessor.conditional.swift",
670
- "match": "^\\s*(#)(else|endif)(.*?)(?=$|//|/\\*)",
671
- "captures": {
672
- "1": {
673
- "name": "punctuation.definition.preprocessor.swift"
674
- },
675
- "2": {
676
- "name": "keyword.control.import.preprocessor.conditional.swift"
677
- },
678
- "3": {
679
- "patterns": [
680
- {
681
- "name": "invalid.illegal.character-not-allowed-here.swift",
682
- "match": "\\S+"
683
- }
684
- ]
685
- }
686
- }
687
- },
688
- {
689
- "name": "meta.preprocessor.sourcelocation.swift",
690
- "match": "^\\s*(#)(sourceLocation)((\\()([^)]*)(\\)))(.*?)(?=$|//|/\\*)",
691
- "captures": {
692
- "1": {
693
- "name": "punctuation.definition.preprocessor.swift"
694
- },
695
- "2": {
696
- "name": "keyword.control.import.preprocessor.sourcelocation.swift"
697
- },
698
- "4": {
699
- "name": "punctuation.definition.parameters.begin.swift"
700
- },
701
- "5": {
702
- "patterns": [
703
- {
704
- "begin": "(file)\\s*(:)\\s*(?=\")",
705
- "end": "(?!\\G)",
706
- "beginCaptures": {
707
- "1": {
708
- "name": "support.variable.parameter.swift"
709
- },
710
- "2": {
711
- "name": "punctuation.separator.key-value.swift"
712
- }
713
- },
714
- "patterns": [
715
- {
716
- "include": "#literals"
717
- }
718
- ]
719
- },
720
- {
721
- "match": "(line)\\s*(:)\\s*([0-9]+)",
722
- "captures": {
723
- "1": {
724
- "name": "support.variable.parameter.swift"
725
- },
726
- "2": {
727
- "name": "punctuation.separator.key-value.swift"
728
- },
729
- "3": {
730
- "name": "constant.numeric.integer.swift"
731
- }
732
- }
733
- },
734
- {
735
- "name": "punctuation.separator.parameters.swift",
736
- "match": ","
737
- },
738
- {
739
- "name": "invalid.illegal.character-not-allowed-here.swift",
740
- "match": "\\S+"
741
- }
742
- ]
743
- },
744
- "6": {
745
- "name": "punctuation.definition.parameters.begin.swift"
746
- },
747
- "7": {
748
- "patterns": [
749
- {
750
- "name": "invalid.illegal.character-not-allowed-here.swift",
751
- "match": "\\S+"
752
- }
753
- ]
754
- }
755
- }
756
- }
757
- ]
758
- },
759
- "conditionals": {
760
- "patterns": [
761
- {
762
- "begin": "(?<!\\.)\\b(if|guard|switch|for)\\b",
763
- "end": "(?=\\{)",
764
- "beginCaptures": {
765
- "1": {
766
- "patterns": [
767
- {
768
- "include": "#keywords"
769
- }
770
- ]
771
- }
772
- },
773
- "patterns": [
774
- {
775
- "include": "#expressions-without-trailing-closures"
776
- }
777
- ]
778
- },
779
- {
780
- "comment": "while can be the end of a repeat-while statement so doesn't necessarily have braces after it",
781
- "begin": "(?<!\\.)\\b(while)\\b",
782
- "end": "(?=\\{)|$",
783
- "beginCaptures": {
784
- "1": {
785
- "patterns": [
786
- {
787
- "include": "#keywords"
788
- }
789
- ]
790
- }
791
- },
792
- "patterns": [
793
- {
794
- "include": "#expressions-without-trailing-closures"
795
- }
796
- ]
797
- }
798
- ]
799
- },
800
- "declarations": {
801
- "patterns": [
802
- {
803
- "include": "#declarations-function"
804
- },
805
- {
806
- "include": "#declarations-function-initializer"
807
- },
808
- {
809
- "include": "#declarations-function-subscript"
810
- },
811
- {
812
- "include": "#declarations-typed-variable-declaration"
813
- },
814
- {
815
- "include": "#declarations-import"
816
- },
817
- {
818
- "include": "#declarations-operator"
819
- },
820
- {
821
- "include": "#declarations-precedencegroup"
822
- },
823
- {
824
- "include": "#declarations-protocol"
825
- },
826
- {
827
- "include": "#declarations-type"
828
- },
829
- {
830
- "include": "#declarations-extension"
831
- },
832
- {
833
- "include": "#declarations-typealias"
834
- },
835
- {
836
- "include": "#declarations-macro"
837
- }
838
- ]
839
- },
840
- "declarations-available-types": {
841
- "patterns": [
842
- {
843
- "include": "#comments"
844
- },
845
- {
846
- "include": "#builtin-types"
847
- },
848
- {
849
- "include": "#attributes"
850
- },
851
- {
852
- "name": "storage.modifier.async.swift",
853
- "match": "\\basync\\b"
854
- },
855
- {
856
- "name": "storage.modifier.exception.swift",
857
- "match": "\\b(?:throws|rethrows)\\b"
858
- },
859
- {
860
- "name": "keyword.other.operator.type.opaque.swift",
861
- "match": "\\bsome\\b"
862
- },
863
- {
864
- "name": "keyword.other.operator.type.existential.swift",
865
- "match": "\\bany\\b"
866
- },
867
- {
868
- "name": "keyword.control.loop.swift",
869
- "match": "\\b(?:repeat|each)\\b"
870
- },
871
- {
872
- "name": "storage.modifier.swift",
873
- "match": "\\b(?:inout|isolated|borrowing|consuming)\\b"
874
- },
875
- {
876
- "name": "variable.language.swift",
877
- "match": "\\bSelf\\b"
878
- },
879
- {
880
- "match": "(?<![/=\\-+!*%<>&|\\^~.])(->)(?![/=\\-+!*%<>&|\\^~.])",
881
- "captures": {
882
- "1": {
883
- "name": "keyword.operator.type.function.swift"
884
- }
885
- }
886
- },
887
- {
888
- "comment": "Swift 3: A & B",
889
- "match": "(?<![/=\\-+!*%<>&|\\^~.])(&)(?![/=\\-+!*%<>&|\\^~.])",
890
- "captures": {
891
- "1": {
892
- "name": "keyword.operator.type.composition.swift"
893
- }
894
- }
895
- },
896
- {
897
- "name": "keyword.operator.type.optional.swift",
898
- "match": "[?!]"
899
- },
900
- {
901
- "name": "keyword.operator.function.variadic-parameter.swift",
902
- "match": "\\.\\.\\."
903
- },
904
- {
905
- "comment": "Swift 2: protocol<A, B>",
906
- "name": "keyword.other.type.composition.swift",
907
- "match": "\\bprotocol\\b"
908
- },
909
- {
910
- "name": "keyword.other.type.metatype.swift",
911
- "match": "(?<=\\.)(?:Protocol|Type)\\b"
912
- },
913
- {
914
- "include": "#declarations-available-types-tuple-type"
915
- },
916
- {
917
- "include": "#declarations-available-types-collection-type"
918
- },
919
- {
920
- "include": "#declarations-generic-argument-clause"
921
- }
922
- ]
923
- },
924
- "declarations-available-types-collection-type": {
925
- "comment": "array and dictionary types [Value] and [Key: Value]",
926
- "begin": "\\[",
927
- "end": "\\]|(?=[>){}])",
928
- "beginCaptures": {
929
- "0": {
930
- "name": "punctuation.section.collection-type.begin.swift"
931
- }
932
- },
933
- "endCaptures": {
934
- "0": {
935
- "name": "punctuation.section.collection-type.end.swift"
936
- }
937
- },
938
- "patterns": [
939
- {
940
- "include": "#declarations-available-types"
941
- },
942
- {
943
- "begin": ":",
944
- "end": "(?=\\]|[>){}])",
945
- "beginCaptures": {
946
- "0": {
947
- "name": "punctuation.separator.key-value.swift"
948
- }
949
- },
950
- "patterns": [
951
- {
952
- "name": "invalid.illegal.extra-colon-in-dictionary-type.swift",
953
- "match": ":"
954
- },
955
- {
956
- "include": "#declarations-available-types"
957
- }
958
- ]
959
- }
960
- ]
961
- },
962
- "declarations-available-types-tuple-type": {
963
- "begin": "\\(",
964
- "end": "\\)|(?=[>\\]{}])",
965
- "beginCaptures": {
966
- "0": {
967
- "name": "punctuation.section.tuple-type.begin.swift"
968
- }
969
- },
970
- "endCaptures": {
971
- "0": {
972
- "name": "punctuation.section.tuple-type.end.swift"
973
- }
974
- },
975
- "patterns": [
976
- {
977
- "include": "#declarations-available-types"
978
- }
979
- ]
980
- },
981
- "declarations-extension": {
982
- "name": "meta.definition.type.$1.swift",
983
- "begin": "\\b(extension)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
984
- "end": "(?<=\\})",
985
- "beginCaptures": {
986
- "1": {
987
- "name": "storage.type.$1.swift"
988
- },
989
- "2": {
990
- "name": "entity.name.type.swift",
991
- "patterns": [
992
- {
993
- "include": "#declarations-available-types"
994
- }
995
- ]
996
- },
997
- "3": {
998
- "name": "punctuation.definition.identifier.swift"
999
- },
1000
- "4": {
1001
- "name": "punctuation.definition.identifier.swift"
1002
- }
1003
- },
1004
- "patterns": [
1005
- {
1006
- "include": "#comments"
1007
- },
1008
- {
1009
- "comment": "SE-0143: Conditional Conformances",
1010
- "include": "#declarations-generic-where-clause"
1011
- },
1012
- {
1013
- "include": "#declarations-inheritance-clause"
1014
- },
1015
- {
1016
- "name": "meta.definition.type.body.swift",
1017
- "begin": "\\{",
1018
- "end": "\\}",
1019
- "beginCaptures": {
1020
- "0": {
1021
- "name": "punctuation.definition.type.begin.swift"
1022
- }
1023
- },
1024
- "endCaptures": {
1025
- "0": {
1026
- "name": "punctuation.definition.type.end.swift"
1027
- }
1028
- },
1029
- "patterns": [
1030
- {
1031
- "include": "$self"
1032
- }
1033
- ]
1034
- }
1035
- ]
1036
- },
1037
- "declarations-function": {
1038
- "name": "meta.definition.function.swift",
1039
- "begin": "(?x)\n\\b\n(func)\n\\s+\n(\n (?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)\n | (?:\n (\n (?<oph> # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g<oph>\n | (?<opc> # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*\n )\n | ( \\. ( \\g<oph> | \\g<opc> | \\. )+ ) # Dot operators\n )\n)\n\\s*\n(?=\\(|<)",
1040
- "end": "(?<=\\})|$(?# functions in protocol declarations or generated interfaces have no body)",
1041
- "beginCaptures": {
1042
- "1": {
1043
- "name": "storage.type.function.swift"
1044
- },
1045
- "2": {
1046
- "name": "entity.name.function.swift"
1047
- },
1048
- "3": {
1049
- "name": "punctuation.definition.identifier.swift"
1050
- },
1051
- "4": {
1052
- "name": "punctuation.definition.identifier.swift"
1053
- }
1054
- },
1055
- "patterns": [
1056
- {
1057
- "include": "#comments"
1058
- },
1059
- {
1060
- "include": "#declarations-generic-parameter-clause"
1061
- },
1062
- {
1063
- "include": "#declarations-parameter-clause"
1064
- },
1065
- {
1066
- "include": "#declarations-function-result"
1067
- },
1068
- {
1069
- "include": "#async-throws"
1070
- },
1071
- {
1072
- "comment": "Swift 3: generic constraints after the parameters and return type",
1073
- "include": "#declarations-generic-where-clause"
1074
- },
1075
- {
1076
- "name": "meta.definition.function.body.swift",
1077
- "begin": "(\\{)",
1078
- "end": "(\\})",
1079
- "beginCaptures": {
1080
- "1": {
1081
- "name": "punctuation.section.function.begin.swift"
1082
- }
1083
- },
1084
- "endCaptures": {
1085
- "1": {
1086
- "name": "punctuation.section.function.end.swift"
1087
- }
1088
- },
1089
- "patterns": [
1090
- {
1091
- "include": "$self"
1092
- }
1093
- ]
1094
- }
1095
- ]
1096
- },
1097
- "declarations-function-initializer": {
1098
- "name": "meta.definition.function.initializer.swift",
1099
- "begin": "(?<!\\.)\\b(init[?!]*(?# only one is valid, but we want the in⇥ snippet to produce something that looks good))\\s*(?=\\(|<)",
1100
- "end": "(?<=\\})|$",
1101
- "beginCaptures": {
1102
- "1": {
1103
- "name": "storage.type.function.swift",
1104
- "patterns": [
1105
- {
1106
- "name": "invalid.illegal.character-not-allowed-here.swift",
1107
- "match": "(?<=[?!])[?!]+"
1108
- }
1109
- ]
1110
- }
1111
- },
1112
- "patterns": [
1113
- {
1114
- "include": "#comments"
1115
- },
1116
- {
1117
- "include": "#declarations-generic-parameter-clause"
1118
- },
1119
- {
1120
- "include": "#declarations-parameter-clause"
1121
- },
1122
- {
1123
- "include": "#async-throws"
1124
- },
1125
- {
1126
- "comment": "Swift 3: generic constraints after the parameters and return type",
1127
- "include": "#declarations-generic-where-clause"
1128
- },
1129
- {
1130
- "name": "meta.definition.function.body.swift",
1131
- "begin": "(\\{)",
1132
- "end": "(\\})",
1133
- "beginCaptures": {
1134
- "1": {
1135
- "name": "punctuation.section.function.begin.swift"
1136
- }
1137
- },
1138
- "endCaptures": {
1139
- "1": {
1140
- "name": "punctuation.section.function.end.swift"
1141
- }
1142
- },
1143
- "patterns": [
1144
- {
1145
- "include": "$self"
1146
- }
1147
- ]
1148
- }
1149
- ]
1150
- },
1151
- "declarations-function-result": {
1152
- "name": "meta.function-result.swift",
1153
- "begin": "(?<![/=\\-+!*%<>&|\\^~.])(->)(?![/=\\-+!*%<>&|\\^~.])\\s*",
1154
- "end": "(?!\\G)(?=\\{|\\bwhere\\b|;|=)|$",
1155
- "beginCaptures": {
1156
- "1": {
1157
- "name": "keyword.operator.function-result.swift"
1158
- }
1159
- },
1160
- "patterns": [
1161
- {
1162
- "include": "#declarations-available-types"
1163
- }
1164
- ]
1165
- },
1166
- "declarations-function-subscript": {
1167
- "name": "meta.definition.function.subscript.swift",
1168
- "begin": "(?<!\\.)\\b(subscript)\\s*(?=\\(|<)",
1169
- "end": "(?<=\\})|$",
1170
- "beginCaptures": {
1171
- "1": {
1172
- "name": "storage.type.function.swift"
1173
- }
1174
- },
1175
- "patterns": [
1176
- {
1177
- "include": "#comments"
1178
- },
1179
- {
1180
- "include": "#declarations-generic-parameter-clause"
1181
- },
1182
- {
1183
- "include": "#declarations-parameter-clause"
1184
- },
1185
- {
1186
- "include": "#declarations-function-result"
1187
- },
1188
- {
1189
- "include": "#async-throws"
1190
- },
1191
- {
1192
- "include": "#declarations-generic-where-clause"
1193
- },
1194
- {
1195
- "name": "meta.definition.function.body.swift",
1196
- "begin": "(\\{)",
1197
- "end": "(\\})",
1198
- "beginCaptures": {
1199
- "1": {
1200
- "name": "punctuation.section.function.begin.swift"
1201
- }
1202
- },
1203
- "endCaptures": {
1204
- "1": {
1205
- "name": "punctuation.section.function.end.swift"
1206
- }
1207
- },
1208
- "patterns": [
1209
- {
1210
- "include": "$self"
1211
- }
1212
- ]
1213
- }
1214
- ]
1215
- },
1216
- "declarations-generic-argument-clause": {
1217
- "name": "meta.generic-argument-clause.swift",
1218
- "begin": "<",
1219
- "end": ">|(?=[)\\]{}])",
1220
- "beginCaptures": {
1221
- "0": {
1222
- "name": "punctuation.separator.generic-argument-clause.begin.swift"
1223
- }
1224
- },
1225
- "endCaptures": {
1226
- "0": {
1227
- "name": "punctuation.separator.generic-argument-clause.end.swift"
1228
- }
1229
- },
1230
- "patterns": [
1231
- {
1232
- "include": "#declarations-available-types"
1233
- }
1234
- ]
1235
- },
1236
- "declarations-generic-parameter-clause": {
1237
- "name": "meta.generic-parameter-clause.swift",
1238
- "begin": "<",
1239
- "end": ">|(?=[^\\w\\d:<>\\s,=&`])(?# characters besides these are never valid in a generic param list -- even if it's not really a valid clause, we should stop trying to parse it if we see one of them.)",
1240
- "beginCaptures": {
1241
- "0": {
1242
- "name": "punctuation.separator.generic-parameter-clause.begin.swift"
1243
- }
1244
- },
1245
- "endCaptures": {
1246
- "0": {
1247
- "name": "punctuation.separator.generic-parameter-clause.end.swift"
1248
- }
1249
- },
1250
- "patterns": [
1251
- {
1252
- "include": "#comments"
1253
- },
1254
- {
1255
- "comment": "Swift 2: constraints inside the generic param list",
1256
- "include": "#declarations-generic-where-clause"
1257
- },
1258
- {
1259
- "name": "keyword.control.loop.swift",
1260
- "match": "\\beach\\b"
1261
- },
1262
- {
1263
- "match": "\\b((?!\\d)\\w[\\w\\d]*)\\b",
1264
- "captures": {
1265
- "1": {
1266
- "name": "variable.language.generic-parameter.swift"
1267
- }
1268
- }
1269
- },
1270
- {
1271
- "name": "punctuation.separator.generic-parameters.swift",
1272
- "match": ","
1273
- },
1274
- {
1275
- "name": "meta.generic-parameter-constraint.swift",
1276
- "begin": "(:)\\s*",
1277
- "end": "(?=[,>]|(?!\\G)\\bwhere\\b)",
1278
- "beginCaptures": {
1279
- "1": {
1280
- "name": "punctuation.separator.generic-parameter-constraint.swift"
1281
- }
1282
- },
1283
- "patterns": [
1284
- {
1285
- "name": "entity.other.inherited-class.swift",
1286
- "begin": "\\G",
1287
- "end": "(?=[,>]|(?!\\G)\\bwhere\\b)",
1288
- "patterns": [
1289
- {
1290
- "include": "#declarations-type-identifier"
1291
- },
1292
- {
1293
- "include": "#declarations-type-operators"
1294
- }
1295
- ]
1296
- }
1297
- ]
1298
- }
1299
- ]
1300
- },
1301
- "declarations-generic-where-clause": {
1302
- "name": "meta.generic-where-clause.swift",
1303
- "begin": "\\b(where)\\b\\s*",
1304
- "end": "(?!\\G)$|(?=[>{};\\n]|//|/\\*)",
1305
- "beginCaptures": {
1306
- "1": {
1307
- "name": "keyword.other.generic-constraint-introducer.swift"
1308
- }
1309
- },
1310
- "patterns": [
1311
- {
1312
- "include": "#comments"
1313
- },
1314
- {
1315
- "include": "#declarations-generic-where-clause-requirement-list"
1316
- }
1317
- ]
1318
- },
1319
- "declarations-generic-where-clause-requirement-list": {
1320
- "begin": "\\G|,\\s*",
1321
- "end": "(?=[,>{};\\n]|//|/\\*)",
1322
- "patterns": [
1323
- {
1324
- "include": "#comments"
1325
- },
1326
- {
1327
- "include": "#constraint"
1328
- },
1329
- {
1330
- "include": "#declarations-available-types"
1331
- },
1332
- {
1333
- "name": "meta.generic-where-clause.same-type-requirement.swift",
1334
- "begin": "(?<![/=\\-+!*%<>&|\\^~.])(==)(?![/=\\-+!*%<>&|\\^~.])",
1335
- "end": "(?=\\s*[,>{};\\n]|//|/\\*)",
1336
- "beginCaptures": {
1337
- "1": {
1338
- "name": "keyword.operator.generic-constraint.same-type.swift"
1339
- }
1340
- },
1341
- "patterns": [
1342
- {
1343
- "include": "#declarations-available-types"
1344
- }
1345
- ]
1346
- },
1347
- {
1348
- "name": "meta.generic-where-clause.conformance-requirement.swift",
1349
- "begin": "(?<![/=\\-+!*%<>&|\\^~.])(:)(?![/=\\-+!*%<>&|\\^~.])",
1350
- "end": "(?=\\s*[,>{};\\n]|//|/\\*)",
1351
- "beginCaptures": {
1352
- "1": {
1353
- "name": "keyword.operator.generic-constraint.conforms-to.swift"
1354
- }
1355
- },
1356
- "patterns": [
1357
- {
1358
- "contentName": "entity.other.inherited-class.swift",
1359
- "begin": "\\G\\s*",
1360
- "end": "(?=\\s*[,>{};\\n]|//|/\\*)",
1361
- "patterns": [
1362
- {
1363
- "include": "#declarations-available-types"
1364
- }
1365
- ]
1366
- }
1367
- ]
1368
- }
1369
- ]
1370
- },
1371
- "declarations-import": {
1372
- "name": "meta.import.swift",
1373
- "begin": "(?<!\\.)\\b(import)\\s+",
1374
- "end": "(;)|$\\n?|(?=//|/\\*)",
1375
- "beginCaptures": {
1376
- "1": {
1377
- "name": "keyword.control.import.swift"
1378
- }
1379
- },
1380
- "endCaptures": {
1381
- "1": {
1382
- "name": "punctuation.terminator.statement.swift"
1383
- }
1384
- },
1385
- "patterns": [
1386
- {
1387
- "begin": "\\G(?!;|$|//|/\\*)(?:(typealias|struct|class|actor|enum|protocol|var|func)\\s+)?",
1388
- "end": "(?=;|$|//|/\\*)",
1389
- "beginCaptures": {
1390
- "1": {
1391
- "name": "storage.modifier.swift"
1392
- }
1393
- },
1394
- "patterns": [
1395
- {
1396
- "name": "entity.name.type.swift",
1397
- "match": "(?x)\n(?<=\\G|\\.)\n(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)",
1398
- "captures": {
1399
- "1": {
1400
- "name": "punctuation.definition.identifier.swift"
1401
- },
1402
- "2": {
1403
- "name": "punctuation.definition.identifier.swift"
1404
- }
1405
- }
1406
- },
1407
- {
1408
- "name": "entity.name.type.swift",
1409
- "match": "(?x)\n(?<=\\G|\\.)\n\\$[0-9]+"
1410
- },
1411
- {
1412
- "name": "entity.name.type.swift",
1413
- "match": "(?x)\n(?<=\\G|\\.)\n(?:\n (\n (?<oph> # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g<oph>\n | (?<opc> # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*\n )\n | ( \\. ( \\g<oph> | \\g<opc> | \\. )+ ) # Dot operators\n)\n(?=\\.|;|$|//|/\\*|\\s)",
1414
- "captures": {
1415
- "1": {
1416
- "patterns": [
1417
- {
1418
- "name": "invalid.illegal.dot-not-allowed-here.swift",
1419
- "match": "\\."
1420
- }
1421
- ]
1422
- }
1423
- }
1424
- },
1425
- {
1426
- "name": "punctuation.separator.import.swift",
1427
- "match": "\\."
1428
- },
1429
- {
1430
- "name": "invalid.illegal.character-not-allowed-here.swift",
1431
- "begin": "(?!\\s*(;|$|//|/\\*))",
1432
- "end": "(?=\\s*(;|$|//|/\\*))"
1433
- }
1434
- ]
1435
- }
1436
- ]
1437
- },
1438
- "declarations-inheritance-clause": {
1439
- "name": "meta.inheritance-clause.swift",
1440
- "begin": "(:)(?=\\s*\\{)|(:)\\s*",
1441
- "end": "(?!\\G)$|(?=[={}]|(?!\\G)\\bwhere\\b)",
1442
- "beginCaptures": {
1443
- "1": {
1444
- "name": "invalid.illegal.empty-inheritance-clause.swift"
1445
- },
1446
- "2": {
1447
- "name": "punctuation.separator.inheritance-clause.swift"
1448
- }
1449
- },
1450
- "patterns": [
1451
- {
1452
- "begin": "\\bclass\\b",
1453
- "end": "(?=[={}]|(?!\\G)\\bwhere\\b)",
1454
- "beginCaptures": {
1455
- "0": {
1456
- "name": "storage.type.class.swift"
1457
- }
1458
- },
1459
- "patterns": [
1460
- {
1461
- "include": "#comments"
1462
- },
1463
- {
1464
- "include": "#declarations-inheritance-clause-more-types"
1465
- }
1466
- ]
1467
- },
1468
- {
1469
- "begin": "\\G",
1470
- "end": "(?!\\G)$|(?=[={}]|(?!\\G)\\bwhere\\b)",
1471
- "patterns": [
1472
- {
1473
- "include": "#comments"
1474
- },
1475
- {
1476
- "include": "#declarations-inheritance-clause-inherited-type"
1477
- },
1478
- {
1479
- "include": "#declarations-inheritance-clause-more-types"
1480
- },
1481
- {
1482
- "include": "#declarations-type-operators"
1483
- }
1484
- ]
1485
- }
1486
- ]
1487
- },
1488
- "declarations-inheritance-clause-inherited-type": {
1489
- "name": "entity.other.inherited-class.swift",
1490
- "begin": "(?=[`\\p{L}_])",
1491
- "end": "(?!\\G)",
1492
- "patterns": [
1493
- {
1494
- "include": "#declarations-type-identifier"
1495
- }
1496
- ]
1497
- },
1498
- "declarations-inheritance-clause-more-types": {
1499
- "name": "meta.inheritance-list.more-types",
1500
- "begin": ",\\s*",
1501
- "end": "(?!\\G)(?!//|/\\*)|(?=[,={}]|(?!\\G)\\bwhere\\b)",
1502
- "patterns": [
1503
- {
1504
- "include": "#comments"
1505
- },
1506
- {
1507
- "include": "#declarations-inheritance-clause-inherited-type"
1508
- },
1509
- {
1510
- "include": "#declarations-inheritance-clause-more-types"
1511
- },
1512
- {
1513
- "include": "#declarations-type-operators"
1514
- }
1515
- ]
1516
- },
1517
- "declarations-macro": {
1518
- "name": "meta.definition.macro.swift",
1519
- "begin": "(?x)\n\\b\n(macro)\n\\s+\n((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\n\\s*\n(?=\\(|<|=)",
1520
- "end": "$|(?=;|//|/\\*|\\}|=)",
1521
- "beginCaptures": {
1522
- "1": {
1523
- "name": "storage.type.function.swift"
1524
- },
1525
- "2": {
1526
- "name": "entity.name.function.swift"
1527
- },
1528
- "3": {
1529
- "name": "punctuation.definition.identifier.swift"
1530
- },
1531
- "4": {
1532
- "name": "punctuation.definition.identifier.swift"
1533
- }
1534
- },
1535
- "patterns": [
1536
- {
1537
- "include": "#comments"
1538
- },
1539
- {
1540
- "include": "#declarations-generic-parameter-clause"
1541
- },
1542
- {
1543
- "include": "#declarations-parameter-clause"
1544
- },
1545
- {
1546
- "include": "#declarations-function-result"
1547
- },
1548
- {
1549
- "include": "#async-throws"
1550
- },
1551
- {
1552
- "comment": "Swift 3: generic constraints after the parameters and return type",
1553
- "include": "#declarations-generic-where-clause"
1554
- }
1555
- ]
1556
- },
1557
- "declarations-operator": {
1558
- "name": "meta.definition.operator.swift",
1559
- "begin": "(?x)\n(?:\n \\b(prefix|infix|postfix)\n \\s+\n)?\n\\b\n(operator)\n\\s+\n(\n (\n (?<oph> # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g<oph>\n | \\. # Invalid dot\n | (?<opc> # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*+\n )\n | ( \\. ( \\g<oph> | \\g<opc> | \\. )++ ) # Dot operators\n)\n\\s*",
1560
- "end": "(;)|$\\n?|(?=//|/\\*)",
1561
- "beginCaptures": {
1562
- "1": {
1563
- "name": "storage.modifier.swift"
1564
- },
1565
- "2": {
1566
- "name": "storage.type.function.operator.swift"
1567
- },
1568
- "3": {
1569
- "name": "entity.name.function.operator.swift"
1570
- },
1571
- "4": {
1572
- "comment": "workaround for https://github.com/microsoft/vscode-textmate/issues/140#issuecomment-1793610346",
1573
- "name": "entity.name.function.operator.swift",
1574
- "patterns": [
1575
- {
1576
- "name": "invalid.illegal.dot-not-allowed-here.swift",
1577
- "match": "\\."
1578
- }
1579
- ]
1580
- }
1581
- },
1582
- "endCaptures": {
1583
- "1": {
1584
- "name": "punctuation.terminator.statement.swift"
1585
- }
1586
- },
1587
- "patterns": [
1588
- {
1589
- "include": "#declarations-operator-swift2"
1590
- },
1591
- {
1592
- "include": "#declarations-operator-swift3"
1593
- },
1594
- {
1595
- "name": "invalid.illegal.character-not-allowed-here.swift",
1596
- "match": "((?!$|;|//|/\\*)\\S)+"
1597
- }
1598
- ]
1599
- },
1600
- "declarations-operator-swift2": {
1601
- "begin": "\\G(\\{)",
1602
- "end": "(\\})",
1603
- "beginCaptures": {
1604
- "1": {
1605
- "name": "punctuation.definition.operator.begin.swift"
1606
- }
1607
- },
1608
- "endCaptures": {
1609
- "1": {
1610
- "name": "punctuation.definition.operator.end.swift"
1611
- }
1612
- },
1613
- "patterns": [
1614
- {
1615
- "include": "#comments"
1616
- },
1617
- {
1618
- "match": "\\b(associativity)\\s+(left|right)\\b",
1619
- "captures": {
1620
- "1": {
1621
- "name": "storage.modifier.swift"
1622
- },
1623
- "2": {
1624
- "name": "keyword.other.operator.associativity.swift"
1625
- }
1626
- }
1627
- },
1628
- {
1629
- "match": "\\b(precedence)\\s+([0-9]+)\\b",
1630
- "captures": {
1631
- "1": {
1632
- "name": "storage.modifier.swift"
1633
- },
1634
- "2": {
1635
- "name": "constant.numeric.integer.swift"
1636
- }
1637
- }
1638
- },
1639
- {
1640
- "match": "\\b(assignment)\\b",
1641
- "captures": {
1642
- "1": {
1643
- "name": "storage.modifier.swift"
1644
- }
1645
- }
1646
- }
1647
- ]
1648
- },
1649
- "declarations-operator-swift3": {
1650
- "match": "\\G(:)\\s*((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
1651
- "captures": {
1652
- "2": {
1653
- "name": "entity.other.inherited-class.swift",
1654
- "patterns": [
1655
- {
1656
- "include": "#declarations-types-precedencegroup"
1657
- }
1658
- ]
1659
- },
1660
- "3": {
1661
- "name": "punctuation.definition.identifier.swift"
1662
- },
1663
- "4": {
1664
- "name": "punctuation.definition.identifier.swift"
1665
- }
1666
- }
1667
- },
1668
- "declarations-parameter-clause": {
1669
- "name": "meta.parameter-clause.swift",
1670
- "begin": "(\\()",
1671
- "end": "(\\))(?:\\s*(async)\\b)?",
1672
- "beginCaptures": {
1673
- "1": {
1674
- "name": "punctuation.definition.parameters.begin.swift"
1675
- }
1676
- },
1677
- "endCaptures": {
1678
- "1": {
1679
- "name": "punctuation.definition.parameters.end.swift"
1680
- },
1681
- "2": {
1682
- "name": "storage.modifier.async.swift"
1683
- }
1684
- },
1685
- "patterns": [
1686
- {
1687
- "include": "#declarations-parameter-list"
1688
- }
1689
- ]
1690
- },
1691
- "declarations-parameter-list": {
1692
- "patterns": [
1693
- {
1694
- "comment": "External parameter labels are considered part of the function name",
1695
- "match": "((?<q1>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q1>))\\s+((?<q2>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q2>))(?=\\s*:)",
1696
- "captures": {
1697
- "1": {
1698
- "name": "entity.name.function.swift"
1699
- },
1700
- "2": {
1701
- "name": "punctuation.definition.identifier.swift"
1702
- },
1703
- "3": {
1704
- "name": "punctuation.definition.identifier.swift"
1705
- },
1706
- "4": {
1707
- "name": "variable.parameter.function.swift"
1708
- },
1709
- "5": {
1710
- "name": "punctuation.definition.identifier.swift"
1711
- },
1712
- "6": {
1713
- "name": "punctuation.definition.identifier.swift"
1714
- }
1715
- }
1716
- },
1717
- {
1718
- "comment": "If no external label is given, the name is both the external label and the internal variable name",
1719
- "match": "(((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)))(?=\\s*:)",
1720
- "captures": {
1721
- "1": {
1722
- "name": "variable.parameter.function.swift"
1723
- },
1724
- "2": {
1725
- "name": "entity.name.function.swift"
1726
- },
1727
- "3": {
1728
- "name": "punctuation.definition.identifier.swift"
1729
- },
1730
- "4": {
1731
- "name": "punctuation.definition.identifier.swift"
1732
- }
1733
- }
1734
- },
1735
- {
1736
- "begin": ":\\s*(?!\\s)",
1737
- "end": "(?=[,)])",
1738
- "patterns": [
1739
- {
1740
- "include": "#declarations-available-types"
1741
- },
1742
- {
1743
- "name": "invalid.illegal.extra-colon-in-parameter-list.swift",
1744
- "match": ":"
1745
- },
1746
- {
1747
- "comment": "a parameter's default value",
1748
- "begin": "=",
1749
- "end": "(?=[,)])",
1750
- "beginCaptures": {
1751
- "0": {
1752
- "name": "keyword.operator.assignment.swift"
1753
- }
1754
- },
1755
- "patterns": [
1756
- {
1757
- "include": "#expressions"
1758
- }
1759
- ]
1760
- }
1761
- ]
1762
- }
1763
- ]
1764
- },
1765
- "declarations-precedencegroup": {
1766
- "name": "meta.definition.precedencegroup.swift",
1767
- "begin": "\\b(precedencegroup)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*(?=\\{)",
1768
- "end": "(?!\\G)",
1769
- "beginCaptures": {
1770
- "1": {
1771
- "name": "storage.type.precedencegroup.swift"
1772
- },
1773
- "2": {
1774
- "name": "entity.name.type.precedencegroup.swift"
1775
- },
1776
- "3": {
1777
- "name": "punctuation.definition.identifier.swift"
1778
- },
1779
- "4": {
1780
- "name": "punctuation.definition.identifier.swift"
1781
- }
1782
- },
1783
- "patterns": [
1784
- {
1785
- "begin": "\\{",
1786
- "end": "\\}",
1787
- "beginCaptures": {
1788
- "0": {
1789
- "name": "punctuation.definition.precedencegroup.begin.swift"
1790
- }
1791
- },
1792
- "endCaptures": {
1793
- "0": {
1794
- "name": "punctuation.definition.precedencegroup.end.swift"
1795
- }
1796
- },
1797
- "patterns": [
1798
- {
1799
- "include": "#comments"
1800
- },
1801
- {
1802
- "match": "\\b(higherThan|lowerThan)\\s*:\\s*((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
1803
- "captures": {
1804
- "1": {
1805
- "name": "storage.modifier.swift"
1806
- },
1807
- "2": {
1808
- "name": "entity.other.inherited-class.swift",
1809
- "patterns": [
1810
- {
1811
- "include": "#declarations-types-precedencegroup"
1812
- }
1813
- ]
1814
- },
1815
- "3": {
1816
- "name": "punctuation.definition.identifier.swift"
1817
- },
1818
- "4": {
1819
- "name": "punctuation.definition.identifier.swift"
1820
- }
1821
- }
1822
- },
1823
- {
1824
- "match": "\\b(associativity)\\b(?:\\s*:\\s*(right|left|none)\\b)?",
1825
- "captures": {
1826
- "1": {
1827
- "name": "storage.modifier.swift"
1828
- },
1829
- "2": {
1830
- "name": "keyword.other.operator.associativity.swift"
1831
- }
1832
- }
1833
- },
1834
- {
1835
- "match": "\\b(assignment)\\b(?:\\s*:\\s*(true|false)\\b)?",
1836
- "captures": {
1837
- "1": {
1838
- "name": "storage.modifier.swift"
1839
- },
1840
- "2": {
1841
- "name": "constant.language.boolean.swift"
1842
- }
1843
- }
1844
- }
1845
- ]
1846
- }
1847
- ]
1848
- },
1849
- "declarations-protocol": {
1850
- "name": "meta.definition.type.protocol.swift",
1851
- "begin": "\\b(protocol)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
1852
- "end": "(?<=\\})",
1853
- "beginCaptures": {
1854
- "1": {
1855
- "name": "storage.type.$1.swift"
1856
- },
1857
- "2": {
1858
- "name": "entity.name.type.$1.swift"
1859
- },
1860
- "3": {
1861
- "name": "punctuation.definition.identifier.swift"
1862
- },
1863
- "4": {
1864
- "name": "punctuation.definition.identifier.swift"
1865
- }
1866
- },
1867
- "patterns": [
1868
- {
1869
- "include": "#comments"
1870
- },
1871
- {
1872
- "include": "#declarations-inheritance-clause"
1873
- },
1874
- {
1875
- "comment": "SE-0142: Permit where clauses to constrain associated types",
1876
- "include": "#declarations-generic-where-clause"
1877
- },
1878
- {
1879
- "name": "meta.definition.type.body.swift",
1880
- "begin": "\\{",
1881
- "end": "\\}",
1882
- "beginCaptures": {
1883
- "0": {
1884
- "name": "punctuation.definition.type.begin.swift"
1885
- }
1886
- },
1887
- "endCaptures": {
1888
- "0": {
1889
- "name": "punctuation.definition.type.end.swift"
1890
- }
1891
- },
1892
- "patterns": [
1893
- {
1894
- "include": "#declarations-protocol-protocol-method"
1895
- },
1896
- {
1897
- "include": "#declarations-protocol-protocol-initializer"
1898
- },
1899
- {
1900
- "include": "#declarations-protocol-associated-type"
1901
- },
1902
- {
1903
- "include": "$self"
1904
- }
1905
- ]
1906
- }
1907
- ]
1908
- },
1909
- "declarations-protocol-associated-type": {
1910
- "name": "meta.definition.associatedtype.swift",
1911
- "begin": "\\b(associatedtype)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
1912
- "end": "(?!\\G)$|(?=[;}]|$)",
1913
- "beginCaptures": {
1914
- "1": {
1915
- "name": "keyword.other.declaration-specifier.swift"
1916
- },
1917
- "2": {
1918
- "name": "variable.language.associatedtype.swift"
1919
- },
1920
- "3": {
1921
- "name": "punctuation.definition.identifier.swift"
1922
- },
1923
- "4": {
1924
- "name": "punctuation.definition.identifier.swift"
1925
- }
1926
- },
1927
- "patterns": [
1928
- {
1929
- "include": "#declarations-inheritance-clause"
1930
- },
1931
- {
1932
- "comment": "SE-0142: Permit where clauses to constrain associated types",
1933
- "include": "#declarations-generic-where-clause"
1934
- },
1935
- {
1936
- "include": "#declarations-typealias-assignment"
1937
- }
1938
- ]
1939
- },
1940
- "declarations-protocol-protocol-initializer": {
1941
- "name": "meta.definition.function.initializer.swift",
1942
- "begin": "(?<!\\.)\\b(init[?!]*(?# only one is valid, but we want the in⇥ snippet to produce something that looks good))\\s*(?=\\(|<)",
1943
- "end": "$|(?=;|//|/\\*|\\})",
1944
- "beginCaptures": {
1945
- "1": {
1946
- "name": "storage.type.function.swift",
1947
- "patterns": [
1948
- {
1949
- "name": "invalid.illegal.character-not-allowed-here.swift",
1950
- "match": "(?<=[?!])[?!]+"
1951
- }
1952
- ]
1953
- }
1954
- },
1955
- "patterns": [
1956
- {
1957
- "include": "#comments"
1958
- },
1959
- {
1960
- "include": "#declarations-generic-parameter-clause"
1961
- },
1962
- {
1963
- "include": "#declarations-parameter-clause"
1964
- },
1965
- {
1966
- "include": "#async-throws"
1967
- },
1968
- {
1969
- "comment": "Swift 3: generic constraints after the parameters and return type",
1970
- "include": "#declarations-generic-where-clause"
1971
- },
1972
- {
1973
- "name": "invalid.illegal.function-body-not-allowed-in-protocol.swift",
1974
- "begin": "\\{",
1975
- "end": "\\}",
1976
- "beginCaptures": {
1977
- "0": {
1978
- "name": "punctuation.section.function.begin.swift"
1979
- }
1980
- },
1981
- "endCaptures": {
1982
- "0": {
1983
- "name": "punctuation.section.function.end.swift"
1984
- }
1985
- },
1986
- "patterns": [
1987
- {
1988
- "include": "$self"
1989
- }
1990
- ]
1991
- }
1992
- ]
1993
- },
1994
- "declarations-protocol-protocol-method": {
1995
- "name": "meta.definition.function.swift",
1996
- "begin": "(?x)\n\\b\n(func)\n\\s+\n(\n (?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)\n | (?:\n (\n (?<oph> # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n (\n \\g<oph>\n | (?<opc> # operator-character\n [\\x{0300}-\\x{036F}]\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n )*\n )\n | ( \\. ( \\g<oph> | \\g<opc> | \\. )+ ) # Dot operators\n )\n )\n\\s*\n(?=\\(|<)",
1997
- "end": "$|(?=;|//|/\\*|\\})",
1998
- "beginCaptures": {
1999
- "1": {
2000
- "name": "storage.type.function.swift"
2001
- },
2002
- "2": {
2003
- "name": "entity.name.function.swift"
2004
- },
2005
- "3": {
2006
- "name": "punctuation.definition.identifier.swift"
2007
- },
2008
- "4": {
2009
- "name": "punctuation.definition.identifier.swift"
2010
- }
2011
- },
2012
- "patterns": [
2013
- {
2014
- "include": "#comments"
2015
- },
2016
- {
2017
- "include": "#declarations-generic-parameter-clause"
2018
- },
2019
- {
2020
- "include": "#declarations-parameter-clause"
2021
- },
2022
- {
2023
- "include": "#declarations-function-result"
2024
- },
2025
- {
2026
- "include": "#async-throws"
2027
- },
2028
- {
2029
- "comment": "Swift 3: generic constraints after the parameters and return type",
2030
- "include": "#declarations-generic-where-clause"
2031
- },
2032
- {
2033
- "name": "invalid.illegal.function-body-not-allowed-in-protocol.swift",
2034
- "begin": "\\{",
2035
- "end": "\\}",
2036
- "beginCaptures": {
2037
- "0": {
2038
- "name": "punctuation.section.function.begin.swift"
2039
- }
2040
- },
2041
- "endCaptures": {
2042
- "0": {
2043
- "name": "punctuation.section.function.end.swift"
2044
- }
2045
- },
2046
- "patterns": [
2047
- {
2048
- "include": "$self"
2049
- }
2050
- ]
2051
- }
2052
- ]
2053
- },
2054
- "declarations-type": {
2055
- "patterns": [
2056
- {
2057
- "name": "meta.definition.type.$1.swift",
2058
- "begin": "\\b(class(?!\\s+(?:func|var|let)\\b)|struct|actor)\\b\\s*((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
2059
- "end": "(?<=\\})",
2060
- "beginCaptures": {
2061
- "1": {
2062
- "name": "storage.type.$1.swift"
2063
- },
2064
- "2": {
2065
- "name": "entity.name.type.$1.swift"
2066
- },
2067
- "3": {
2068
- "name": "punctuation.definition.identifier.swift"
2069
- },
2070
- "4": {
2071
- "name": "punctuation.definition.identifier.swift"
2072
- }
2073
- },
2074
- "patterns": [
2075
- {
2076
- "include": "#comments"
2077
- },
2078
- {
2079
- "include": "#declarations-generic-parameter-clause"
2080
- },
2081
- {
2082
- "comment": "Swift 3: generic constraints after the generic param list",
2083
- "include": "#declarations-generic-where-clause"
2084
- },
2085
- {
2086
- "include": "#declarations-inheritance-clause"
2087
- },
2088
- {
2089
- "name": "meta.definition.type.body.swift",
2090
- "begin": "\\{",
2091
- "end": "\\}",
2092
- "beginCaptures": {
2093
- "0": {
2094
- "name": "punctuation.definition.type.begin.swift"
2095
- }
2096
- },
2097
- "endCaptures": {
2098
- "0": {
2099
- "name": "punctuation.definition.type.end.swift"
2100
- }
2101
- },
2102
- "patterns": [
2103
- {
2104
- "include": "$self"
2105
- }
2106
- ]
2107
- }
2108
- ]
2109
- },
2110
- {
2111
- "include": "#declarations-type-enum"
2112
- }
2113
- ]
2114
- },
2115
- "declarations-type-enum": {
2116
- "name": "meta.definition.type.$1.swift",
2117
- "begin": "\\b(enum)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
2118
- "end": "(?<=\\})",
2119
- "beginCaptures": {
2120
- "1": {
2121
- "name": "storage.type.$1.swift"
2122
- },
2123
- "2": {
2124
- "name": "entity.name.type.$1.swift"
2125
- },
2126
- "3": {
2127
- "name": "punctuation.definition.identifier.swift"
2128
- },
2129
- "4": {
2130
- "name": "punctuation.definition.identifier.swift"
2131
- }
2132
- },
2133
- "patterns": [
2134
- {
2135
- "include": "#comments"
2136
- },
2137
- {
2138
- "include": "#declarations-generic-parameter-clause"
2139
- },
2140
- {
2141
- "comment": "Swift 3: generic constraints after the generic param list",
2142
- "include": "#declarations-generic-where-clause"
2143
- },
2144
- {
2145
- "include": "#declarations-inheritance-clause"
2146
- },
2147
- {
2148
- "name": "meta.definition.type.body.swift",
2149
- "begin": "\\{",
2150
- "end": "\\}",
2151
- "beginCaptures": {
2152
- "0": {
2153
- "name": "punctuation.definition.type.begin.swift"
2154
- }
2155
- },
2156
- "endCaptures": {
2157
- "0": {
2158
- "name": "punctuation.definition.type.end.swift"
2159
- }
2160
- },
2161
- "patterns": [
2162
- {
2163
- "include": "#declarations-type-enum-enum-case-clause"
2164
- },
2165
- {
2166
- "include": "$self"
2167
- }
2168
- ]
2169
- }
2170
- ]
2171
- },
2172
- "declarations-type-enum-associated-values": {
2173
- "begin": "\\G\\(",
2174
- "end": "\\)",
2175
- "beginCaptures": {
2176
- "0": {
2177
- "name": "punctuation.definition.parameters.begin.swift"
2178
- }
2179
- },
2180
- "endCaptures": {
2181
- "0": {
2182
- "name": "punctuation.definition.parameters.end.swift"
2183
- }
2184
- },
2185
- "patterns": [
2186
- {
2187
- "include": "#comments"
2188
- },
2189
- {
2190
- "begin": "(?x)\n(?:(_)|((?<q1>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k<q1>))\n\\s+\n(((?<q2>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k<q2>))\n\\s*(:)",
2191
- "end": "(?=[,)\\]])",
2192
- "beginCaptures": {
2193
- "1": {
2194
- "name": "entity.name.function.swift"
2195
- },
2196
- "2": {
2197
- "name": "invalid.illegal.distinct-labels-not-allowed.swift"
2198
- },
2199
- "5": {
2200
- "name": "variable.parameter.function.swift"
2201
- },
2202
- "7": {
2203
- "name": "punctuation.separator.argument-label.swift"
2204
- }
2205
- },
2206
- "patterns": [
2207
- {
2208
- "include": "#declarations-available-types"
2209
- }
2210
- ]
2211
- },
2212
- {
2213
- "begin": "(((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k<q>))\\s*(:)",
2214
- "end": "(?=[,)\\]])",
2215
- "beginCaptures": {
2216
- "1": {
2217
- "name": "entity.name.function.swift"
2218
- },
2219
- "2": {
2220
- "name": "variable.parameter.function.swift"
2221
- },
2222
- "4": {
2223
- "name": "punctuation.separator.argument-label.swift"
2224
- }
2225
- },
2226
- "patterns": [
2227
- {
2228
- "include": "#declarations-available-types"
2229
- }
2230
- ]
2231
- },
2232
- {
2233
- "comment": "an element without a label (i.e. anything else)",
2234
- "begin": "(?![,)\\]])(?=\\S)",
2235
- "end": "(?=[,)\\]])",
2236
- "patterns": [
2237
- {
2238
- "include": "#declarations-available-types"
2239
- },
2240
- {
2241
- "name": "invalid.illegal.extra-colon-in-parameter-list.swift",
2242
- "match": ":"
2243
- }
2244
- ]
2245
- }
2246
- ]
2247
- },
2248
- "declarations-type-enum-enum-case": {
2249
- "begin": "(?x)((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
2250
- "end": "(?<=\\))|(?![=(])",
2251
- "beginCaptures": {
2252
- "1": {
2253
- "name": "variable.other.enummember.swift"
2254
- }
2255
- },
2256
- "patterns": [
2257
- {
2258
- "include": "#comments"
2259
- },
2260
- {
2261
- "include": "#declarations-type-enum-associated-values"
2262
- },
2263
- {
2264
- "include": "#declarations-type-enum-raw-value-assignment"
2265
- }
2266
- ]
2267
- },
2268
- "declarations-type-enum-enum-case-clause": {
2269
- "begin": "\\b(case)\\b\\s*",
2270
- "end": "(?=[;}])|(?!\\G)(?!//|/\\*)(?=[^\\s,])",
2271
- "beginCaptures": {
2272
- "1": {
2273
- "name": "storage.type.enum.case.swift"
2274
- }
2275
- },
2276
- "patterns": [
2277
- {
2278
- "include": "#comments"
2279
- },
2280
- {
2281
- "include": "#declarations-type-enum-enum-case"
2282
- },
2283
- {
2284
- "include": "#declarations-type-enum-more-cases"
2285
- }
2286
- ]
2287
- },
2288
- "declarations-type-enum-more-cases": {
2289
- "name": "meta.enum-case.more-cases",
2290
- "begin": ",\\s*",
2291
- "end": "(?!\\G)(?!//|/\\*)(?=[;}]|[^\\s,])",
2292
- "patterns": [
2293
- {
2294
- "include": "#comments"
2295
- },
2296
- {
2297
- "include": "#declarations-type-enum-enum-case"
2298
- },
2299
- {
2300
- "include": "#declarations-type-enum-more-cases"
2301
- }
2302
- ]
2303
- },
2304
- "declarations-type-enum-raw-value-assignment": {
2305
- "begin": "(=)\\s*",
2306
- "end": "(?!\\G)",
2307
- "beginCaptures": {
2308
- "1": {
2309
- "name": "keyword.operator.assignment.swift"
2310
- }
2311
- },
2312
- "patterns": [
2313
- {
2314
- "include": "#comments"
2315
- },
2316
- {
2317
- "include": "#literals"
2318
- }
2319
- ]
2320
- },
2321
- "declarations-type-identifier": {
2322
- "begin": "((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
2323
- "end": "(?!<)",
2324
- "beginCaptures": {
2325
- "1": {
2326
- "name": "meta.type-name.swift",
2327
- "patterns": [
2328
- {
2329
- "include": "#builtin-types"
2330
- }
2331
- ]
2332
- },
2333
- "2": {
2334
- "name": "punctuation.definition.identifier.swift"
2335
- },
2336
- "3": {
2337
- "name": "punctuation.definition.identifier.swift"
2338
- }
2339
- },
2340
- "patterns": [
2341
- {
2342
- "begin": "(?=<)",
2343
- "end": "(?!\\G)",
2344
- "patterns": [
2345
- {
2346
- "include": "#declarations-generic-argument-clause"
2347
- }
2348
- ]
2349
- }
2350
- ]
2351
- },
2352
- "declarations-type-operators": {
2353
- "patterns": [
2354
- {
2355
- "comment": "Swift 3: A & B",
2356
- "match": "(?<![/=\\-+!*%<>&|\\^~.])(&)(?![/=\\-+!*%<>&|\\^~.])",
2357
- "captures": {
2358
- "1": {
2359
- "name": "keyword.operator.type.composition.swift"
2360
- }
2361
- }
2362
- },
2363
- {
2364
- "comment": "SE-0390: Noncopyable structs and enums",
2365
- "match": "(?<![/=\\-+!*%<>&|\\^~.])(~)(?![/=\\-+!*%<>&|\\^~.])",
2366
- "captures": {
2367
- "1": {
2368
- "name": "keyword.operator.type.requirement-suppression.swift"
2369
- }
2370
- }
2371
- }
2372
- ]
2373
- },
2374
- "declarations-typealias": {
2375
- "name": "meta.definition.typealias.swift",
2376
- "begin": "\\b(typealias)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
2377
- "end": "(?!\\G)$|(?=;|//|/\\*|$)",
2378
- "beginCaptures": {
2379
- "1": {
2380
- "name": "keyword.other.declaration-specifier.swift"
2381
- },
2382
- "2": {
2383
- "name": "entity.name.type.typealias.swift"
2384
- },
2385
- "3": {
2386
- "name": "punctuation.definition.identifier.swift"
2387
- },
2388
- "4": {
2389
- "name": "punctuation.definition.identifier.swift"
2390
- }
2391
- },
2392
- "patterns": [
2393
- {
2394
- "begin": "\\G(?=<)",
2395
- "end": "(?!\\G)",
2396
- "patterns": [
2397
- {
2398
- "include": "#declarations-generic-parameter-clause"
2399
- }
2400
- ]
2401
- },
2402
- {
2403
- "include": "#declarations-typealias-assignment"
2404
- }
2405
- ]
2406
- },
2407
- "declarations-typealias-assignment": {
2408
- "begin": "(=)\\s*",
2409
- "end": "(?!\\G)$|(?=;|//|/\\*|$)",
2410
- "beginCaptures": {
2411
- "1": {
2412
- "name": "keyword.operator.assignment.swift"
2413
- }
2414
- },
2415
- "patterns": [
2416
- {
2417
- "include": "#declarations-available-types"
2418
- }
2419
- ]
2420
- },
2421
- "declarations-typed-variable-declaration": {
2422
- "begin": "(?x)\n\\b(?:(async)\\s+)?(let|var)\\b\\s+\n(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)\\s*\n:",
2423
- "end": "(?=$|[={])",
2424
- "beginCaptures": {
2425
- "1": {
2426
- "name": "storage.modifier.async.swift"
2427
- },
2428
- "2": {
2429
- "name": "keyword.other.declaration-specifier.swift"
2430
- }
2431
- },
2432
- "patterns": [
2433
- {
2434
- "include": "#declarations-available-types"
2435
- }
2436
- ]
2437
- },
2438
- "declarations-types-precedencegroup": {
2439
- "patterns": [
2440
- {
2441
- "comment": "Precedence groups in the standard library",
2442
- "name": "support.type.swift",
2443
- "match": "\\b(?:BitwiseShift|Assignment|RangeFormation|Casting|Addition|NilCoalescing|Comparison|LogicalConjunction|LogicalDisjunction|Default|Ternary|Multiplication|FunctionArrow)Precedence\\b"
2444
- }
2445
- ]
2446
- },
2447
- "expressions": {
2448
- "comment": "trailing closures need to be parsed before other member references",
2449
- "patterns": [
2450
- {
2451
- "include": "#expressions-without-trailing-closures-or-member-references"
2452
- },
2453
- {
2454
- "include": "#expressions-trailing-closure"
2455
- },
2456
- {
2457
- "include": "#member-reference"
2458
- }
2459
- ]
2460
- },
2461
- "expressions-trailing-closure": {
2462
- "patterns": [
2463
- {
2464
- "comment": "foo { body } -- a call with a trailing closure and no argument clause",
2465
- "name": "meta.function-call.trailing-closure-only.swift",
2466
- "match": "(#?(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))(?=\\s*\\{)",
2467
- "captures": {
2468
- "1": {
2469
- "name": "support.function.any-method.swift"
2470
- },
2471
- "2": {
2472
- "name": "punctuation.definition.identifier.swift"
2473
- },
2474
- "3": {
2475
- "name": "punctuation.definition.identifier.swift"
2476
- }
2477
- }
2478
- },
2479
- {
2480
- "comment": "foo: { body } -- labeled-trailing-closure (SE-0279)",
2481
- "match": "((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*(:)(?=\\s*\\{)",
2482
- "captures": {
2483
- "1": {
2484
- "name": "support.function.any-method.trailing-closure-label.swift"
2485
- },
2486
- "2": {
2487
- "name": "punctuation.definition.identifier.swift"
2488
- },
2489
- "3": {
2490
- "name": "punctuation.definition.identifier.swift"
2491
- },
2492
- "4": {
2493
- "name": "punctuation.separator.argument-label.swift"
2494
- }
2495
- }
2496
- }
2497
- ]
2498
- },
2499
- "expressions-without-trailing-closures": {
2500
- "patterns": [
2501
- {
2502
- "include": "#expressions-without-trailing-closures-or-member-references"
2503
- },
2504
- {
2505
- "include": "#member-references"
2506
- }
2507
- ]
2508
- },
2509
- "expressions-without-trailing-closures-or-member-references": {
2510
- "patterns": [
2511
- {
2512
- "include": "#comments"
2513
- },
2514
- {
2515
- "include": "#code-block"
2516
- },
2517
- {
2518
- "include": "#attributes"
2519
- },
2520
- {
2521
- "include": "#expressions-without-trailing-closures-or-member-references-closure-parameter"
2522
- },
2523
- {
2524
- "include": "#literals"
2525
- },
2526
- {
2527
- "include": "#operators"
2528
- },
2529
- {
2530
- "include": "#builtin-types"
2531
- },
2532
- {
2533
- "include": "#builtin-functions"
2534
- },
2535
- {
2536
- "include": "#builtin-global-functions"
2537
- },
2538
- {
2539
- "include": "#builtin-properties"
2540
- },
2541
- {
2542
- "include": "#expressions-without-trailing-closures-or-member-references-compound-name"
2543
- },
2544
- {
2545
- "include": "#conditionals"
2546
- },
2547
- {
2548
- "include": "#keywords"
2549
- },
2550
- {
2551
- "include": "#expressions-without-trailing-closures-or-member-references-availability-condition"
2552
- },
2553
- {
2554
- "include": "#expressions-without-trailing-closures-or-member-references-function-or-macro-call-expression"
2555
- },
2556
- {
2557
- "include": "#expressions-without-trailing-closures-or-member-references-macro-expansion"
2558
- },
2559
- {
2560
- "include": "#expressions-without-trailing-closures-or-member-references-subscript-expression"
2561
- },
2562
- {
2563
- "include": "#expressions-without-trailing-closures-or-member-references-parenthesized-expression"
2564
- },
2565
- {
2566
- "name": "support.variable.discard-value.swift",
2567
- "match": "\\b_\\b"
2568
- }
2569
- ]
2570
- },
2571
- "expressions-without-trailing-closures-or-member-references-availability-condition": {
2572
- "begin": "\\B(#(?:un)?available)(\\()",
2573
- "end": "\\)",
2574
- "beginCaptures": {
2575
- "1": {
2576
- "name": "support.function.availability-condition.swift"
2577
- },
2578
- "2": {
2579
- "name": "punctuation.definition.arguments.begin.swift"
2580
- }
2581
- },
2582
- "endCaptures": {
2583
- "0": {
2584
- "name": "punctuation.definition.arguments.end.swift"
2585
- }
2586
- },
2587
- "patterns": [
2588
- {
2589
- "match": "\\s*\\b((?:iOS|macOS|OSX|watchOS|tvOS|UIKitForMac)(?:ApplicationExtension)?)\\b(?:\\s+([0-9]+(?:\\.[0-9]+)*\\b))",
2590
- "captures": {
2591
- "1": {
2592
- "name": "keyword.other.platform.os.swift"
2593
- },
2594
- "2": {
2595
- "name": "constant.numeric.swift"
2596
- }
2597
- }
2598
- },
2599
- {
2600
- "match": "(\\*)\\s*(.*?)(?=[,)])",
2601
- "captures": {
2602
- "1": {
2603
- "name": "keyword.other.platform.all.swift"
2604
- },
2605
- "2": {
2606
- "name": "invalid.illegal.character-not-allowed-here.swift"
2607
- }
2608
- }
2609
- },
2610
- {
2611
- "name": "invalid.illegal.character-not-allowed-here.swift",
2612
- "match": "[^\\s,)]+"
2613
- }
2614
- ]
2615
- },
2616
- "expressions-without-trailing-closures-or-member-references-closure-parameter": {
2617
- "name": "variable.language.closure-parameter.swift",
2618
- "match": "\\$[0-9]+"
2619
- },
2620
- "expressions-without-trailing-closures-or-member-references-compound-name": {
2621
- "comment": "a reference to a function with disambiguating argument labels, such as foo(_:), foo(bar:), etc.",
2622
- "match": "(?x)\n((?<q1>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q1>)) # function name\n\\(\n (\n (\n ((?<q2>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q2>)) # argument label\n : # colon\n )+\n )\n\\)",
2623
- "captures": {
2624
- "1": {
2625
- "name": "entity.name.function.compound-name.swift"
2626
- },
2627
- "2": {
2628
- "name": "punctuation.definition.entity.swift"
2629
- },
2630
- "3": {
2631
- "name": "punctuation.definition.entity.swift"
2632
- },
2633
- "4": {
2634
- "patterns": [
2635
- {
2636
- "name": "entity.name.function.compound-name.swift",
2637
- "match": "(?<q>`?)(?!_:)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>):",
2638
- "captures": {
2639
- "1": {
2640
- "name": "punctuation.definition.entity.swift"
2641
- },
2642
- "2": {
2643
- "name": "punctuation.definition.entity.swift"
2644
- }
2645
- }
2646
- }
2647
- ]
2648
- }
2649
- }
2650
- },
2651
- "expressions-without-trailing-closures-or-member-references-expression-element-list": {
2652
- "patterns": [
2653
- {
2654
- "include": "#comments"
2655
- },
2656
- {
2657
- "comment": "an element with a label",
2658
- "begin": "((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*(:)",
2659
- "end": "(?=[,)\\]])",
2660
- "beginCaptures": {
2661
- "1": {
2662
- "name": "support.function.any-method.swift"
2663
- },
2664
- "2": {
2665
- "name": "punctuation.definition.identifier.swift"
2666
- },
2667
- "3": {
2668
- "name": "punctuation.definition.identifier.swift"
2669
- },
2670
- "4": {
2671
- "name": "punctuation.separator.argument-label.swift"
2672
- }
2673
- },
2674
- "patterns": [
2675
- {
2676
- "include": "#expressions"
2677
- }
2678
- ]
2679
- },
2680
- {
2681
- "comment": "an element without a label (i.e. anything else)",
2682
- "begin": "(?![,)\\]])(?=\\S)",
2683
- "end": "(?=[,)\\]])",
2684
- "patterns": [
2685
- {
2686
- "include": "#expressions"
2687
- }
2688
- ]
2689
- }
2690
- ]
2691
- },
2692
- "expressions-without-trailing-closures-or-member-references-function-or-macro-call-expression": {
2693
- "patterns": [
2694
- {
2695
- "comment": "foo(args) -- a call whose callee is a highlightable name",
2696
- "name": "meta.function-call.swift",
2697
- "begin": "(#?(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*(\\()",
2698
- "end": "\\)",
2699
- "beginCaptures": {
2700
- "1": {
2701
- "name": "support.function.any-method.swift"
2702
- },
2703
- "2": {
2704
- "name": "punctuation.definition.identifier.swift"
2705
- },
2706
- "3": {
2707
- "name": "punctuation.definition.identifier.swift"
2708
- },
2709
- "4": {
2710
- "name": "punctuation.definition.arguments.begin.swift"
2711
- }
2712
- },
2713
- "endCaptures": {
2714
- "0": {
2715
- "name": "punctuation.definition.arguments.end.swift"
2716
- }
2717
- },
2718
- "patterns": [
2719
- {
2720
- "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list"
2721
- }
2722
- ]
2723
- },
2724
- {
2725
- "comment": "[Int](args) -- a call whose callee is a more complicated expression",
2726
- "name": "meta.function-call.swift",
2727
- "begin": "(?<=[`\\])}>\\p{L}_\\p{N}\\p{M}])\\s*(\\()",
2728
- "end": "\\)",
2729
- "beginCaptures": {
2730
- "1": {
2731
- "name": "punctuation.definition.arguments.begin.swift"
2732
- }
2733
- },
2734
- "endCaptures": {
2735
- "0": {
2736
- "name": "punctuation.definition.arguments.end.swift"
2737
- }
2738
- },
2739
- "patterns": [
2740
- {
2741
- "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list"
2742
- }
2743
- ]
2744
- }
2745
- ]
2746
- },
2747
- "expressions-without-trailing-closures-or-member-references-macro-expansion": {
2748
- "name": "support.function.any-method.swift",
2749
- "match": "(#(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))"
2750
- },
2751
- "expressions-without-trailing-closures-or-member-references-parenthesized-expression": {
2752
- "comment": "correctly matching closure expressions is too hard (depends on trailing \"in\") so we just tack on some basics to the end of parenthesized-expression",
2753
- "begin": "\\(",
2754
- "end": "(\\))\\s*((?:\\b(?:async|throws|rethrows)\\s)*)",
2755
- "beginCaptures": {
2756
- "0": {
2757
- "name": "punctuation.section.tuple.begin.swift"
2758
- }
2759
- },
2760
- "endCaptures": {
2761
- "1": {
2762
- "name": "punctuation.section.tuple.end.swift"
2763
- },
2764
- "2": {
2765
- "patterns": [
2766
- {
2767
- "name": "invalid.illegal.rethrows-only-allowed-on-function-declarations.swift",
2768
- "match": "\\brethrows\\b"
2769
- },
2770
- {
2771
- "include": "#async-throws"
2772
- }
2773
- ]
2774
- }
2775
- },
2776
- "patterns": [
2777
- {
2778
- "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list"
2779
- }
2780
- ]
2781
- },
2782
- "expressions-without-trailing-closures-or-member-references-subscript-expression": {
2783
- "name": "meta.subscript-expression.swift",
2784
- "begin": "(?<=[`\\p{L}_\\p{N}\\p{M}])\\s*(\\[)",
2785
- "end": "\\]",
2786
- "beginCaptures": {
2787
- "1": {
2788
- "name": "punctuation.definition.arguments.begin.swift"
2789
- }
2790
- },
2791
- "endCaptures": {
2792
- "0": {
2793
- "name": "punctuation.definition.arguments.end.swift"
2794
- }
2795
- },
2796
- "patterns": [
2797
- {
2798
- "include": "#expressions-without-trailing-closures-or-member-references-expression-element-list"
2799
- }
2800
- ]
2801
- },
2802
- "keywords": {
2803
- "patterns": [
2804
- {
2805
- "name": "keyword.control.branch.swift",
2806
- "match": "(?<!\\.)\\b(?:if|else|guard|where|switch|case|default|fallthrough)\\b"
2807
- },
2808
- {
2809
- "name": "keyword.control.transfer.swift",
2810
- "match": "(?<!\\.)\\b(?:continue|break|fallthrough|return)\\b"
2811
- },
2812
- {
2813
- "name": "keyword.control.loop.swift",
2814
- "match": "(?<!\\.)\\b(?:while|for|in|each)\\b"
2815
- },
2816
- {
2817
- "name": "keyword.other.operator.type.existential.swift",
2818
- "match": "\\bany\\b(?=\\s*`?[\\p{L}_])"
2819
- },
2820
- {
2821
- "comment": "extra scopes for repeat-while snippet",
2822
- "match": "(?<!\\.)\\b(repeat)\\b(\\s*)",
2823
- "captures": {
2824
- "1": {
2825
- "name": "keyword.control.loop.swift"
2826
- },
2827
- "2": {
2828
- "name": "punctuation.whitespace.trailing.repeat.swift"
2829
- }
2830
- }
2831
- },
2832
- {
2833
- "name": "keyword.control.defer.swift",
2834
- "match": "(?<!\\.)\\bdefer\\b"
2835
- },
2836
- {
2837
- "match": "(?<!\\.)\\b(?:(await\\s+try)|(await)\\b)",
2838
- "captures": {
2839
- "1": {
2840
- "name": "invalid.illegal.try-must-precede-await.swift"
2841
- },
2842
- "2": {
2843
- "name": "keyword.control.await.swift"
2844
- }
2845
- }
2846
- },
2847
- {
2848
- "name": "keyword.control.exception.swift",
2849
- "match": "(?<!\\.)\\b(?:catch|throw|try)\\b|\\btry[?!]\\B"
2850
- },
2851
- {
2852
- "name": "storage.modifier.exception.swift",
2853
- "match": "(?<!\\.)\\b(?:throws|rethrows)\\b"
2854
- },
2855
- {
2856
- "comment": "extra scopes for do-catch snippet",
2857
- "match": "(?<!\\.)\\b(do)\\b(\\s*)",
2858
- "captures": {
2859
- "1": {
2860
- "name": "keyword.control.exception.swift"
2861
- },
2862
- "2": {
2863
- "name": "punctuation.whitespace.trailing.do.swift"
2864
- }
2865
- }
2866
- },
2867
- {
2868
- "match": "(?<!\\.)\\b(?:(async)\\s+)?(let|var)\\b",
2869
- "captures": {
2870
- "1": {
2871
- "name": "storage.modifier.async.swift"
2872
- },
2873
- "2": {
2874
- "name": "keyword.other.declaration-specifier.swift"
2875
- }
2876
- }
2877
- },
2878
- {
2879
- "name": "keyword.other.declaration-specifier.swift",
2880
- "match": "(?<!\\.)\\b(?:associatedtype|operator|typealias)\\b"
2881
- },
2882
- {
2883
- "name": "storage.type.$1.swift",
2884
- "match": "(?<!\\.)\\b(class|enum|extension|precedencegroup|protocol|struct|actor)\\b(?=\\s*`?[\\p{L}_])"
2885
- },
2886
- {
2887
- "name": "storage.modifier.swift",
2888
- "match": "(?<!\\.)\\b(?:inout|static|final|lazy|mutating|nonmutating|optional|indirect|required|override|dynamic|convenience|infix|prefix|postfix|distributed|nonisolated|borrowing|consuming)\\b"
2889
- },
2890
- {
2891
- "name": "storage.type.function.swift",
2892
- "match": "\\binit[?!]|\\binit\\b|(?<!\\.)\\b(?:func|deinit|subscript|didSet|get|set|willSet)\\b"
2893
- },
2894
- {
2895
- "name": "keyword.other.declaration-specifier.accessibility.swift",
2896
- "match": "(?<!\\.)\\b(?:fileprivate|private|internal|public|open|package)\\b"
2897
- },
2898
- {
2899
- "comment": "matches weak, unowned, unowned(safe), unowned(unsafe)",
2900
- "name": "keyword.other.capture-specifier.swift",
2901
- "match": "(?<!\\.)\\bunowned\\((?:safe|unsafe)\\)|(?<!\\.)\\b(?:weak|unowned)\\b"
2902
- },
2903
- {
2904
- "match": "(?<=\\.)(?:(dynamicType|self)|(Protocol|Type))\\b",
2905
- "captures": {
2906
- "1": {
2907
- "name": "keyword.other.type.swift"
2908
- },
2909
- "2": {
2910
- "name": "keyword.other.type.metatype.swift"
2911
- }
2912
- }
2913
- },
2914
- {
2915
- "name": "variable.language.swift",
2916
- "match": "(?<!\\.)\\b(?:super|self|Self)\\b"
2917
- },
2918
- {
2919
- "name": "support.variable.swift",
2920
- "match": "\\B(?:#file|#filePath|#fileID|#line|#column|#function|#dsohandle)\\b|\\b(?:__FILE__|__LINE__|__COLUMN__|__FUNCTION__|__DSO_HANDLE__)\\b"
2921
- },
2922
- {
2923
- "name": "keyword.control.import.swift",
2924
- "match": "(?<!\\.)\\bimport\\b"
2925
- },
2926
- {
2927
- "comment": "SE-0366: \"consume behaves as a contextual keyword. In order to avoid interfering with existing code that calls functions named consume, the operand to consume must begin with another identifier, and must consist of an identifier or postfix expression\"",
2928
- "name": "keyword.control.consume.swift",
2929
- "match": "(?<!\\.)\\bconsume(?=\\s+`?[\\p{L}_])"
2930
- },
2931
- {
2932
- "comment": "SE-0377: \"copy is a contextual keyword, parsed as an operator if it is immediately followed by an identifier on the same line, like the consume x operator before it\"",
2933
- "name": "keyword.control.copy.swift",
2934
- "match": "(?<!\\.)\\bcopy(?=\\s+`?[\\p{L}_])"
2935
- }
2936
- ]
2937
- },
2938
- "literals": {
2939
- "patterns": [
2940
- {
2941
- "include": "#literals-boolean"
2942
- },
2943
- {
2944
- "include": "#literals-numeric"
2945
- },
2946
- {
2947
- "include": "#literals-string"
2948
- },
2949
- {
2950
- "name": "constant.language.nil.swift",
2951
- "match": "\\bnil\\b"
2952
- },
2953
- {
2954
- "comment": "object \"literals\" used in playgrounds",
2955
- "name": "support.function.object-literal.swift",
2956
- "match": "\\B#(colorLiteral|imageLiteral|fileLiteral)\\b"
2957
- },
2958
- {
2959
- "name": "support.function.builtin-macro.swift",
2960
- "match": "\\B#externalMacro\\b"
2961
- },
2962
- {
2963
- "name": "support.function.key-path.swift",
2964
- "match": "\\B#keyPath\\b"
2965
- },
2966
- {
2967
- "begin": "\\B(#selector)(\\()(?:\\s*(getter|setter)\\s*(:))?",
2968
- "end": "\\)",
2969
- "beginCaptures": {
2970
- "1": {
2971
- "name": "support.function.selector-reference.swift"
2972
- },
2973
- "2": {
2974
- "name": "punctuation.definition.arguments.begin.swift"
2975
- },
2976
- "3": {
2977
- "name": "support.variable.parameter.swift"
2978
- },
2979
- "4": {
2980
- "name": "punctuation.separator.argument-label.swift"
2981
- }
2982
- },
2983
- "endCaptures": {
2984
- "0": {
2985
- "name": "punctuation.definition.arguments.end.swift"
2986
- }
2987
- },
2988
- "patterns": [
2989
- {
2990
- "include": "#expressions"
2991
- }
2992
- ]
2993
- },
2994
- {
2995
- "include": "#literals-regular-expression-literal"
2996
- }
2997
- ]
2998
- },
2999
- "literals-boolean": {
3000
- "name": "constant.language.boolean.swift",
3001
- "match": "\\b(true|false)\\b"
3002
- },
3003
- "literals-numeric": {
3004
- "patterns": [
3005
- {
3006
- "comment": "0.1, -4_2.5, 6.022e23, 10E-5",
3007
- "name": "constant.numeric.float.decimal.swift",
3008
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)[0-9][0-9_]*(?=\\.[0-9]|[eE])(?:\\.[0-9][0-9_]*)?(?:[eE][-+]?[0-9][0-9_]*)?\\b(?!\\.[0-9])"
3009
- },
3010
- {
3011
- "comment": "-0x1.ap2_3, 0x31p-4",
3012
- "name": "constant.numeric.float.hexadecimal.swift",
3013
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)(0x[0-9a-fA-F][0-9a-fA-F_]*)(?:\\.[0-9a-fA-F][0-9a-fA-F_]*)?[pP][-+]?[0-9][0-9_]*\\b(?!\\.[0-9])"
3014
- },
3015
- {
3016
- "comment": "0x1p, 0x1p_2, 0x1.5pa, 0x1.1p+1f, 0x1pz",
3017
- "name": "invalid.illegal.numeric.float.invalid-exponent.swift",
3018
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)(0x[0-9a-fA-F][0-9a-fA-F_]*)(?:\\.[0-9a-fA-F][0-9a-fA-F_]*)?(?:[pP][-+]?\\w*)\\b(?!\\.[0-9])"
3019
- },
3020
- {
3021
- "comment": "0x1.5w (note that 0x1.f may be a valid expression)",
3022
- "name": "invalid.illegal.numeric.float.missing-exponent.swift",
3023
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)(0x[0-9a-fA-F][0-9a-fA-F_]*)\\.[0-9][\\w.]*"
3024
- },
3025
- {
3026
- "comment": "-.5, .2f (note that 1.-.5 may be a valid expression)",
3027
- "name": "invalid.illegal.numeric.float.missing-leading-zero.swift",
3028
- "match": "(?<=\\s|^)\\-?\\.[0-9][\\w.]*"
3029
- },
3030
- {
3031
- "comment": "0b_0_1, 0x_1p+3q",
3032
- "name": "invalid.illegal.numeric.leading-underscore.swift",
3033
- "match": "(\\B\\-|\\b)0[box]_[0-9a-fA-F_]*(?:[pPeE][+-]?\\w+)?[\\w.]+"
3034
- },
3035
- {
3036
- "comment": "tuple positional member: not really a numeric literal, but not invalid",
3037
- "match": "(?<=[\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)[0-9]+\\b"
3038
- },
3039
- {
3040
- "comment": "0b010, 0b1_0",
3041
- "name": "constant.numeric.integer.binary.swift",
3042
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)0b[01][01_]*\\b(?!\\.[0-9])"
3043
- },
3044
- {
3045
- "comment": "0o1, 0o7_3",
3046
- "name": "constant.numeric.integer.octal.swift",
3047
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)0o[0-7][0-7_]*\\b(?!\\.[0-9])"
3048
- },
3049
- {
3050
- "comment": "02, 3_456",
3051
- "name": "constant.numeric.integer.decimal.swift",
3052
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)[0-9][0-9_]*\\b(?!\\.[0-9])"
3053
- },
3054
- {
3055
- "comment": "0x4, 0xF_7",
3056
- "name": "constant.numeric.integer.hexadecimal.swift",
3057
- "match": "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)0x[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\.[0-9])"
3058
- },
3059
- {
3060
- "name": "invalid.illegal.numeric.other.swift",
3061
- "match": "(\\B\\-|\\b)[0-9][\\w.]*"
3062
- }
3063
- ]
3064
- },
3065
- "literals-regular-expression-literal": {
3066
- "comment": "SE-0354 & SE-0355",
3067
- "patterns": [
3068
- {
3069
- "name": "string.regexp.block.swift",
3070
- "begin": "(#+)/\\n",
3071
- "end": "/\\1",
3072
- "patterns": [
3073
- {
3074
- "include": "#literals-regular-expression-literal-regex-guts"
3075
- },
3076
- {
3077
- "include": "#literals-regular-expression-literal-line-comment"
3078
- }
3079
- ]
3080
- },
3081
- {
3082
- "comment": "Single-line regular expression literals must be matched all in one go\n in order to avoid ambiguities with operators, and to adhere to certain\n parsing rules in SE-0354/SE-0355, such as:\n - A regex literal will not be parsed if it contains an unbalanced ).\n - A regex may end with a space only if it began with an escaped space",
3083
- "name": "string.regexp.line.swift",
3084
- "match": "(?x)\n(((\\#+)?)/) # (1) for captures, (2) for matching end, (3) for conditionals\n(?(3)|(?!/)) # is not a comment\n(?(3)|(?!\\s)) # does not start with a space or tab\n(\\\\\\s)? # (4) may start with an escaped space or tab\n(?<guts>\n (?> # no backtracking, avoids issues with negative lookbehind at end\n (?:\n \\\\Q\n (?:(?!\\\\E)(?!/\\2).)*+\n (?:\\\\E\n # A quoted sequence may not have a closing E, in which case it extends to the end of the regex\n | (?(3)|(?<!\\s))(?=/\\2)\n )\n | \\\\.\n | \\(\\?\\#[^)]*\\)\n | \\(\\?\n # we only support a fixed maximum number of braces because otherwise we can't balance the number of open and close braces\n \\{(?<g1>\\{)?+(?<g2>\\{)?+(?<g3>\\{)?+(?<g4>\\{)?+(?<g5>\\{)?+\n .+?\n \\}(?(<g1>)\\})(?(<g2>)\\})(?(<g3>)\\})(?(<g4>)\\})(?(<g5>)\\})\n (?:\\[(?!\\d)\\w+\\])?\n [X<>]?\n \\)\n | (?<class>\\[ (?:\\\\. | [^\\[\\]] | \\g<class>)+ \\])\n | \\(\\g<guts>?+\\)\n | (?:(?!/\\2)[^()\\[\\\\])+ # any character (until end)\n )+\n )\n)?+\n# may end with a space only if it is an extended literal or contains only a single escaped space\n(?(3)|(?(5)(?<!\\s)))\n(/\\2) # (12)\n| \\#+/.+(\\n)",
3085
- "captures": {
3086
- "0": {
3087
- "patterns": [
3088
- {
3089
- "include": "#literals-regular-expression-literal-regex-guts"
3090
- }
3091
- ]
3092
- },
3093
- "1": {
3094
- "name": "punctuation.definition.string.begin.regexp.swift"
3095
- },
3096
- "12": {
3097
- "name": "punctuation.definition.string.end.regexp.swift"
3098
- },
3099
- "13": {
3100
- "name": "invalid.illegal.returns-not-allowed.regexp"
3101
- }
3102
- }
3103
- }
3104
- ]
3105
- },
3106
- "literals-regular-expression-literal-backreference-or-subpattern": {
3107
- "comment": "These patterns are separated to work around issues like https://github.com/microsoft/vscode-textmate/issues/164",
3108
- "patterns": [
3109
- {
3110
- "comment": "'\\g{' NamedOrNumberRef '}'",
3111
- "match": "(?x)(\\\\g\\{) (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) (\\})",
3112
- "captures": {
3113
- "1": {
3114
- "name": "constant.character.escape.backslash.regexp"
3115
- },
3116
- "2": {
3117
- "name": "variable.other.group-name.regexp"
3118
- },
3119
- "3": {
3120
- "name": "keyword.operator.recursion-level.regexp"
3121
- },
3122
- "4": {
3123
- "name": "constant.numeric.integer.decimal.regexp"
3124
- },
3125
- "5": {
3126
- "name": "constant.numeric.integer.decimal.regexp"
3127
- },
3128
- "6": {
3129
- "name": "keyword.operator.recursion-level.regexp"
3130
- },
3131
- "7": {
3132
- "name": "constant.numeric.integer.decimal.regexp"
3133
- },
3134
- "8": {
3135
- "name": "constant.character.escape.backslash.regexp"
3136
- }
3137
- }
3138
- },
3139
- {
3140
- "comment": "'\\g' NumberRef",
3141
- "match": "(?x)(\\\\g) ([+-]?\\d+) (?:([+-])(\\d+))?",
3142
- "captures": {
3143
- "1": {
3144
- "name": "constant.character.escape.backslash.regexp"
3145
- },
3146
- "2": {
3147
- "name": "constant.numeric.integer.decimal.regexp"
3148
- },
3149
- "3": {
3150
- "name": "keyword.operator.recursion-level.regexp"
3151
- },
3152
- "4": {
3153
- "name": "constant.numeric.integer.decimal.regexp"
3154
- }
3155
- }
3156
- },
3157
- {
3158
- "comment": "'\\k<' NamedOrNumberRef '>'\n \"\\k'\" NamedOrNumberRef \"'\"\n '\\g<' NamedOrNumberRef '>'\n \"\\g'\" NamedOrNumberRef \"'\"",
3159
- "match": "(?x)(\\\\[gk](<)|\\\\[gk]') (?: ((?!\\d)\\w+) (?:([+-])(\\d+))? | ([+-]?\\d+) (?:([+-])(\\d+))? ) ((?(2)>|'))",
3160
- "captures": {
3161
- "1": {
3162
- "name": "constant.character.escape.backslash.regexp"
3163
- },
3164
- "3": {
3165
- "name": "variable.other.group-name.regexp"
3166
- },
3167
- "4": {
3168
- "name": "keyword.operator.recursion-level.regexp"
3169
- },
3170
- "5": {
3171
- "name": "constant.numeric.integer.decimal.regexp"
3172
- },
3173
- "6": {
3174
- "name": "constant.numeric.integer.decimal.regexp"
3175
- },
3176
- "7": {
3177
- "name": "keyword.operator.recursion-level.regexp"
3178
- },
3179
- "8": {
3180
- "name": "constant.numeric.integer.decimal.regexp"
3181
- },
3182
- "9": {
3183
- "name": "constant.character.escape.backslash.regexp"
3184
- }
3185
- }
3186
- },
3187
- {
3188
- "comment": "'\\k{' NamedRef '}'",
3189
- "match": "(?x)(\\\\k\\{) ((?!\\d)\\w+) (?:([+-])(\\d+))? (\\})",
3190
- "captures": {
3191
- "1": {
3192
- "name": "constant.character.escape.backslash.regexp"
3193
- },
3194
- "2": {
3195
- "name": "variable.other.group-name.regexp"
3196
- },
3197
- "3": {
3198
- "name": "keyword.operator.recursion-level.regexp"
3199
- },
3200
- "4": {
3201
- "name": "constant.numeric.integer.decimal.regexp"
3202
- },
3203
- "5": {
3204
- "name": "constant.character.escape.backslash.regexp"
3205
- }
3206
- }
3207
- },
3208
- {
3209
- "name": "keyword.other.back-reference.regexp",
3210
- "match": "\\\\[1-9][0-9]+"
3211
- },
3212
- {
3213
- "comment": "'(?P=' NamedRef ')'",
3214
- "match": "(?x)(\\(\\?(?:P[=>]|&)) ((?!\\d)\\w+) (?:([+-])(\\d+))? (\\))",
3215
- "captures": {
3216
- "1": {
3217
- "name": "keyword.other.back-reference.regexp"
3218
- },
3219
- "2": {
3220
- "name": "variable.other.group-name.regexp"
3221
- },
3222
- "3": {
3223
- "name": "keyword.operator.recursion-level.regexp"
3224
- },
3225
- "4": {
3226
- "name": "constant.numeric.integer.decimal.regexp"
3227
- },
3228
- "5": {
3229
- "name": "keyword.other.back-reference.regexp"
3230
- }
3231
- }
3232
- },
3233
- {
3234
- "name": "keyword.other.back-reference.regexp",
3235
- "match": "\\(\\?R\\)"
3236
- },
3237
- {
3238
- "comment": "'(?' NumberRef ')'",
3239
- "match": "(?x)(\\(\\?) ([+-]?\\d+) (?:([+-])(\\d+))? (\\))",
3240
- "captures": {
3241
- "1": {
3242
- "name": "keyword.other.back-reference.regexp"
3243
- },
3244
- "2": {
3245
- "name": "constant.numeric.integer.decimal.regexp"
3246
- },
3247
- "3": {
3248
- "name": "keyword.operator.recursion-level.regexp"
3249
- },
3250
- "4": {
3251
- "name": "constant.numeric.integer.decimal.regexp"
3252
- },
3253
- "5": {
3254
- "name": "keyword.other.back-reference.regexp"
3255
- }
3256
- }
3257
- }
3258
- ]
3259
- },
3260
- "literals-regular-expression-literal-backtracking-directive-or-global-matching-option": {
3261
- "match": "(?x)\n(\\(\\*)\n(?:\n (ACCEPT|FAIL|F|MARK(?=:)|(?=:)|COMMIT|PRUNE|SKIP|THEN)\n (?:(:)([^)]+))?\n | (?:(LIMIT_(?:DEPTH|HEAP|MATCH))(=)(\\d+))\n | (\n CRLF | CR | ANYCRLF | ANY | LF | NUL\n | BSR_ANYCRLF | BSR_UNICODE\n | NOTEMPTY_ATSTART | NOTEMPTY\n | NO_AUTO_POSSESS | NO_DOTSTAR_ANCHOR\n | NO_JIT | NO_START_OPT | UTF | UCP\n )\n)\n(\\))",
3262
- "captures": {
3263
- "1": {
3264
- "name": "keyword.control.directive.regexp"
3265
- },
3266
- "2": {
3267
- "name": "keyword.control.directive.regexp"
3268
- },
3269
- "3": {
3270
- "name": "keyword.control.directive.regexp"
3271
- },
3272
- "4": {
3273
- "name": "variable.language.tag.regexp"
3274
- },
3275
- "5": {
3276
- "name": "keyword.control.directive.regexp"
3277
- },
3278
- "6": {
3279
- "name": "keyword.operator.assignment.regexp"
3280
- },
3281
- "7": {
3282
- "name": "constant.numeric.integer.decimal.regexp"
3283
- },
3284
- "8": {
3285
- "name": "keyword.control.directive.regexp"
3286
- },
3287
- "9": {
3288
- "name": "keyword.control.directive.regexp"
3289
- }
3290
- }
3291
- },
3292
- "literals-regular-expression-literal-callout": {
3293
- "name": "meta.callout.regexp",
3294
- "match": "(?x)\n# PCRECallout\n(\\()(?<keyw>\\?C)\n (?:\n (?<num>\\d+)\n | `(?<name>(?:[^`]|``)*)`\n | '(?<name>(?:[^']|'')*)'\n | \"(?<name>(?:[^\"]|\"\")*)\"\n | \\^(?<name>(?:[^\\^]|\\^\\^)*)\\^\n | %(?<name>(?:[^%]|%%)*)%\n | \\#(?<name>(?:[^#]|\\#\\#)*)\\#\n | \\$(?<name>(?:[^$]|\\$\\$)*)\\$\n | \\{(?<name>(?:[^}]|\\}\\})*)\\}\n )?\n(\\))\n# NamedCallout\n| (\\()(?<keyw>\\*)\n (?<name>(?!\\d)\\w+)\n (?:\\[(?<tag>(?!\\d)\\w+)\\])?\n (?:\\{ [^,}]+ (?:,[^,}]+)* \\})?\n (\\))\n# InterpolatedCallout\n| (\\()(?<keyw>\\?)\n # we only support a fixed maximum number of braces because otherwise we can't balance the number of open and close braces\n (\\{(?<g1>\\{)?+(?<g2>\\{)?+(?<g3>\\{)?+(?<g4>\\{)?+(?<g5>\\{)?+) .+? \\}(?(<g1>)\\})(?(<g2>)\\})(?(<g3>)\\})(?(<g4>)\\})(?(<g5>)\\})\n (?:\\[(?<tag>(?!\\d)\\w+)\\])?\n (?<keyw>[X<>]?)\n (\\))",
3295
- "captures": {
3296
- "1": {
3297
- "name": "punctuation.definition.group.regexp"
3298
- },
3299
- "2": {
3300
- "name": "keyword.control.callout.regexp"
3301
- },
3302
- "3": {
3303
- "name": "constant.numeric.integer.decimal.regexp"
3304
- },
3305
- "4": {
3306
- "name": "entity.name.function.callout.regexp"
3307
- },
3308
- "5": {
3309
- "name": "entity.name.function.callout.regexp"
3310
- },
3311
- "6": {
3312
- "name": "entity.name.function.callout.regexp"
3313
- },
3314
- "7": {
3315
- "name": "entity.name.function.callout.regexp"
3316
- },
3317
- "8": {
3318
- "name": "entity.name.function.callout.regexp"
3319
- },
3320
- "9": {
3321
- "name": "entity.name.function.callout.regexp"
3322
- },
3323
- "10": {
3324
- "name": "entity.name.function.callout.regexp"
3325
- },
3326
- "11": {
3327
- "name": "entity.name.function.callout.regexp"
3328
- },
3329
- "12": {
3330
- "name": "punctuation.definition.group.regexp"
3331
- },
3332
- "13": {
3333
- "name": "punctuation.definition.group.regexp"
3334
- },
3335
- "14": {
3336
- "name": "keyword.control.callout.regexp"
3337
- },
3338
- "15": {
3339
- "name": "entity.name.function.callout.regexp"
3340
- },
3341
- "16": {
3342
- "name": "variable.language.tag-name.regexp"
3343
- },
3344
- "17": {
3345
- "name": "punctuation.definition.group.regexp"
3346
- },
3347
- "18": {
3348
- "name": "punctuation.definition.group.regexp"
3349
- },
3350
- "19": {
3351
- "name": "keyword.control.callout.regexp"
3352
- },
3353
- "26": {
3354
- "name": "variable.language.tag-name.regexp"
3355
- },
3356
- "27": {
3357
- "name": "keyword.control.callout.regexp"
3358
- },
3359
- "28": {
3360
- "name": "punctuation.definition.group.regexp"
3361
- }
3362
- }
3363
- },
3364
- "literals-regular-expression-literal-character-properties": {
3365
- "name": "constant.other.character-class.set.regexp",
3366
- "match": "(?x)\n\\\\[pP]\\{ ([\\s\\w-]+(?:=[\\s\\w-]+)?) \\}\n| (\\[:) ([\\s\\w-]+(?:=[\\s\\w-]+)?) (:\\])",
3367
- "captures": {
3368
- "1": {
3369
- "name": "support.variable.character-property.regexp"
3370
- },
3371
- "2": {
3372
- "name": "punctuation.definition.character-class.regexp"
3373
- },
3374
- "3": {
3375
- "name": "support.variable.character-property.regexp"
3376
- },
3377
- "4": {
3378
- "name": "punctuation.definition.character-class.regexp"
3379
- }
3380
- }
3381
- },
3382
- "literals-regular-expression-literal-custom-char-class": {
3383
- "patterns": [
3384
- {
3385
- "name": "constant.other.character-class.set.regexp",
3386
- "begin": "(\\[)(\\^)?",
3387
- "end": "\\]",
3388
- "beginCaptures": {
3389
- "1": {
3390
- "name": "punctuation.definition.character-class.regexp"
3391
- },
3392
- "2": {
3393
- "name": "keyword.operator.negation.regexp"
3394
- }
3395
- },
3396
- "endCaptures": {
3397
- "0": {
3398
- "name": "punctuation.definition.character-class.regexp"
3399
- }
3400
- },
3401
- "patterns": [
3402
- {
3403
- "include": "#literals-regular-expression-literal-custom-char-class-members"
3404
- }
3405
- ]
3406
- }
3407
- ]
3408
- },
3409
- "literals-regular-expression-literal-custom-char-class-members": {
3410
- "comment": "TODO: should also include atoms?",
3411
- "patterns": [
3412
- {
3413
- "comment": "\\b inside a character class represents a backspace",
3414
- "name": "constant.character.escape.backslash.regexp",
3415
- "match": "\\\\b"
3416
- },
3417
- {
3418
- "include": "#literals-regular-expression-literal-custom-char-class"
3419
- },
3420
- {
3421
- "include": "#literals-regular-expression-literal-quote"
3422
- },
3423
- {
3424
- "include": "#literals-regular-expression-literal-set-operators"
3425
- },
3426
- {
3427
- "include": "#literals-regular-expression-literal-unicode-scalars"
3428
- },
3429
- {
3430
- "include": "#literals-regular-expression-literal-character-properties"
3431
- }
3432
- ]
3433
- },
3434
- "literals-regular-expression-literal-group-option-toggle": {
3435
- "comment": "A matching option sequence may be part of an \"isolated group\" which has an implicit scope that wraps the remaining elements of the current group",
3436
- "name": "keyword.other.option-toggle.regexp",
3437
- "match": "(?x)\n\\(\\?\n(?:\n \\^(?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})+\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})* - (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n)\n\\)"
3438
- },
3439
- "literals-regular-expression-literal-group-or-conditional": {
3440
- "patterns": [
3441
- {
3442
- "name": "meta.group.absent.regexp",
3443
- "begin": "(\\()(\\?~)",
3444
- "end": "\\)",
3445
- "beginCaptures": {
3446
- "1": {
3447
- "name": "punctuation.definition.group.regexp"
3448
- },
3449
- "2": {
3450
- "name": "keyword.control.conditional.absent.regexp"
3451
- }
3452
- },
3453
- "endCaptures": {
3454
- "0": {
3455
- "name": "punctuation.definition.group.regexp"
3456
- }
3457
- },
3458
- "patterns": [
3459
- {
3460
- "include": "#literals-regular-expression-literal-regex-guts"
3461
- }
3462
- ]
3463
- },
3464
- {
3465
- "name": "meta.group.conditional.regexp",
3466
- "begin": "(?x)\n# KnownConditionalStart\n(\\() (?<cond>\\?\\()\n (?:\n (?<NumberRef> (?<num>[+-]?\\d+)(?:(?<op>[+-])(?<num>\\d+))? )\n | (?<cond>R) \\g<NumberRef>?\n | (?<cond>R&) (?<NamedRef> (?<name>(?!\\d)\\w+) (?:(?<op>[+-])(?<num>\\d+))? )\n | (?<cond><) (?:\\g<NamedRef>|\\g<NumberRef>) (?<cond>>)\n | (?<cond>') (?:\\g<NamedRef>|\\g<NumberRef>) (?<cond>')\n | (?<cond>DEFINE)\n | (?<cond>VERSION)(?<compar>>?=)(?<num>\\d+\\.\\d+)\n )\n(?<cond>\\))\n| (\\()(?<cond>\\?)(?=\\()",
3467
- "end": "\\)",
3468
- "beginCaptures": {
3469
- "1": {
3470
- "name": "punctuation.definition.group.regexp"
3471
- },
3472
- "2": {
3473
- "name": "keyword.control.conditional.regexp"
3474
- },
3475
- "4": {
3476
- "name": "constant.numeric.integer.decimal.regexp"
3477
- },
3478
- "5": {
3479
- "name": "keyword.operator.recursion-level.regexp"
3480
- },
3481
- "6": {
3482
- "name": "constant.numeric.integer.decimal.regexp"
3483
- },
3484
- "7": {
3485
- "name": "keyword.control.conditional.regexp"
3486
- },
3487
- "8": {
3488
- "name": "keyword.control.conditional.regexp"
3489
- },
3490
- "10": {
3491
- "name": "variable.other.group-name.regexp"
3492
- },
3493
- "11": {
3494
- "name": "keyword.operator.recursion-level.regexp"
3495
- },
3496
- "12": {
3497
- "name": "constant.numeric.integer.decimal.regexp"
3498
- },
3499
- "13": {
3500
- "name": "keyword.control.conditional.regexp"
3501
- },
3502
- "14": {
3503
- "name": "keyword.control.conditional.regexp"
3504
- },
3505
- "15": {
3506
- "name": "keyword.control.conditional.regexp"
3507
- },
3508
- "16": {
3509
- "name": "keyword.control.conditional.regexp"
3510
- },
3511
- "17": {
3512
- "name": "keyword.control.conditional.regexp"
3513
- },
3514
- "18": {
3515
- "name": "keyword.control.conditional.regexp"
3516
- },
3517
- "19": {
3518
- "name": "keyword.operator.comparison.regexp"
3519
- },
3520
- "20": {
3521
- "name": "constant.numeric.integer.decimal.regexp"
3522
- },
3523
- "21": {
3524
- "name": "keyword.control.conditional.regexp"
3525
- },
3526
- "22": {
3527
- "name": "punctuation.definition.group.regexp"
3528
- },
3529
- "23": {
3530
- "name": "keyword.control.conditional.regexp"
3531
- }
3532
- },
3533
- "endCaptures": {
3534
- "0": {
3535
- "name": "punctuation.definition.group.regexp"
3536
- }
3537
- },
3538
- "patterns": [
3539
- {
3540
- "include": "#literals-regular-expression-literal-regex-guts"
3541
- }
3542
- ]
3543
- },
3544
- {
3545
- "name": "meta.group.regexp",
3546
- "begin": "(?x)\n(\\()\n(\n # BasicGroupKind\n (\\?)\n (?:\n ([:|>=!*] | <[=!*])\n # named groups\n | P?< (?:((?!\\d)\\w+) (-))? ((?!\\d)\\w+) >\n | ' (?:((?!\\d)\\w+) (-))? ((?!\\d)\\w+) '\n # matching options\n | (?:\n \\^(?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})+\n | (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})* - (?:[iJmnsUxwDPSW]|xx|y\\{[gw]\\})*\n ): # case without : is handled by group-option-toggle\n )\n # PCRE2GroupKind\n | \\*(\n atomic\n |pla|positive_lookahead\n |nla|negative_lookahead\n |plb|positive_lookbehind\n |nlb|negative_lookbehind\n |napla|non_atomic_positive_lookahead\n |naplb|non_atomic_positive_lookbehind\n |sr|script_run\n |asr|atomic_script_run\n ):\n)?+",
3547
- "end": "\\)",
3548
- "beginCaptures": {
3549
- "1": {
3550
- "name": "punctuation.definition.group.regexp"
3551
- },
3552
- "2": {
3553
- "name": "keyword.other.group-options.regexp"
3554
- },
3555
- "3": {
3556
- "name": "punctuation.definition.group.regexp"
3557
- },
3558
- "4": {
3559
- "name": "punctuation.definition.group.regexp"
3560
- },
3561
- "5": {
3562
- "name": "variable.other.group-name.regexp"
3563
- },
3564
- "6": {
3565
- "name": "keyword.operator.balancing-group.regexp"
3566
- },
3567
- "7": {
3568
- "name": "variable.other.group-name.regexp"
3569
- },
3570
- "8": {
3571
- "name": "variable.other.group-name.regexp"
3572
- },
3573
- "9": {
3574
- "name": "keyword.operator.balancing-group.regexp"
3575
- },
3576
- "10": {
3577
- "name": "variable.other.group-name.regexp"
3578
- }
3579
- },
3580
- "endCaptures": {
3581
- "0": {
3582
- "name": "punctuation.definition.group.regexp"
3583
- }
3584
- },
3585
- "patterns": [
3586
- {
3587
- "include": "#literals-regular-expression-literal-regex-guts"
3588
- }
3589
- ]
3590
- }
3591
- ]
3592
- },
3593
- "literals-regular-expression-literal-line-comment": {
3594
- "name": "comment.line.regexp",
3595
- "match": "(\\#).*$",
3596
- "captures": {
3597
- "1": {
3598
- "name": "punctuation.definition.comment.regexp"
3599
- }
3600
- }
3601
- },
3602
- "literals-regular-expression-literal-quote": {
3603
- "name": "string.quoted.other.regexp.swift",
3604
- "begin": "\\\\Q",
3605
- "end": "\\\\E|(\\n)",
3606
- "beginCaptures": {
3607
- "0": {
3608
- "name": "constant.character.escape.backslash.regexp"
3609
- }
3610
- },
3611
- "endCaptures": {
3612
- "0": {
3613
- "name": "constant.character.escape.backslash.regexp"
3614
- },
3615
- "1": {
3616
- "name": "invalid.illegal.returns-not-allowed.regexp"
3617
- }
3618
- }
3619
- },
3620
- "literals-regular-expression-literal-regex-guts": {
3621
- "patterns": [
3622
- {
3623
- "include": "#literals-regular-expression-literal-quote"
3624
- },
3625
- {
3626
- "name": "comment.block.regexp",
3627
- "begin": "\\(\\?\\#",
3628
- "end": "\\)",
3629
- "beginCaptures": {
3630
- "0": {
3631
- "name": "punctuation.definition.comment.begin.regexp"
3632
- }
3633
- },
3634
- "endCaptures": {
3635
- "0": {
3636
- "name": "punctuation.definition.comment.end.regexp"
3637
- }
3638
- }
3639
- },
3640
- {
3641
- "name": "meta.embedded.expression.regexp",
3642
- "begin": "<\\{",
3643
- "end": "\\}>",
3644
- "beginCaptures": {
3645
- "0": {
3646
- "name": "punctuation.section.embedded.begin.regexp"
3647
- }
3648
- },
3649
- "endCaptures": {
3650
- "0": {
3651
- "name": "punctuation.section.embedded.end.regexp"
3652
- }
3653
- }
3654
- },
3655
- {
3656
- "include": "#literals-regular-expression-literal-unicode-scalars"
3657
- },
3658
- {
3659
- "include": "#literals-regular-expression-literal-character-properties"
3660
- },
3661
- {
3662
- "name": "keyword.control.anchor.regexp",
3663
- "match": "[$^]|\\\\[AbBGyYzZ]|\\\\K"
3664
- },
3665
- {
3666
- "include": "#literals-regular-expression-literal-backtracking-directive-or-global-matching-option"
3667
- },
3668
- {
3669
- "include": "#literals-regular-expression-literal-callout"
3670
- },
3671
- {
3672
- "include": "#literals-regular-expression-literal-backreference-or-subpattern"
3673
- },
3674
- {
3675
- "name": "constant.character.character-class.regexp",
3676
- "match": "\\.|\\\\[CdDhHNORsSvVwWX]"
3677
- },
3678
- {
3679
- "name": "constant.character.entity.control-character.regexp",
3680
- "match": "\\\\c."
3681
- },
3682
- {
3683
- "name": "constant.character.escape.backslash.regexp",
3684
- "match": "\\\\[^c]"
3685
- },
3686
- {
3687
- "name": "keyword.operator.or.regexp",
3688
- "match": "\\|"
3689
- },
3690
- {
3691
- "name": "keyword.operator.quantifier.regexp",
3692
- "match": "[*+?]"
3693
- },
3694
- {
3695
- "name": "keyword.operator.quantifier.regexp",
3696
- "match": "\\{\\s*\\d+\\s*(?:,\\s*\\d*\\s*)?\\}|\\{\\s*,\\s*\\d+\\s*\\}"
3697
- },
3698
- {
3699
- "include": "#literals-regular-expression-literal-custom-char-class"
3700
- },
3701
- {
3702
- "include": "#literals-regular-expression-literal-group-option-toggle"
3703
- },
3704
- {
3705
- "include": "#literals-regular-expression-literal-group-or-conditional"
3706
- }
3707
- ]
3708
- },
3709
- "literals-regular-expression-literal-set-operators": {
3710
- "patterns": [
3711
- {
3712
- "name": "keyword.operator.intersection.regexp.swift",
3713
- "match": "&&"
3714
- },
3715
- {
3716
- "name": "keyword.operator.subtraction.regexp.swift",
3717
- "match": "--"
3718
- },
3719
- {
3720
- "name": "keyword.operator.symmetric-difference.regexp.swift",
3721
- "match": "\\~\\~"
3722
- }
3723
- ]
3724
- },
3725
- "literals-regular-expression-literal-unicode-scalars": {
3726
- "name": "constant.character.numeric.regexp",
3727
- "match": "(?x)\n\\\\u\\{\\s*(?:[0-9a-fA-F]+\\s*)+\\}\n| \\\\u[0-9a-fA-F]{4}\n| \\\\x\\{[0-9a-fA-F]+\\}\n| \\\\x[0-9a-fA-F]{0,2}\n| \\\\U[0-9a-fA-F]{8}\n| \\\\o\\{[0-7]+\\}\n| \\\\0[0-7]{0,3}\n| \\\\N\\{(?:U\\+[0-9a-fA-F]{1,8} | [\\s\\w-]+)\\}"
3728
- },
3729
- "literals-string": {
3730
- "patterns": [
3731
- {
3732
- "comment": "SE-0168: Multi-Line String Literals",
3733
- "name": "string.quoted.double.block.swift",
3734
- "begin": "\"\"\"",
3735
- "end": "\"\"\"(#*)",
3736
- "beginCaptures": {
3737
- "0": {
3738
- "name": "punctuation.definition.string.begin.swift"
3739
- }
3740
- },
3741
- "endCaptures": {
3742
- "0": {
3743
- "name": "punctuation.definition.string.end.swift"
3744
- },
3745
- "1": {
3746
- "name": "invalid.illegal.extra-closing-delimiter.swift"
3747
- }
3748
- },
3749
- "patterns": [
3750
- {
3751
- "name": "invalid.illegal.content-after-opening-delimiter.swift",
3752
- "match": "\\G.+(?=\"\"\")|\\G.+"
3753
- },
3754
- {
3755
- "name": "constant.character.escape.newline.swift",
3756
- "match": "\\\\\\s*\\n"
3757
- },
3758
- {
3759
- "include": "#literals-string-string-guts"
3760
- },
3761
- {
3762
- "comment": "Allow \\(\"\"\"...\"\"\") to appear inside a block string",
3763
- "name": "invalid.illegal.content-before-closing-delimiter.swift",
3764
- "match": "\\S((?!\\\\\\().)*(?=\"\"\")"
3765
- }
3766
- ]
3767
- },
3768
- {
3769
- "name": "string.quoted.double.block.raw.swift",
3770
- "begin": "#\"\"\"",
3771
- "end": "\"\"\"#(#*)",
3772
- "beginCaptures": {
3773
- "0": {
3774
- "name": "punctuation.definition.string.begin.swift"
3775
- }
3776
- },
3777
- "endCaptures": {
3778
- "0": {
3779
- "name": "punctuation.definition.string.end.swift"
3780
- },
3781
- "1": {
3782
- "name": "invalid.illegal.extra-closing-delimiter.swift"
3783
- }
3784
- },
3785
- "patterns": [
3786
- {
3787
- "name": "invalid.illegal.content-after-opening-delimiter.swift",
3788
- "match": "\\G.+(?=\"\"\")|\\G.+"
3789
- },
3790
- {
3791
- "name": "constant.character.escape.newline.swift",
3792
- "match": "\\\\#\\s*\\n"
3793
- },
3794
- {
3795
- "include": "#literals-string-raw-string-guts"
3796
- },
3797
- {
3798
- "comment": "Allow \\(\"\"\"...\"\"\") to appear inside a block string",
3799
- "name": "invalid.illegal.content-before-closing-delimiter.swift",
3800
- "match": "\\S((?!\\\\#\\().)*(?=\"\"\")"
3801
- }
3802
- ]
3803
- },
3804
- {
3805
- "name": "string.quoted.double.block.raw.swift",
3806
- "begin": "(##+)\"\"\"",
3807
- "end": "\"\"\"\\1(#*)",
3808
- "beginCaptures": {
3809
- "0": {
3810
- "name": "punctuation.definition.string.begin.swift"
3811
- }
3812
- },
3813
- "endCaptures": {
3814
- "0": {
3815
- "name": "punctuation.definition.string.end.swift"
3816
- },
3817
- "1": {
3818
- "name": "invalid.illegal.extra-closing-delimiter.swift"
3819
- }
3820
- },
3821
- "patterns": [
3822
- {
3823
- "name": "invalid.illegal.content-after-opening-delimiter.swift",
3824
- "match": "\\G.+(?=\"\"\")|\\G.+"
3825
- }
3826
- ]
3827
- },
3828
- {
3829
- "name": "string.quoted.double.single-line.swift",
3830
- "begin": "\"",
3831
- "end": "\"(#*)",
3832
- "beginCaptures": {
3833
- "0": {
3834
- "name": "punctuation.definition.string.begin.swift"
3835
- }
3836
- },
3837
- "endCaptures": {
3838
- "0": {
3839
- "name": "punctuation.definition.string.end.swift"
3840
- },
3841
- "1": {
3842
- "name": "invalid.illegal.extra-closing-delimiter.swift"
3843
- }
3844
- },
3845
- "patterns": [
3846
- {
3847
- "name": "invalid.illegal.returns-not-allowed.swift",
3848
- "match": "\\r|\\n"
3849
- },
3850
- {
3851
- "include": "#literals-string-string-guts"
3852
- }
3853
- ]
3854
- },
3855
- {
3856
- "comment": "SE-0168: raw string literals (more than one #, grammar limitations prevent us from supporting escapes)",
3857
- "name": "string.quoted.double.single-line.raw.swift",
3858
- "begin": "(##+)\"",
3859
- "end": "\"\\1(#*)",
3860
- "beginCaptures": {
3861
- "0": {
3862
- "name": "punctuation.definition.string.begin.raw.swift"
3863
- }
3864
- },
3865
- "endCaptures": {
3866
- "0": {
3867
- "name": "punctuation.definition.string.end.raw.swift"
3868
- },
3869
- "1": {
3870
- "name": "invalid.illegal.extra-closing-delimiter.swift"
3871
- }
3872
- },
3873
- "patterns": [
3874
- {
3875
- "name": "invalid.illegal.returns-not-allowed.swift",
3876
- "match": "\\r|\\n"
3877
- }
3878
- ]
3879
- },
3880
- {
3881
- "comment": "SE-0168: raw string literals (one #, escapes supported)",
3882
- "name": "string.quoted.double.single-line.raw.swift",
3883
- "begin": "#\"",
3884
- "end": "\"#(#*)",
3885
- "beginCaptures": {
3886
- "0": {
3887
- "name": "punctuation.definition.string.begin.raw.swift"
3888
- }
3889
- },
3890
- "endCaptures": {
3891
- "0": {
3892
- "name": "punctuation.definition.string.end.raw.swift"
3893
- },
3894
- "1": {
3895
- "name": "invalid.illegal.extra-closing-delimiter.swift"
3896
- }
3897
- },
3898
- "patterns": [
3899
- {
3900
- "name": "invalid.illegal.returns-not-allowed.swift",
3901
- "match": "\\r|\\n"
3902
- },
3903
- {
3904
- "include": "#literals-string-raw-string-guts"
3905
- }
3906
- ]
3907
- }
3908
- ]
3909
- },
3910
- "literals-string-raw-string-guts": {
3911
- "comment": "the same as #string-guts but with # in escapes",
3912
- "patterns": [
3913
- {
3914
- "name": "constant.character.escape.swift",
3915
- "match": "\\\\#[0\\\\tnr\"']"
3916
- },
3917
- {
3918
- "name": "constant.character.escape.unicode.swift",
3919
- "match": "\\\\#u\\{[0-9a-fA-F]{1,8}\\}"
3920
- },
3921
- {
3922
- "contentName": "source.swift",
3923
- "name": "meta.embedded.line.swift",
3924
- "begin": "\\\\#\\(",
3925
- "end": "(\\))",
3926
- "beginCaptures": {
3927
- "0": {
3928
- "name": "punctuation.section.embedded.begin.swift"
3929
- }
3930
- },
3931
- "endCaptures": {
3932
- "0": {
3933
- "name": "punctuation.section.embedded.end.swift"
3934
- },
3935
- "1": {
3936
- "name": "source.swift"
3937
- }
3938
- },
3939
- "patterns": [
3940
- {
3941
- "include": "$self"
3942
- },
3943
- {
3944
- "comment": "Nested parens",
3945
- "begin": "\\(",
3946
- "end": "\\)"
3947
- }
3948
- ]
3949
- },
3950
- {
3951
- "name": "invalid.illegal.escape-not-recognized",
3952
- "match": "\\\\#."
3953
- }
3954
- ]
3955
- },
3956
- "literals-string-string-guts": {
3957
- "patterns": [
3958
- {
3959
- "name": "constant.character.escape.swift",
3960
- "match": "\\\\[0\\\\tnr\"']"
3961
- },
3962
- {
3963
- "name": "constant.character.escape.unicode.swift",
3964
- "match": "\\\\u\\{[0-9a-fA-F]{1,8}\\}"
3965
- },
3966
- {
3967
- "contentName": "source.swift",
3968
- "name": "meta.embedded.line.swift",
3969
- "begin": "\\\\\\(",
3970
- "end": "(\\))",
3971
- "beginCaptures": {
3972
- "0": {
3973
- "name": "punctuation.section.embedded.begin.swift"
3974
- }
3975
- },
3976
- "endCaptures": {
3977
- "0": {
3978
- "name": "punctuation.section.embedded.end.swift"
3979
- },
3980
- "1": {
3981
- "name": "source.swift"
3982
- }
3983
- },
3984
- "patterns": [
3985
- {
3986
- "include": "$self"
3987
- },
3988
- {
3989
- "comment": "Nested parens",
3990
- "begin": "\\(",
3991
- "end": "\\)"
3992
- }
3993
- ]
3994
- },
3995
- {
3996
- "name": "invalid.illegal.escape-not-recognized",
3997
- "match": "\\\\."
3998
- }
3999
- ]
4000
- },
4001
- "member-reference": {
4002
- "patterns": [
4003
- {
4004
- "match": "(?<=\\.)((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
4005
- "captures": {
4006
- "1": {
4007
- "name": "variable.other.swift"
4008
- },
4009
- "2": {
4010
- "name": "punctuation.definition.identifier.swift"
4011
- },
4012
- "3": {
4013
- "name": "punctuation.definition.identifier.swift"
4014
- }
4015
- }
4016
- }
4017
- ]
4018
- },
4019
- "operators": {
4020
- "patterns": [
4021
- {
4022
- "comment": "Type casting",
4023
- "name": "keyword.operator.type-casting.swift",
4024
- "match": "\\b(is\\b|as([!?]\\B|\\b))"
4025
- },
4026
- {
4027
- "comment": "This rule helps us speed up the matching.",
4028
- "begin": "(?x)\n(?=\n (?<oph> # operator-head\n [/=\\-+!*%<>&|^~?]\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n )\n | \\.\n (\n \\g<oph> # operator-head\n | \\.\n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)",
4029
- "end": "(?!\\G)",
4030
- "patterns": [
4031
- {
4032
- "comment": "Prefix unary operator",
4033
- "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?<=^|[\\s(\\[{,;:])\n(\n (?!(//|/\\*|\\*/))\n (\n [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?![\\s)\\]},;:]|\\z)",
4034
- "captures": {
4035
- "0": {
4036
- "patterns": [
4037
- {
4038
- "name": "keyword.operator.increment-or-decrement.swift",
4039
- "match": "\\G(\\+\\+|\\-\\-)$"
4040
- },
4041
- {
4042
- "name": "keyword.operator.arithmetic.unary.swift",
4043
- "match": "\\G(\\+|\\-)$"
4044
- },
4045
- {
4046
- "name": "keyword.operator.logical.not.swift",
4047
- "match": "\\G!$"
4048
- },
4049
- {
4050
- "name": "keyword.operator.bitwise.not.swift",
4051
- "match": "\\G~$"
4052
- },
4053
- {
4054
- "name": "keyword.operator.custom.prefix.swift",
4055
- "match": ".+"
4056
- }
4057
- ]
4058
- }
4059
- }
4060
- },
4061
- {
4062
- "comment": "Postfix unary operator",
4063
- "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?<!^|[\\s(\\[{,;:])\n(\n (?!(//|/\\*|\\*/))\n (\n [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?=[\\s)\\]},;:]|\\z)",
4064
- "captures": {
4065
- "0": {
4066
- "patterns": [
4067
- {
4068
- "name": "keyword.operator.increment-or-decrement.swift",
4069
- "match": "\\G(\\+\\+|\\-\\-)$"
4070
- },
4071
- {
4072
- "name": "keyword.operator.increment-or-decrement.swift",
4073
- "match": "\\G!$"
4074
- },
4075
- {
4076
- "name": "keyword.operator.custom.postfix.swift",
4077
- "match": ".+"
4078
- }
4079
- ]
4080
- }
4081
- }
4082
- },
4083
- {
4084
- "comment": "Infix operator",
4085
- "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(\n (?!(//|/\\*|\\*/))\n (\n [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++",
4086
- "captures": {
4087
- "0": {
4088
- "patterns": [
4089
- {
4090
- "name": "keyword.operator.assignment.swift",
4091
- "match": "\\G=$"
4092
- },
4093
- {
4094
- "name": "keyword.operator.assignment.compound.swift",
4095
- "match": "\\G(\\+|\\-|\\*|/|%|<<|>>|&|\\^|\\||&&|\\|\\|)=$"
4096
- },
4097
- {
4098
- "name": "keyword.operator.arithmetic.swift",
4099
- "match": "\\G(\\+|\\-|\\*|/)$"
4100
- },
4101
- {
4102
- "name": "keyword.operator.arithmetic.overflow.swift",
4103
- "match": "\\G&(\\+|\\-|\\*)$"
4104
- },
4105
- {
4106
- "name": "keyword.operator.arithmetic.remainder.swift",
4107
- "match": "\\G%$"
4108
- },
4109
- {
4110
- "name": "keyword.operator.comparison.swift",
4111
- "match": "\\G(==|!=|>|<|>=|<=|~=)$"
4112
- },
4113
- {
4114
- "name": "keyword.operator.coalescing.swift",
4115
- "match": "\\G\\?\\?$"
4116
- },
4117
- {
4118
- "name": "keyword.operator.logical.swift",
4119
- "match": "\\G(&&|\\|\\|)$"
4120
- },
4121
- {
4122
- "name": "keyword.operator.bitwise.swift",
4123
- "match": "\\G(&|\\||\\^|<<|>>)$"
4124
- },
4125
- {
4126
- "name": "keyword.operator.bitwise.swift",
4127
- "match": "\\G(===|!==)$"
4128
- },
4129
- {
4130
- "name": "keyword.operator.ternary.swift",
4131
- "match": "\\G\\?$"
4132
- },
4133
- {
4134
- "name": "keyword.operator.custom.infix.swift",
4135
- "match": ".+"
4136
- }
4137
- ]
4138
- }
4139
- }
4140
- },
4141
- {
4142
- "comment": "Dot prefix unary operator",
4143
- "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?<=^|[\\s(\\[{,;:])\n\\. # dot\n(\n (?!(//|/\\*|\\*/))\n (\n \\. # dot\n | [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?![\\s)\\]},;:]|\\z)",
4144
- "captures": {
4145
- "0": {
4146
- "patterns": [
4147
- {
4148
- "name": "keyword.operator.custom.prefix.dot.swift",
4149
- "match": ".+"
4150
- }
4151
- ]
4152
- }
4153
- }
4154
- },
4155
- {
4156
- "comment": "Dot postfix unary operator",
4157
- "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n(?<!^|[\\s(\\[{,;:])\n\\. # dot\n(\n (?!(//|/\\*|\\*/))\n (\n \\. # dot\n | [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++\n(?=[\\s)\\]},;:]|\\z)",
4158
- "captures": {
4159
- "0": {
4160
- "patterns": [
4161
- {
4162
- "name": "keyword.operator.custom.postfix.dot.swift",
4163
- "match": ".+"
4164
- }
4165
- ]
4166
- }
4167
- }
4168
- },
4169
- {
4170
- "comment": "Dot infix operator",
4171
- "match": "(?x)\n\\G # Matching from the beginning ensures\n # that we start with operator-head\n\\. # dot\n(\n (?!(//|/\\*|\\*/))\n (\n \\. # dot\n | [/=\\-+!*%<>&|^~?] # operator-head\n | [\\x{00A1}-\\x{00A7}]\n | [\\x{00A9}\\x{00AB}]\n | [\\x{00AC}\\x{00AE}]\n | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n | [\\x{2030}-\\x{203E}]\n | [\\x{2041}-\\x{2053}]\n | [\\x{2055}-\\x{205E}]\n | [\\x{2190}-\\x{23FF}]\n | [\\x{2500}-\\x{2775}]\n | [\\x{2794}-\\x{2BFF}]\n | [\\x{2E00}-\\x{2E7F}]\n | [\\x{3001}-\\x{3003}]\n | [\\x{3008}-\\x{3030}]\n \n | [\\x{0300}-\\x{036F}] # operator-character\n | [\\x{1DC0}-\\x{1DFF}]\n | [\\x{20D0}-\\x{20FF}]\n | [\\x{FE00}-\\x{FE0F}]\n | [\\x{FE20}-\\x{FE2F}]\n | [\\x{E0100}-\\x{E01EF}]\n )\n)++",
4172
- "captures": {
4173
- "0": {
4174
- "patterns": [
4175
- {
4176
- "name": "keyword.operator.range.swift",
4177
- "match": "\\G\\.\\.[.<]$"
4178
- },
4179
- {
4180
- "name": "keyword.operator.custom.infix.dot.swift",
4181
- "match": ".+"
4182
- }
4183
- ]
4184
- }
4185
- }
4186
- }
4187
- ]
4188
- },
4189
- {
4190
- "name": "keyword.operator.ternary.swift",
4191
- "match": ":"
4192
- }
4193
- ]
4194
- },
4195
- "root": {
4196
- "patterns": [
4197
- {
4198
- "include": "#compiler-control"
4199
- },
4200
- {
4201
- "include": "#declarations"
4202
- },
4203
- {
4204
- "include": "#expressions"
4205
- }
4206
- ]
4207
- }
4208
- }
4209
- }