@codingame/monaco-languageclient-wrapper 1.0.9 → 1.1.0

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.
Files changed (170) hide show
  1. package/dist/BSV.tmLanguage.js +299 -0
  2. package/dist/COBOL Copybook.js +2017 -0
  3. package/dist/COBOL.js +2017 -0
  4. package/dist/COBOL.tmLanguage.js +149 -0
  5. package/dist/CodinGameMonacoWorkspace.d.ts +13 -0
  6. package/dist/Configuration.d.ts +15 -0
  7. package/dist/Erlang.plist.js +1752 -0
  8. package/dist/JSON.tmLanguage.js +221 -0
  9. package/dist/JSONC.tmLanguage.js +221 -0
  10. package/dist/JavaScript.tmLanguage.js +5894 -0
  11. package/dist/Kotlin.tmLanguage.js +724 -0
  12. package/dist/MagicPython.tmLanguage.js +5340 -0
  13. package/dist/MagicRegExp.tmLanguage.js +505 -0
  14. package/dist/Regular Expressions (JavaScript).tmLanguage.js +166 -0
  15. package/dist/SQL.plist.js +482 -0
  16. package/dist/Scala.tmLanguage.js +1255 -0
  17. package/dist/TypeScript.tmLanguage.js +5641 -0
  18. package/dist/WatchableConsoleWindow.d.ts +22 -0
  19. package/dist/_rollupPluginBabelHelpers.js +54 -0
  20. package/dist/asp-vb-net.tmlanguage.js +247 -0
  21. package/dist/bsv.js +49 -0
  22. package/dist/c.js +18 -0
  23. package/dist/c.tmLanguage.js +3347 -0
  24. package/dist/cabal.tmLanguage.js +66 -0
  25. package/dist/clojure.tmLanguage.js +443 -0
  26. package/dist/codeblock-cabal.js +42 -0
  27. package/dist/codeblock-haskell.js +42 -0
  28. package/dist/codeblock-literate-haskell.js +42 -0
  29. package/dist/codeblock.js +36 -0
  30. package/dist/codeblock2.js +95 -0
  31. package/dist/coffeescript.js +18 -0
  32. package/dist/coffeescript.tmLanguage.js +1324 -0
  33. package/dist/configuration/index.d.ts +5 -0
  34. package/dist/cpp.js +18 -0
  35. package/dist/cpp.tmLanguage.js +19996 -0
  36. package/dist/createLanguageClient.d.ts +2 -2
  37. package/dist/csharp.js +18 -0
  38. package/dist/csharp.tmLanguage.js +4750 -0
  39. package/dist/css.tmLanguage.js +1873 -0
  40. package/dist/css.worker.js +6 -0
  41. package/dist/cssContribution.js +10 -0
  42. package/dist/cuda-cpp.tmLanguage.js +19993 -0
  43. package/dist/d.js +3159 -0
  44. package/dist/dart.js +530 -0
  45. package/dist/diet.js +758 -0
  46. package/dist/diet2.js +92 -0
  47. package/dist/dml.js +169 -0
  48. package/dist/eex.js +55 -0
  49. package/dist/elixir.js +2341 -0
  50. package/dist/elixir2.js +184 -0
  51. package/dist/erlang.js +195 -0
  52. package/dist/expression.js +846 -0
  53. package/dist/extensions/autofold.d.ts +2 -0
  54. package/dist/extensions/cobol.d.ts +2 -0
  55. package/dist/extensions/index.d.ts +2 -0
  56. package/dist/features/cssContribution.d.ts +1 -0
  57. package/dist/features/htmlContribution.d.ts +1 -0
  58. package/dist/features/jsonContribution.d.ts +1 -0
  59. package/dist/features/typescriptContribution.d.ts +1 -0
  60. package/dist/fsharp.js +18 -0
  61. package/dist/fsharp.tmLanguage.js +1811 -0
  62. package/dist/go.tmLanguage.js +1025 -0
  63. package/dist/groovy.js +229 -0
  64. package/dist/groovy.tmLanguage.js +1391 -0
  65. package/dist/haskell.tmLanguage.js +629 -0
  66. package/dist/html (eex).js +31 -0
  67. package/dist/html-derivative.tmLanguage.js +57 -0
  68. package/dist/html.tmLanguage.js +2652 -0
  69. package/dist/html.tmLanguage2.js +97 -0
  70. package/dist/html.worker.js +6 -0
  71. package/dist/htmlContribution.js +10 -0
  72. package/dist/index.d.ts +2 -2
  73. package/dist/inline-styles.js +104 -0
  74. package/dist/inline-template.js +88 -0
  75. package/dist/java.js +18 -0
  76. package/dist/java.tmLanguage.js +1863 -0
  77. package/dist/javascript.js +196 -0
  78. package/dist/javascriptreact.js +196 -0
  79. package/dist/jsdoc.js.injection.tmLanguage.js +32 -0
  80. package/dist/jsdoc.ts.injection.tmLanguage.js +32 -0
  81. package/dist/json.worker.js +6 -0
  82. package/dist/jsonContribution.js +78 -0
  83. package/dist/keybindings/index.d.ts +2 -0
  84. package/dist/keybindings/keybindingHelper.d.ts +2 -0
  85. package/dist/keybindings/vim.d.ts +3 -0
  86. package/dist/kotlin.js +117 -0
  87. package/dist/kotlinscript.js +117 -0
  88. package/dist/languageClient.d.ts +8 -14
  89. package/dist/languages/extensions/grammarLoader.d.ts +91037 -0
  90. package/dist/languages/extensions/snippetLoader.d.ts +4578 -0
  91. package/dist/languages/index.d.ts +3 -0
  92. package/dist/languages/monarch/index.d.ts +7 -0
  93. package/dist/languages/monarch/list.d.ts +7 -0
  94. package/dist/languages/monarch/stub-generator.d.ts +2 -0
  95. package/dist/languages/snippets/index.d.ts +1 -0
  96. package/dist/languages/textMate/CGTMGrammarFactory.d.ts +5 -0
  97. package/dist/languages/textMate/TextMateTokensProvider.d.ts +11 -0
  98. package/dist/languages/textMate/index.d.ts +2 -0
  99. package/dist/literateHaskell.tmLanguage.js +70 -0
  100. package/dist/lua.tmLanguage.js +289 -0
  101. package/dist/main.js +619 -314
  102. package/dist/markdown.js +103 -0
  103. package/dist/markdown.tmLanguage.js +2784 -0
  104. package/dist/merlin.js +111 -0
  105. package/dist/monaco.d.ts +8 -0
  106. package/dist/objective-c.tmLanguage.js +3618 -0
  107. package/dist/ocaml-hover-info.js +34 -0
  108. package/dist/ocaml-hover-type.js +24 -0
  109. package/dist/ocaml-markdown-codeblock.js +42 -0
  110. package/dist/ocaml.js +2979 -0
  111. package/dist/ocamlbuild.js +239 -0
  112. package/dist/opam.js +149 -0
  113. package/dist/pascal.js +382 -0
  114. package/dist/pascal.tmLanguage.js +169 -0
  115. package/dist/perl.tmLanguage.js +2986 -0
  116. package/dist/perl6.tmLanguage.js +323 -0
  117. package/dist/pgsql.tmLanguage.js +284 -0
  118. package/dist/php.js +265 -0
  119. package/dist/php.tmLanguage.js +3791 -0
  120. package/dist/platform.tmLanguage.js +1135 -0
  121. package/dist/powershell.js +18 -0
  122. package/dist/powershell.tmLanguage.js +1037 -0
  123. package/dist/r.tmLanguage.js +551 -0
  124. package/dist/reason-hover-info.js +34 -0
  125. package/dist/reason-hover-signature.js +21 -0
  126. package/dist/reason-hover-type.js +21 -0
  127. package/dist/reason-markdown-codeblock.js +42 -0
  128. package/dist/reason.js +100 -0
  129. package/dist/ruby.tmLanguage.js +2784 -0
  130. package/dist/rust.tmLanguage.js +1178 -0
  131. package/dist/sassdoc.tmLanguage.js +362 -0
  132. package/dist/scss.tmLanguage.js +1887 -0
  133. package/dist/sdc.tmLanguage.js +712 -0
  134. package/dist/sdl.js +162 -0
  135. package/dist/services/Configuration.d.ts +2 -3
  136. package/dist/services/EditorModelResolverService.d.ts +8 -0
  137. package/dist/services/MultiEditorStandaloneCodeEditorService.d.ts +7 -0
  138. package/dist/services/WatchableConsoleWindow.d.ts +2 -0
  139. package/dist/services.d.ts +1 -2
  140. package/dist/shell-unix-bash.tmLanguage.js +1291 -0
  141. package/dist/sql.js +21 -0
  142. package/dist/staticOptions.d.ts +9 -0
  143. package/dist/stub-generator.js +15 -0
  144. package/dist/swift.js +183 -0
  145. package/dist/swift.tmLanguage.js +3288 -0
  146. package/dist/systemverilog.js +208 -0
  147. package/dist/systemverilog.tmLanguage.js +1067 -0
  148. package/dist/tcl.js +151 -0
  149. package/dist/tcl.tmlanguage.yaml.js +5484 -0
  150. package/dist/template.js +207 -0
  151. package/dist/theme/index.d.ts +3 -0
  152. package/dist/theme/registry.d.ts +4 -0
  153. package/dist/theme/semanticHighlight.d.ts +1 -0
  154. package/dist/theme/tools.d.ts +13 -0
  155. package/dist/tools.d.ts +3 -0
  156. package/dist/ts.worker.js +6 -0
  157. package/dist/typescript.js +312 -0
  158. package/dist/typescriptContribution.js +36 -0
  159. package/dist/typescriptreact.js +312 -0
  160. package/dist/ucf.tmLanguage.js +36 -0
  161. package/dist/vb.js +88 -0
  162. package/dist/verilog.js +432 -0
  163. package/dist/verilog.tmLanguage.js +321 -0
  164. package/dist/worker.d.ts +6 -0
  165. package/dist/worker.js +54 -0
  166. package/dist/xml.tmLanguage.js +395 -0
  167. package/dist/xsl.tmLanguage.js +102 -0
  168. package/dist/yaml.tmLanguage.js +629 -0
  169. package/package.json +19 -20
  170. package/stats.html +1 -1
@@ -0,0 +1,3288 @@
1
+ var information_for_contributors = [
2
+ "This file has been converted from https://github.com/microsoft/vscode/blob/master/extensions/swift/",
3
+ "If you want to provide a fix or improvement, please create a pull request against the original repository.",
4
+ "Once accepted there, we are happy to receive an update request."
5
+ ];
6
+ var version = "https://github.com/textmate/swift.tmbundle/commit/8c7672d74c1baa4e6944a05ac6c57a623532f18b";
7
+ var name = "Swift";
8
+ var scopeName = "source.swift";
9
+ var comment = "See swift.tmbundle/grammar-test.swift for test cases.";
10
+ var patterns = [
11
+ {
12
+ include: "#root"
13
+ }
14
+ ];
15
+ var repository = {
16
+ "async-throws": {
17
+ captures: {
18
+ "1": {
19
+ name: "invalid.illegal.await-must-precede-throws.swift"
20
+ },
21
+ "2": {
22
+ name: "keyword.control.exception.swift"
23
+ },
24
+ "3": {
25
+ name: "keyword.control.async.swift"
26
+ }
27
+ },
28
+ match: "\\b(?:(throws\\s+async|rethrows\\s+async)|(throws|rethrows)|(async))\\b"
29
+ },
30
+ attributes: {
31
+ patterns: [
32
+ {
33
+ begin: "((@)available)(\\()",
34
+ beginCaptures: {
35
+ "1": {
36
+ name: "storage.modifier.attribute.swift"
37
+ },
38
+ "2": {
39
+ name: "punctuation.definition.attribute.swift"
40
+ },
41
+ "3": {
42
+ name: "punctuation.definition.arguments.begin.swift"
43
+ }
44
+ },
45
+ end: "\\)",
46
+ endCaptures: {
47
+ "0": {
48
+ name: "punctuation.definition.arguments.end.swift"
49
+ }
50
+ },
51
+ name: "meta.attribute.available.swift",
52
+ patterns: [
53
+ {
54
+ captures: {
55
+ "1": {
56
+ name: "keyword.other.platform.os.swift"
57
+ },
58
+ "2": {
59
+ name: "constant.numeric.swift"
60
+ }
61
+ },
62
+ match: "\\b(swift|(?:iOS|macOS|OSX|watchOS|tvOS|UIKitForMac)(?:ApplicationExtension)?)\\b(?:\\s+([0-9]+(?:\\.[0-9]+)*\\b))?"
63
+ },
64
+ {
65
+ begin: "\\b(introduced|deprecated|obsoleted)\\s*(:)\\s*",
66
+ beginCaptures: {
67
+ "1": {
68
+ name: "keyword.other.swift"
69
+ },
70
+ "2": {
71
+ name: "punctuation.separator.key-value.swift"
72
+ }
73
+ },
74
+ end: "(?!\\G)",
75
+ patterns: [
76
+ {
77
+ match: "\\b[0-9]+(?:\\.[0-9]+)*\\b",
78
+ name: "constant.numeric.swift"
79
+ }
80
+ ]
81
+ },
82
+ {
83
+ begin: "\\b(message|renamed)\\s*(:)\\s*(?=\")",
84
+ beginCaptures: {
85
+ "1": {
86
+ name: "keyword.other.swift"
87
+ },
88
+ "2": {
89
+ name: "punctuation.separator.key-value.swift"
90
+ }
91
+ },
92
+ end: "(?!\\G)",
93
+ patterns: [
94
+ {
95
+ include: "#literals"
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ captures: {
101
+ "1": {
102
+ name: "keyword.other.platform.all.swift"
103
+ },
104
+ "2": {
105
+ name: "keyword.other.swift"
106
+ },
107
+ "3": {
108
+ name: "invalid.illegal.character-not-allowed-here.swift"
109
+ }
110
+ },
111
+ match: "(?:(\\*)|\\b(deprecated|unavailable)\\b)\\s*(.*?)(?=[,)])"
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ begin: "((@)objc)(\\()",
117
+ beginCaptures: {
118
+ "1": {
119
+ name: "storage.modifier.attribute.swift"
120
+ },
121
+ "2": {
122
+ name: "punctuation.definition.attribute.swift"
123
+ },
124
+ "3": {
125
+ name: "punctuation.definition.arguments.begin.swift"
126
+ }
127
+ },
128
+ end: "\\)",
129
+ endCaptures: {
130
+ "0": {
131
+ name: "punctuation.definition.arguments.end.swift"
132
+ }
133
+ },
134
+ name: "meta.attribute.objc.swift",
135
+ patterns: [
136
+ {
137
+ captures: {
138
+ "1": {
139
+ name: "invalid.illegal.missing-colon-after-selector-piece.swift"
140
+ }
141
+ },
142
+ match: "\\w*(?::(?:\\w*:)*(\\w*))?",
143
+ name: "entity.name.function.swift"
144
+ }
145
+ ]
146
+ },
147
+ {
148
+ begin: "(@)(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)",
149
+ beginCaptures: {
150
+ "0": {
151
+ name: "storage.modifier.attribute.swift"
152
+ },
153
+ "1": {
154
+ name: "punctuation.definition.attribute.swift"
155
+ },
156
+ "2": {
157
+ name: "punctuation.definition.identifier.swift"
158
+ },
159
+ "3": {
160
+ name: "punctuation.definition.identifier.swift"
161
+ }
162
+ },
163
+ comment: "any other attribute",
164
+ end: "(?!\\G\\()",
165
+ name: "meta.attribute.swift",
166
+ patterns: [
167
+ {
168
+ begin: "\\(",
169
+ beginCaptures: {
170
+ "0": {
171
+ name: "punctuation.definition.arguments.begin.swift"
172
+ }
173
+ },
174
+ end: "\\)",
175
+ endCaptures: {
176
+ "0": {
177
+ name: "punctuation.definition.arguments.end.swift"
178
+ }
179
+ },
180
+ name: "meta.arguments.attribute.swift",
181
+ patterns: [
182
+ {
183
+ include: "#expressions"
184
+ }
185
+ ]
186
+ }
187
+ ]
188
+ }
189
+ ]
190
+ },
191
+ "builtin-functions": {
192
+ patterns: [
193
+ {
194
+ comment: "Member functions in the standard library in Swift 3 which may be used with trailing closures and no parentheses",
195
+ 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",
196
+ name: "support.function.swift"
197
+ },
198
+ {
199
+ comment: "Member functions in the standard library in Swift 3",
200
+ 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*\\()",
201
+ name: "support.function.swift"
202
+ },
203
+ {
204
+ comment: "Member functions in the standard library in Swift 2 only",
205
+ 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*\\()",
206
+ name: "support.function.swift"
207
+ }
208
+ ]
209
+ },
210
+ "builtin-global-functions": {
211
+ patterns: [
212
+ {
213
+ begin: "\\b(type)(\\()\\s*(of)(:)",
214
+ beginCaptures: {
215
+ "1": {
216
+ name: "support.function.dynamic-type.swift"
217
+ },
218
+ "2": {
219
+ name: "punctuation.definition.arguments.begin.swift"
220
+ },
221
+ "3": {
222
+ name: "support.variable.parameter.swift"
223
+ },
224
+ "4": {
225
+ name: "punctuation.separator.argument-label.begin.swift"
226
+ }
227
+ },
228
+ end: "\\)",
229
+ endCaptures: {
230
+ "0": {
231
+ name: "punctuation.definition.arguments.end.swift"
232
+ }
233
+ },
234
+ patterns: [
235
+ {
236
+ include: "#expressions"
237
+ }
238
+ ]
239
+ },
240
+ {
241
+ comment: "Global functions available in Swift 3 which may be used with trailing closures and no parentheses",
242
+ match: "\\b(?:anyGenerator|autoreleasepool)(?=\\s*[({])\\b",
243
+ name: "support.function.swift"
244
+ },
245
+ {
246
+ comment: "Global functions available in Swift 3",
247
+ 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*\\()",
248
+ name: "support.function.swift"
249
+ },
250
+ {
251
+ comment: "Global functions available in Swift 2 only",
252
+ 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*\\()",
253
+ name: "support.function.swift"
254
+ }
255
+ ]
256
+ },
257
+ "builtin-properties": {
258
+ patterns: [
259
+ {
260
+ comment: "The simpler (?<=\\bProcess\\.|\\bCommandLine\\.) breaks VS Code / Atom, see https://github.com/textmate/swift.tmbundle/issues/29",
261
+ match: "(?<=^Process\\.|\\WProcess\\.|^CommandLine\\.|\\WCommandLine\\.)(arguments|argc|unsafeArgv)",
262
+ name: "support.variable.swift"
263
+ },
264
+ {
265
+ comment: "Properties in the standard library in Swift 3",
266
+ 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",
267
+ name: "support.variable.swift"
268
+ },
269
+ {
270
+ comment: "Properties in the standard library in Swift 2 only",
271
+ match: "(?<=\\.)(?:boolValue|disposition|end|objectIdentifier|quickLookObject|start|valueType)\\b",
272
+ name: "support.variable.swift"
273
+ },
274
+ {
275
+ comment: "Enum cases in the standard library - note that there is some overlap between these and the properties",
276
+ 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",
277
+ name: "support.variable.swift"
278
+ }
279
+ ]
280
+ },
281
+ "builtin-types": {
282
+ comment: "Types provided in the standard library",
283
+ patterns: [
284
+ {
285
+ include: "#builtin-class-type"
286
+ },
287
+ {
288
+ include: "#builtin-enum-type"
289
+ },
290
+ {
291
+ include: "#builtin-protocol-type"
292
+ },
293
+ {
294
+ include: "#builtin-struct-type"
295
+ },
296
+ {
297
+ include: "#builtin-typealias"
298
+ },
299
+ {
300
+ match: "\\bAny\\b",
301
+ name: "support.type.any.swift"
302
+ }
303
+ ],
304
+ repository: {
305
+ "builtin-class-type": {
306
+ comment: "Builtin class types",
307
+ match: "\\b(Managed(Buffer|ProtoBuffer)|NonObjectiveCBase|AnyGenerator)\\b",
308
+ name: "support.class.swift"
309
+ },
310
+ "builtin-enum-type": {
311
+ patterns: [
312
+ {
313
+ comment: "CommandLine is an enum, but it acts like a constant",
314
+ match: "\\b(?:CommandLine|Process(?=\\.))\\b",
315
+ name: "support.constant.swift"
316
+ },
317
+ {
318
+ comment: "The return type of a function that never returns",
319
+ match: "\\bNever\\b",
320
+ name: "support.constant.never.swift"
321
+ },
322
+ {
323
+ comment: "Enum types in the standard library in Swift 3",
324
+ match: "\\b(?:ImplicitlyUnwrappedOptional|Representation|MemoryLayout|FloatingPointClassification|SetIndexRepresentation|SetIteratorRepresentation|FloatingPointRoundingRule|UnicodeDecodingResult|Optional|DictionaryIndexRepresentation|AncestorRepresentation|DisplayStyle|PlaygroundQuickLook|Never|FloatingPointSign|Bit|DictionaryIteratorRepresentation)\\b",
325
+ name: "support.type.swift"
326
+ },
327
+ {
328
+ comment: "Enum types in the standard library in Swift 2 only",
329
+ match: "\\b(?:MirrorDisposition|QuickLookObject)\\b",
330
+ name: "support.type.swift"
331
+ }
332
+ ]
333
+ },
334
+ "builtin-protocol-type": {
335
+ patterns: [
336
+ {
337
+ comment: "Protocols in the standard library in Swift 3",
338
+ 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",
339
+ name: "support.type.swift"
340
+ },
341
+ {
342
+ comment: "Protocols in the standard library in Swift 2 only",
343
+ 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",
344
+ name: "support.type.swift"
345
+ }
346
+ ]
347
+ },
348
+ "builtin-struct-type": {
349
+ patterns: [
350
+ {
351
+ comment: "Structs in the standard library in Swift 3",
352
+ 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",
353
+ name: "support.type.swift"
354
+ },
355
+ {
356
+ comment: "Structs in the standard library in Swift 2 only",
357
+ 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",
358
+ name: "support.type.swift"
359
+ }
360
+ ]
361
+ },
362
+ "builtin-typealias": {
363
+ patterns: [
364
+ {
365
+ comment: "Typealiases in the standard library in Swift 3",
366
+ 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",
367
+ name: "support.type.swift"
368
+ },
369
+ {
370
+ comment: "Typealiases in the standard library in Swift 2 only",
371
+ match: "\\b(?:Generator|PlaygroundQuickLook|UWord|Word)\\b",
372
+ name: "support.type.swift"
373
+ }
374
+ ]
375
+ }
376
+ }
377
+ },
378
+ "code-block": {
379
+ begin: "\\{",
380
+ beginCaptures: {
381
+ "0": {
382
+ name: "punctuation.section.scope.begin.swift"
383
+ }
384
+ },
385
+ end: "\\}",
386
+ endCaptures: {
387
+ "0": {
388
+ name: "punctuation.section.scope.end.swift"
389
+ }
390
+ },
391
+ patterns: [
392
+ {
393
+ include: "$self"
394
+ }
395
+ ]
396
+ },
397
+ comments: {
398
+ patterns: [
399
+ {
400
+ captures: {
401
+ "1": {
402
+ name: "punctuation.definition.comment.swift"
403
+ }
404
+ },
405
+ match: "\\A^(#!).*$\\n?",
406
+ name: "comment.line.number-sign.swift"
407
+ },
408
+ {
409
+ begin: "/\\*\\*(?!/)",
410
+ beginCaptures: {
411
+ "0": {
412
+ name: "punctuation.definition.comment.begin.swift"
413
+ }
414
+ },
415
+ end: "\\*/",
416
+ endCaptures: {
417
+ "0": {
418
+ name: "punctuation.definition.comment.end.swift"
419
+ }
420
+ },
421
+ name: "comment.block.documentation.swift",
422
+ patterns: [
423
+ {
424
+ include: "#nested"
425
+ }
426
+ ]
427
+ },
428
+ {
429
+ begin: "/\\*:",
430
+ beginCaptures: {
431
+ "0": {
432
+ name: "punctuation.definition.comment.begin.swift"
433
+ }
434
+ },
435
+ end: "\\*/",
436
+ endCaptures: {
437
+ "0": {
438
+ name: "punctuation.definition.comment.end.swift"
439
+ }
440
+ },
441
+ name: "comment.block.documentation.playground.swift",
442
+ patterns: [
443
+ {
444
+ include: "#nested"
445
+ }
446
+ ]
447
+ },
448
+ {
449
+ begin: "/\\*",
450
+ beginCaptures: {
451
+ "0": {
452
+ name: "punctuation.definition.comment.begin.swift"
453
+ }
454
+ },
455
+ end: "\\*/",
456
+ endCaptures: {
457
+ "0": {
458
+ name: "punctuation.definition.comment.end.swift"
459
+ }
460
+ },
461
+ name: "comment.block.swift",
462
+ patterns: [
463
+ {
464
+ include: "#nested"
465
+ }
466
+ ]
467
+ },
468
+ {
469
+ match: "\\*/",
470
+ name: "invalid.illegal.unexpected-end-of-block-comment.swift"
471
+ },
472
+ {
473
+ begin: "(^[ \\t]+)?(?=//)",
474
+ beginCaptures: {
475
+ "1": {
476
+ name: "punctuation.whitespace.comment.leading.swift"
477
+ }
478
+ },
479
+ end: "(?!\\G)",
480
+ patterns: [
481
+ {
482
+ begin: "///",
483
+ beginCaptures: {
484
+ "0": {
485
+ name: "punctuation.definition.comment.swift"
486
+ }
487
+ },
488
+ end: "^",
489
+ name: "comment.line.triple-slash.documentation.swift"
490
+ },
491
+ {
492
+ begin: "//:",
493
+ beginCaptures: {
494
+ "0": {
495
+ name: "punctuation.definition.comment.swift"
496
+ }
497
+ },
498
+ end: "^",
499
+ name: "comment.line.double-slash.documentation.swift"
500
+ },
501
+ {
502
+ begin: "//",
503
+ beginCaptures: {
504
+ "0": {
505
+ name: "punctuation.definition.comment.swift"
506
+ }
507
+ },
508
+ end: "^",
509
+ name: "comment.line.double-slash.swift"
510
+ }
511
+ ]
512
+ }
513
+ ],
514
+ repository: {
515
+ nested: {
516
+ begin: "/\\*",
517
+ end: "\\*/",
518
+ patterns: [
519
+ {
520
+ include: "#nested"
521
+ }
522
+ ]
523
+ }
524
+ }
525
+ },
526
+ "compiler-control": {
527
+ patterns: [
528
+ {
529
+ begin: "^\\s*(#)(if|elseif)\\s+(false)\\b.*?(?=$|//|/\\*)",
530
+ beginCaptures: {
531
+ "0": {
532
+ name: "meta.preprocessor.conditional.swift"
533
+ },
534
+ "1": {
535
+ name: "punctuation.definition.preprocessor.swift"
536
+ },
537
+ "2": {
538
+ name: "keyword.control.preprocessor.conditional.swift"
539
+ },
540
+ "3": {
541
+ name: "constant.language.boolean.swift"
542
+ }
543
+ },
544
+ contentName: "comment.block.preprocessor.swift",
545
+ end: "(?=^\\s*(#(elseif|else|endif)\\b))"
546
+ },
547
+ {
548
+ begin: "^\\s*(#)(if|elseif)\\s+",
549
+ captures: {
550
+ "1": {
551
+ name: "punctuation.definition.preprocessor.swift"
552
+ },
553
+ "2": {
554
+ name: "keyword.control.preprocessor.conditional.swift"
555
+ }
556
+ },
557
+ end: "(?=\\s*(?://|/\\*))|$",
558
+ name: "meta.preprocessor.conditional.swift",
559
+ patterns: [
560
+ {
561
+ match: "(&&|\\|\\|)",
562
+ name: "keyword.operator.logical.swift"
563
+ },
564
+ {
565
+ match: "\\b(true|false)\\b",
566
+ name: "constant.language.boolean.swift"
567
+ },
568
+ {
569
+ captures: {
570
+ "1": {
571
+ name: "keyword.other.condition.swift"
572
+ },
573
+ "2": {
574
+ name: "punctuation.definition.parameters.begin.swift"
575
+ },
576
+ "3": {
577
+ name: "support.constant.platform.architecture.swift"
578
+ },
579
+ "4": {
580
+ name: "punctuation.definition.parameters.end.swift"
581
+ }
582
+ },
583
+ match: "\\b(arch)\\s*(\\()\\s*(?:(arm|arm64|powerpc64|powerpc64le|i386|x86_64|s390x)|\\w+)\\s*(\\))"
584
+ },
585
+ {
586
+ captures: {
587
+ "1": {
588
+ name: "keyword.other.condition.swift"
589
+ },
590
+ "2": {
591
+ name: "punctuation.definition.parameters.begin.swift"
592
+ },
593
+ "3": {
594
+ name: "support.constant.platform.os.swift"
595
+ },
596
+ "4": {
597
+ name: "punctuation.definition.parameters.end.swift"
598
+ }
599
+ },
600
+ match: "\\b(os)\\s*(\\()\\s*(?:(macOS|OSX|iOS|tvOS|watchOS|Android|Linux|FreeBSD|Windows|PS4)|\\w+)\\s*(\\))"
601
+ },
602
+ {
603
+ captures: {
604
+ "1": {
605
+ name: "keyword.other.condition.swift"
606
+ },
607
+ "2": {
608
+ name: "punctuation.definition.parameters.begin.swift"
609
+ },
610
+ "3": {
611
+ name: "entity.name.type.module.swift"
612
+ },
613
+ "4": {
614
+ name: "punctuation.definition.parameters.end.swift"
615
+ }
616
+ },
617
+ match: "\\b(canImport)\\s*(\\()([\\p{L}_][\\p{L}_\\p{N}\\p{M}]*)(\\))"
618
+ },
619
+ {
620
+ begin: "\\b(targetEnvironment)\\s*(\\()",
621
+ beginCaptures: {
622
+ "1": {
623
+ name: "keyword.other.condition.swift"
624
+ },
625
+ "2": {
626
+ name: "punctuation.definition.parameters.begin.swift"
627
+ }
628
+ },
629
+ end: "(\\))|$",
630
+ endCaptures: {
631
+ "1": {
632
+ name: "punctuation.definition.parameters.end.swift"
633
+ }
634
+ },
635
+ patterns: [
636
+ {
637
+ match: "\\b(simulator|UIKitForMac)\\b",
638
+ name: "support.constant.platform.environment.swift"
639
+ }
640
+ ]
641
+ },
642
+ {
643
+ begin: "\\b(swift|compiler)\\s*(\\()",
644
+ beginCaptures: {
645
+ "1": {
646
+ name: "keyword.other.condition.swift"
647
+ },
648
+ "2": {
649
+ name: "punctuation.definition.parameters.begin.swift"
650
+ }
651
+ },
652
+ end: "(\\))|$",
653
+ endCaptures: {
654
+ "1": {
655
+ name: "punctuation.definition.parameters.end.swift"
656
+ }
657
+ },
658
+ patterns: [
659
+ {
660
+ match: ">=|<",
661
+ name: "keyword.operator.comparison.swift"
662
+ },
663
+ {
664
+ match: "\\b[0-9]+(?:\\.[0-9]+)*\\b",
665
+ name: "constant.numeric.swift"
666
+ }
667
+ ]
668
+ }
669
+ ]
670
+ },
671
+ {
672
+ captures: {
673
+ "1": {
674
+ name: "punctuation.definition.preprocessor.swift"
675
+ },
676
+ "2": {
677
+ name: "keyword.control.preprocessor.conditional.swift"
678
+ },
679
+ "3": {
680
+ patterns: [
681
+ {
682
+ match: "\\S+",
683
+ name: "invalid.illegal.character-not-allowed-here.swift"
684
+ }
685
+ ]
686
+ }
687
+ },
688
+ match: "^\\s*(#)(else|endif)(.*?)(?=$|//|/\\*)",
689
+ name: "meta.preprocessor.conditional.swift"
690
+ },
691
+ {
692
+ captures: {
693
+ "1": {
694
+ name: "punctuation.definition.preprocessor.swift"
695
+ },
696
+ "2": {
697
+ name: "keyword.control.preprocessor.sourcelocation.swift"
698
+ },
699
+ "4": {
700
+ name: "punctuation.definition.parameters.begin.swift"
701
+ },
702
+ "5": {
703
+ patterns: [
704
+ {
705
+ begin: "(file)\\s*(:)\\s*(?=\")",
706
+ beginCaptures: {
707
+ "1": {
708
+ name: "support.variable.parameter.swift"
709
+ },
710
+ "2": {
711
+ name: "punctuation.separator.key-value.swift"
712
+ }
713
+ },
714
+ end: "(?!\\G)",
715
+ patterns: [
716
+ {
717
+ include: "#literals"
718
+ }
719
+ ]
720
+ },
721
+ {
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
+ match: "(line)\\s*(:)\\s*([0-9]+)"
734
+ },
735
+ {
736
+ match: ",",
737
+ name: "punctuation.separator.parameters.swift"
738
+ },
739
+ {
740
+ match: "\\S+",
741
+ name: "invalid.illegal.character-not-allowed-here.swift"
742
+ }
743
+ ]
744
+ },
745
+ "6": {
746
+ name: "punctuation.definition.parameters.begin.swift"
747
+ },
748
+ "7": {
749
+ patterns: [
750
+ {
751
+ match: "\\S+",
752
+ name: "invalid.illegal.character-not-allowed-here.swift"
753
+ }
754
+ ]
755
+ }
756
+ },
757
+ match: "^\\s*(#)(sourceLocation)((\\()([^)]*)(\\)))(.*?)(?=$|//|/\\*)",
758
+ name: "meta.preprocessor.sourcelocation.swift"
759
+ }
760
+ ]
761
+ },
762
+ declarations: {
763
+ patterns: [
764
+ {
765
+ include: "#function"
766
+ },
767
+ {
768
+ include: "#function-initializer"
769
+ },
770
+ {
771
+ include: "#typed-variable-declaration"
772
+ },
773
+ {
774
+ include: "#import"
775
+ },
776
+ {
777
+ include: "#operator"
778
+ },
779
+ {
780
+ include: "#precedencegroup"
781
+ },
782
+ {
783
+ include: "#protocol"
784
+ },
785
+ {
786
+ include: "#type"
787
+ },
788
+ {
789
+ include: "#extension"
790
+ },
791
+ {
792
+ include: "#typealias"
793
+ }
794
+ ],
795
+ repository: {
796
+ "available-types": {
797
+ patterns: [
798
+ {
799
+ include: "#comments"
800
+ },
801
+ {
802
+ include: "#builtin-types"
803
+ },
804
+ {
805
+ include: "#attributes"
806
+ },
807
+ {
808
+ match: "\\basync\\b",
809
+ name: "keyword.control.async.swift"
810
+ },
811
+ {
812
+ match: "\\b(?:throws|rethrows)\\b",
813
+ name: "keyword.control.exception.swift"
814
+ },
815
+ {
816
+ match: "\\bsome\\b",
817
+ name: "keyword.operator.type.opaque.swift"
818
+ },
819
+ {
820
+ match: "\\binout\\b",
821
+ name: "storage.modifier.swift"
822
+ },
823
+ {
824
+ match: "\\bSelf\\b",
825
+ name: "variable.language.swift"
826
+ },
827
+ {
828
+ captures: {
829
+ "1": {
830
+ name: "keyword.operator.type.function.swift"
831
+ }
832
+ },
833
+ match: "(?<![/=\\-+!*%<>&|\\^~.])(->)(?![/=\\-+!*%<>&|\\^~.])"
834
+ },
835
+ {
836
+ captures: {
837
+ "1": {
838
+ name: "keyword.operator.type.composition.swift"
839
+ }
840
+ },
841
+ comment: "Swift 3: A & B",
842
+ match: "(?<![/=\\-+!*%<>&|\\^~.])(&)(?![/=\\-+!*%<>&|\\^~.])"
843
+ },
844
+ {
845
+ match: "[?!]",
846
+ name: "keyword.operator.type.optional.swift"
847
+ },
848
+ {
849
+ match: "\\.\\.\\.",
850
+ name: "keyword.operator.function.variadic-parameter.swift"
851
+ },
852
+ {
853
+ comment: "Swift 2: protocol<A, B>",
854
+ match: "\\bprotocol\\b",
855
+ name: "keyword.operator.type.composition.swift"
856
+ },
857
+ {
858
+ match: "(?<=\\.)(?:Protocol|Type)\\b",
859
+ name: "keyword.operator.type.metatype.swift"
860
+ },
861
+ {
862
+ include: "#tuple-type"
863
+ },
864
+ {
865
+ include: "#collection-type"
866
+ },
867
+ {
868
+ include: "#generic-argument-clause"
869
+ }
870
+ ],
871
+ repository: {
872
+ "collection-type": {
873
+ begin: "\\[",
874
+ beginCaptures: {
875
+ "0": {
876
+ name: "punctuation.section.collection-type.begin.swift"
877
+ }
878
+ },
879
+ comment: "array and dictionary types [Value] and [Key: Value]",
880
+ end: "\\]|(?=[>){}])",
881
+ endCaptures: {
882
+ "0": {
883
+ name: "punctuation.section.collection-type.end.swift"
884
+ }
885
+ },
886
+ patterns: [
887
+ {
888
+ include: "#available-types"
889
+ },
890
+ {
891
+ begin: ":",
892
+ beginCaptures: {
893
+ "0": {
894
+ name: "punctuation.separator.key-value.swift"
895
+ }
896
+ },
897
+ end: "(?=\\]|[>){}])",
898
+ patterns: [
899
+ {
900
+ match: ":",
901
+ name: "invalid.illegal.extra-colon-in-dictionary-type.swift"
902
+ },
903
+ {
904
+ include: "#available-types"
905
+ }
906
+ ]
907
+ }
908
+ ]
909
+ },
910
+ "tuple-type": {
911
+ begin: "\\(",
912
+ beginCaptures: {
913
+ "0": {
914
+ name: "punctuation.section.tuple-type.begin.swift"
915
+ }
916
+ },
917
+ end: "\\)|(?=[>\\]{}])",
918
+ endCaptures: {
919
+ "0": {
920
+ name: "punctuation.section.tuple-type.end.swift"
921
+ }
922
+ },
923
+ patterns: [
924
+ {
925
+ include: "#available-types"
926
+ }
927
+ ]
928
+ }
929
+ }
930
+ },
931
+ extension: {
932
+ begin: "\\b(extension)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
933
+ beginCaptures: {
934
+ "1": {
935
+ name: "storage.type.$1.swift"
936
+ },
937
+ "2": {
938
+ name: "entity.name.type.swift",
939
+ patterns: [
940
+ {
941
+ include: "#available-types"
942
+ }
943
+ ]
944
+ },
945
+ "3": {
946
+ name: "punctuation.definition.identifier.swift"
947
+ },
948
+ "4": {
949
+ name: "punctuation.definition.identifier.swift"
950
+ }
951
+ },
952
+ end: "(?<=\\})",
953
+ name: "meta.definition.type.$1.swift",
954
+ patterns: [
955
+ {
956
+ include: "#comments"
957
+ },
958
+ {
959
+ comment: "SE-0143: Conditional Conformances",
960
+ include: "#generic-where-clause"
961
+ },
962
+ {
963
+ include: "#inheritance-clause"
964
+ },
965
+ {
966
+ begin: "\\{",
967
+ beginCaptures: {
968
+ "0": {
969
+ name: "punctuation.definition.type.begin.swift"
970
+ }
971
+ },
972
+ end: "\\}",
973
+ endCaptures: {
974
+ "0": {
975
+ name: "punctuation.definition.type.end.swift"
976
+ }
977
+ },
978
+ name: "meta.definition.type.body.swift",
979
+ patterns: [
980
+ {
981
+ include: "$self"
982
+ }
983
+ ]
984
+ }
985
+ ]
986
+ },
987
+ "function": {
988
+ begin: "(?x)\n\t\t\t\t\t\t\\b\n\t\t\t\t\t\t(func)\n\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)\n\t\t\t\t\t\t | (?:\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?<oph>\t\t\t\t\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\\g<oph>\n\t\t\t\t\t\t\t\t\t | (?<opc>\t\t\t\t\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t\t\t[\\x{0300}-\\x{036F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)*\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t | ( \\. ( \\g<oph> | \\g<opc> | \\. )+ )\t\t\t# Dot operators\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t(?=\\(|<)\n\t\t\t\t\t",
989
+ beginCaptures: {
990
+ "1": {
991
+ name: "storage.type.function.swift"
992
+ },
993
+ "2": {
994
+ name: "entity.name.function.swift"
995
+ },
996
+ "3": {
997
+ name: "punctuation.definition.identifier.swift"
998
+ },
999
+ "4": {
1000
+ name: "punctuation.definition.identifier.swift"
1001
+ }
1002
+ },
1003
+ end: "(?<=\\})|$(?# functions in protocol declarations or generated interfaces have no body)",
1004
+ name: "meta.definition.function.swift",
1005
+ patterns: [
1006
+ {
1007
+ include: "#comments"
1008
+ },
1009
+ {
1010
+ include: "#generic-parameter-clause"
1011
+ },
1012
+ {
1013
+ include: "#parameter-clause"
1014
+ },
1015
+ {
1016
+ include: "#function-result"
1017
+ },
1018
+ {
1019
+ include: "#async-throws"
1020
+ },
1021
+ {
1022
+ comment: "Swift 3: generic constraints after the parameters and return type",
1023
+ include: "#generic-where-clause"
1024
+ },
1025
+ {
1026
+ begin: "(\\{)",
1027
+ beginCaptures: {
1028
+ "1": {
1029
+ name: "punctuation.section.function.begin.swift"
1030
+ }
1031
+ },
1032
+ end: "(\\})",
1033
+ endCaptures: {
1034
+ "1": {
1035
+ name: "punctuation.section.function.end.swift"
1036
+ }
1037
+ },
1038
+ name: "meta.definition.function.body.swift",
1039
+ patterns: [
1040
+ {
1041
+ include: "$self"
1042
+ }
1043
+ ]
1044
+ }
1045
+ ]
1046
+ },
1047
+ "function-initializer": {
1048
+ begin: "(?<!\\.)\\b(init[?!]*(?# only one is valid, but we want the in⇥ snippet to produce something that looks good))\\s*(?=\\(|<)",
1049
+ beginCaptures: {
1050
+ "1": {
1051
+ name: "storage.type.function.swift",
1052
+ patterns: [
1053
+ {
1054
+ match: "(?<=[?!])[?!]+",
1055
+ name: "invalid.illegal.character-not-allowed-here.swift"
1056
+ }
1057
+ ]
1058
+ }
1059
+ },
1060
+ end: "(?<=\\})|$",
1061
+ name: "meta.definition.function.initializer.swift",
1062
+ patterns: [
1063
+ {
1064
+ include: "#comments"
1065
+ },
1066
+ {
1067
+ include: "#generic-parameter-clause"
1068
+ },
1069
+ {
1070
+ include: "#parameter-clause"
1071
+ },
1072
+ {
1073
+ include: "#async-throws"
1074
+ },
1075
+ {
1076
+ comment: "Swift 3: generic constraints after the parameters and return type",
1077
+ include: "#generic-where-clause"
1078
+ },
1079
+ {
1080
+ begin: "(\\{)",
1081
+ beginCaptures: {
1082
+ "1": {
1083
+ name: "punctuation.section.function.begin.swift"
1084
+ }
1085
+ },
1086
+ end: "(\\})",
1087
+ endCaptures: {
1088
+ "1": {
1089
+ name: "punctuation.section.function.end.swift"
1090
+ }
1091
+ },
1092
+ name: "meta.definition.function.body.swift",
1093
+ patterns: [
1094
+ {
1095
+ include: "$self"
1096
+ }
1097
+ ]
1098
+ }
1099
+ ]
1100
+ },
1101
+ "function-result": {
1102
+ begin: "(?<![/=\\-+!*%<>&|\\^~.])(->)(?![/=\\-+!*%<>&|\\^~.])\\s*",
1103
+ beginCaptures: {
1104
+ "1": {
1105
+ name: "keyword.operator.function-result.swift"
1106
+ }
1107
+ },
1108
+ end: "(?!\\G)(?=\\{|\\bwhere\\b|;)|$",
1109
+ name: "meta.function-result.swift",
1110
+ patterns: [
1111
+ {
1112
+ include: "#available-types"
1113
+ }
1114
+ ]
1115
+ },
1116
+ "generic-argument-clause": {
1117
+ begin: "<",
1118
+ beginCaptures: {
1119
+ "0": {
1120
+ name: "punctuation.separator.generic-argument-clause.begin.swift"
1121
+ }
1122
+ },
1123
+ end: ">|(?=[)\\]{}])",
1124
+ endCaptures: {
1125
+ "0": {
1126
+ name: "punctuation.separator.generic-argument-clause.end.swift"
1127
+ }
1128
+ },
1129
+ name: "meta.generic-argument-clause.swift",
1130
+ patterns: [
1131
+ {
1132
+ include: "#available-types"
1133
+ }
1134
+ ]
1135
+ },
1136
+ "generic-parameter-clause": {
1137
+ begin: "<",
1138
+ beginCaptures: {
1139
+ "0": {
1140
+ name: "punctuation.separator.generic-parameter-clause.begin.swift"
1141
+ }
1142
+ },
1143
+ 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.)",
1144
+ endCaptures: {
1145
+ "0": {
1146
+ name: "punctuation.separator.generic-parameter-clause.end.swift"
1147
+ }
1148
+ },
1149
+ name: "meta.generic-parameter-clause.swift",
1150
+ patterns: [
1151
+ {
1152
+ include: "#comments"
1153
+ },
1154
+ {
1155
+ comment: "Swift 2: constraints inside the generic param list",
1156
+ include: "#generic-where-clause"
1157
+ },
1158
+ {
1159
+ captures: {
1160
+ "1": {
1161
+ name: "variable.language.generic-parameter.swift"
1162
+ }
1163
+ },
1164
+ match: "\\b((?!\\d)\\w[\\w\\d]*)\\b"
1165
+ },
1166
+ {
1167
+ match: ",",
1168
+ name: "punctuation.separator.generic-parameters.swift"
1169
+ },
1170
+ {
1171
+ begin: "(:)\\s*",
1172
+ beginCaptures: {
1173
+ "1": {
1174
+ name: "punctuation.separator.generic-parameter-constraint.swift"
1175
+ }
1176
+ },
1177
+ end: "(?=[,>]|(?!\\G)\\bwhere\\b)",
1178
+ name: "meta.generic-parameter-constraint.swift",
1179
+ patterns: [
1180
+ {
1181
+ begin: "\\G",
1182
+ end: "(?=[,>]|(?!\\G)\\bwhere\\b)",
1183
+ name: "entity.other.inherited-class.swift",
1184
+ patterns: [
1185
+ {
1186
+ include: "#type-identifier"
1187
+ }
1188
+ ]
1189
+ }
1190
+ ]
1191
+ }
1192
+ ]
1193
+ },
1194
+ "generic-where-clause": {
1195
+ begin: "\\b(where)\\b\\s*",
1196
+ beginCaptures: {
1197
+ "1": {
1198
+ name: "keyword.other.generic-constraint-introducer.swift"
1199
+ }
1200
+ },
1201
+ end: "(?!\\G)$|(?=[>{};\\n]|//|/\\*)",
1202
+ name: "meta.generic-where-clause.swift",
1203
+ patterns: [
1204
+ {
1205
+ include: "#comments"
1206
+ },
1207
+ {
1208
+ include: "#requirement-list"
1209
+ }
1210
+ ],
1211
+ repository: {
1212
+ "requirement-list": {
1213
+ begin: "\\G|,\\s*",
1214
+ end: "(?=[,>{};\\n]|//|/\\*)",
1215
+ patterns: [
1216
+ {
1217
+ include: "#comments"
1218
+ },
1219
+ {
1220
+ include: "#constraint"
1221
+ },
1222
+ {
1223
+ include: "#available-types"
1224
+ },
1225
+ {
1226
+ begin: "(?<![/=\\-+!*%<>&|\\^~.])(==)(?![/=\\-+!*%<>&|\\^~.])",
1227
+ beginCaptures: {
1228
+ "1": {
1229
+ name: "keyword.operator.generic-constraint.same-type.swift"
1230
+ }
1231
+ },
1232
+ end: "(?=\\s*[,>{};\\n]|//|/\\*)",
1233
+ name: "meta.generic-where-clause.same-type-requirement.swift",
1234
+ patterns: [
1235
+ {
1236
+ include: "#available-types"
1237
+ }
1238
+ ]
1239
+ },
1240
+ {
1241
+ begin: "(?<![/=\\-+!*%<>&|\\^~.])(:)(?![/=\\-+!*%<>&|\\^~.])",
1242
+ beginCaptures: {
1243
+ "1": {
1244
+ name: "keyword.operator.generic-constraint.conforms-to.swift"
1245
+ }
1246
+ },
1247
+ end: "(?=\\s*[,>{};\\n]|//|/\\*)",
1248
+ name: "meta.generic-where-clause.conformance-requirement.swift",
1249
+ patterns: [
1250
+ {
1251
+ begin: "\\G\\s*",
1252
+ contentName: "entity.other.inherited-class.swift",
1253
+ end: "(?=\\s*[,>{};\\n]|//|/\\*)",
1254
+ patterns: [
1255
+ {
1256
+ include: "#available-types"
1257
+ }
1258
+ ]
1259
+ }
1260
+ ]
1261
+ }
1262
+ ]
1263
+ }
1264
+ }
1265
+ },
1266
+ "import": {
1267
+ begin: "(?<!\\.)\\b(import)\\s+",
1268
+ beginCaptures: {
1269
+ "1": {
1270
+ name: "keyword.control.import.swift"
1271
+ }
1272
+ },
1273
+ end: "(;)|$\\n?|(?=//|/\\*)",
1274
+ endCaptures: {
1275
+ "1": {
1276
+ name: "punctuation.terminator.statement.swift"
1277
+ }
1278
+ },
1279
+ name: "meta.import.swift",
1280
+ patterns: [
1281
+ {
1282
+ begin: "\\G(?!;|$|//|/\\*)(?:(typealias|struct|class|actor|enum|protocol|var|func)\\s+)?",
1283
+ beginCaptures: {
1284
+ "1": {
1285
+ name: "storage.modifier.swift"
1286
+ }
1287
+ },
1288
+ end: "(?=;|$|//|/\\*)",
1289
+ patterns: [
1290
+ {
1291
+ captures: {
1292
+ "1": {
1293
+ name: "punctuation.definition.identifier.swift"
1294
+ },
1295
+ "2": {
1296
+ name: "punctuation.definition.identifier.swift"
1297
+ }
1298
+ },
1299
+ match: "(?x)\n\t\t\t\t\t\t\t\t\t\t(?<=\\G|\\.)\n\t\t\t\t\t\t\t\t\t\t(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)\n\t\t\t\t\t\t\t\t\t",
1300
+ name: "entity.name.type.swift"
1301
+ },
1302
+ {
1303
+ match: "(?x)\n\t\t\t\t\t\t\t\t\t\t(?<=\\G|\\.)\n\t\t\t\t\t\t\t\t\t\t\\$[0-9]+\n\t\t\t\t\t\t\t\t\t",
1304
+ name: "entity.name.type.swift"
1305
+ },
1306
+ {
1307
+ captures: {
1308
+ "1": {
1309
+ patterns: [
1310
+ {
1311
+ match: "\\.",
1312
+ name: "invalid.illegal.dot-not-allowed-here.swift"
1313
+ }
1314
+ ]
1315
+ }
1316
+ },
1317
+ match: "(?x)\n\t\t\t\t\t\t\t\t\t\t(?<=\\G|\\.)\n\t\t\t\t\t\t\t\t\t\t(?:\n\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t(?<oph>\t\t\t\t\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\\g<oph>\n\t\t\t\t\t\t\t\t\t\t\t\t | (?<opc>\t\t\t\t\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t[\\x{0300}-\\x{036F}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t)*\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t | ( \\. ( \\g<oph> | \\g<opc> | \\. )+ )\t\t\t# Dot operators\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t(?=\\.|;|$|//|/\\*|\\s)\n\t\t\t\t\t\t\t\t\t",
1318
+ name: "entity.name.type.swift"
1319
+ },
1320
+ {
1321
+ match: "\\.",
1322
+ name: "punctuation.separator.import.swift"
1323
+ },
1324
+ {
1325
+ begin: "(?!\\s*(;|$|//|/\\*))",
1326
+ end: "(?=\\s*(;|$|//|/\\*))",
1327
+ name: "invalid.illegal.character-not-allowed-here.swift"
1328
+ }
1329
+ ]
1330
+ }
1331
+ ]
1332
+ },
1333
+ "inheritance-clause": {
1334
+ begin: "(:)(?=\\s*\\{)|(:)\\s*",
1335
+ beginCaptures: {
1336
+ "1": {
1337
+ name: "invalid.illegal.empty-inheritance-clause.swift"
1338
+ },
1339
+ "2": {
1340
+ name: "punctuation.separator.inheritance-clause.swift"
1341
+ }
1342
+ },
1343
+ end: "(?!\\G)$|(?=[={}]|(?!\\G)\\bwhere\\b)",
1344
+ name: "meta.inheritance-clause.swift",
1345
+ patterns: [
1346
+ {
1347
+ begin: "\\bclass\\b",
1348
+ beginCaptures: {
1349
+ "0": {
1350
+ name: "storage.type.class.swift"
1351
+ }
1352
+ },
1353
+ end: "(?=[={}]|(?!\\G)\\bwhere\\b)",
1354
+ patterns: [
1355
+ {
1356
+ include: "#comments"
1357
+ },
1358
+ {
1359
+ include: "#more-types"
1360
+ }
1361
+ ]
1362
+ },
1363
+ {
1364
+ begin: "\\G",
1365
+ end: "(?!\\G)$|(?=[={}]|(?!\\G)\\bwhere\\b)",
1366
+ patterns: [
1367
+ {
1368
+ include: "#comments"
1369
+ },
1370
+ {
1371
+ include: "#inherited-type"
1372
+ },
1373
+ {
1374
+ include: "#more-types"
1375
+ }
1376
+ ]
1377
+ }
1378
+ ],
1379
+ repository: {
1380
+ "inherited-type": {
1381
+ begin: "(?=[`\\p{L}_])",
1382
+ end: "(?!\\G)",
1383
+ name: "entity.other.inherited-class.swift",
1384
+ patterns: [
1385
+ {
1386
+ include: "#type-identifier"
1387
+ }
1388
+ ]
1389
+ },
1390
+ "more-types": {
1391
+ begin: ",\\s*",
1392
+ end: "(?!\\G)(?!//|/\\*)|(?=[,={}]|(?!\\G)\\bwhere\\b)",
1393
+ name: "meta.inheritance-list.more-types",
1394
+ patterns: [
1395
+ {
1396
+ include: "#comments"
1397
+ },
1398
+ {
1399
+ include: "#inherited-type"
1400
+ },
1401
+ {
1402
+ include: "#more-types"
1403
+ }
1404
+ ]
1405
+ }
1406
+ }
1407
+ },
1408
+ operator: {
1409
+ begin: "(?x)\n\t\t\t\t\t\t(?:\n\t\t\t\t\t\t\t\\b(prefix|infix|postfix)\n\t\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t)?\n\t\t\t\t\t\t\\b\n\t\t\t\t\t\t(operator)\n\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t(?<oph>\t\t\t\t\t\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\n\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\\g<oph>\n\t\t\t\t\t\t\t\t | \\.\t\t\t\t\t\t\t\t\t# Invalid dot\n\t\t\t\t\t\t\t\t | (?<opc>\t\t\t\t\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t\t[\\x{0300}-\\x{036F}]\n\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)*+\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t | ( \\. ( \\g<oph> | \\g<opc> | \\. )++ )\t\t\t# Dot operators\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\\s*\n\t\t\t\t\t",
1410
+ beginCaptures: {
1411
+ "1": {
1412
+ name: "storage.modifier.swift"
1413
+ },
1414
+ "2": {
1415
+ name: "storage.type.function.operator.swift"
1416
+ },
1417
+ "3": {
1418
+ name: "entity.name.function.operator.swift"
1419
+ },
1420
+ "4": {
1421
+ patterns: [
1422
+ {
1423
+ match: "\\.",
1424
+ name: "invalid.illegal.dot-not-allowed-here.swift"
1425
+ }
1426
+ ]
1427
+ }
1428
+ },
1429
+ end: "(;)|$\\n?|(?=//|/\\*)",
1430
+ endCaptures: {
1431
+ "1": {
1432
+ name: "punctuation.terminator.statement.swift"
1433
+ }
1434
+ },
1435
+ name: "meta.definition.operator.swift",
1436
+ patterns: [
1437
+ {
1438
+ include: "#swift2"
1439
+ },
1440
+ {
1441
+ include: "#swift3"
1442
+ },
1443
+ {
1444
+ match: "((?!$|;|//|/\\*)\\S)+",
1445
+ name: "invalid.illegal.character-not-allowed-here.swift"
1446
+ }
1447
+ ],
1448
+ repository: {
1449
+ swift2: {
1450
+ begin: "\\G(\\{)",
1451
+ beginCaptures: {
1452
+ "1": {
1453
+ name: "punctuation.definition.operator.begin.swift"
1454
+ }
1455
+ },
1456
+ end: "(\\})",
1457
+ endCaptures: {
1458
+ "1": {
1459
+ name: "punctuation.definition.operator.end.swift"
1460
+ }
1461
+ },
1462
+ patterns: [
1463
+ {
1464
+ include: "#comments"
1465
+ },
1466
+ {
1467
+ captures: {
1468
+ "1": {
1469
+ name: "storage.modifier.swift"
1470
+ },
1471
+ "2": {
1472
+ name: "keyword.other.operator.associativity.swift"
1473
+ }
1474
+ },
1475
+ match: "\\b(associativity)\\s+(left|right)\\b"
1476
+ },
1477
+ {
1478
+ captures: {
1479
+ "1": {
1480
+ name: "storage.modifier.swift"
1481
+ },
1482
+ "2": {
1483
+ name: "constant.numeric.integer.swift"
1484
+ }
1485
+ },
1486
+ match: "\\b(precedence)\\s+([0-9]+)\\b"
1487
+ },
1488
+ {
1489
+ captures: {
1490
+ "1": {
1491
+ name: "storage.modifier.swift"
1492
+ }
1493
+ },
1494
+ match: "\\b(assignment)\\b"
1495
+ }
1496
+ ]
1497
+ },
1498
+ swift3: {
1499
+ captures: {
1500
+ "2": {
1501
+ name: "entity.other.inherited-class.swift",
1502
+ patterns: [
1503
+ {
1504
+ include: "#types-precedencegroup"
1505
+ }
1506
+ ]
1507
+ },
1508
+ "3": {
1509
+ name: "punctuation.definition.identifier.swift"
1510
+ },
1511
+ "4": {
1512
+ name: "punctuation.definition.identifier.swift"
1513
+ }
1514
+ },
1515
+ match: "\\G(:)\\s*((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))"
1516
+ }
1517
+ }
1518
+ },
1519
+ "parameter-clause": {
1520
+ begin: "(\\()",
1521
+ beginCaptures: {
1522
+ "1": {
1523
+ name: "punctuation.definition.parameters.begin.swift"
1524
+ }
1525
+ },
1526
+ end: "(\\))(?:\\s*(async)\\b)?",
1527
+ endCaptures: {
1528
+ "1": {
1529
+ name: "punctuation.definition.parameters.end.swift"
1530
+ },
1531
+ "2": {
1532
+ name: "keyword.control.async.swift"
1533
+ }
1534
+ },
1535
+ name: "meta.parameter-clause.swift",
1536
+ patterns: [
1537
+ {
1538
+ include: "#parameter-list"
1539
+ }
1540
+ ]
1541
+ },
1542
+ "parameter-list": {
1543
+ patterns: [
1544
+ {
1545
+ captures: {
1546
+ "1": {
1547
+ name: "entity.name.function.swift"
1548
+ },
1549
+ "2": {
1550
+ name: "punctuation.definition.identifier.swift"
1551
+ },
1552
+ "3": {
1553
+ name: "punctuation.definition.identifier.swift"
1554
+ },
1555
+ "4": {
1556
+ name: "variable.parameter.function.swift"
1557
+ },
1558
+ "5": {
1559
+ name: "punctuation.definition.identifier.swift"
1560
+ },
1561
+ "6": {
1562
+ name: "punctuation.definition.identifier.swift"
1563
+ }
1564
+ },
1565
+ comment: "External parameter labels are considered part of the function name",
1566
+ 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*:)"
1567
+ },
1568
+ {
1569
+ captures: {
1570
+ "1": {
1571
+ name: "variable.parameter.function.swift"
1572
+ },
1573
+ "2": {
1574
+ name: "entity.name.function.swift"
1575
+ },
1576
+ "3": {
1577
+ name: "punctuation.definition.identifier.swift"
1578
+ },
1579
+ "4": {
1580
+ name: "punctuation.definition.identifier.swift"
1581
+ }
1582
+ },
1583
+ comment: "If no external label is given, the name is both the external label and the internal variable name",
1584
+ match: "(((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)))(?=\\s*:)"
1585
+ },
1586
+ {
1587
+ begin: ":\\s*(?!\\s)",
1588
+ end: "(?=[,)])",
1589
+ patterns: [
1590
+ {
1591
+ include: "#available-types"
1592
+ },
1593
+ {
1594
+ match: ":",
1595
+ name: "invalid.illegal.extra-colon-in-parameter-list.swift"
1596
+ },
1597
+ {
1598
+ begin: "=",
1599
+ beginCaptures: {
1600
+ "0": {
1601
+ name: "keyword.operator.assignment.swift"
1602
+ }
1603
+ },
1604
+ comment: "a parameter's default value",
1605
+ end: "(?=[,)])",
1606
+ patterns: [
1607
+ {
1608
+ include: "#expressions"
1609
+ }
1610
+ ]
1611
+ }
1612
+ ]
1613
+ }
1614
+ ]
1615
+ },
1616
+ precedencegroup: {
1617
+ begin: "\\b(precedencegroup)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*(?=\\{)",
1618
+ beginCaptures: {
1619
+ "1": {
1620
+ name: "storage.type.precedencegroup.swift"
1621
+ },
1622
+ "2": {
1623
+ name: "entity.name.type.precedencegroup.swift"
1624
+ },
1625
+ "3": {
1626
+ name: "punctuation.definition.identifier.swift"
1627
+ },
1628
+ "4": {
1629
+ name: "punctuation.definition.identifier.swift"
1630
+ }
1631
+ },
1632
+ end: "(?!\\G)",
1633
+ name: "meta.definition.precedencegroup.swift",
1634
+ patterns: [
1635
+ {
1636
+ begin: "\\{",
1637
+ beginCaptures: {
1638
+ "0": {
1639
+ name: "punctuation.definition.precedencegroup.begin.swift"
1640
+ }
1641
+ },
1642
+ end: "\\}",
1643
+ endCaptures: {
1644
+ "0": {
1645
+ name: "punctuation.definition.precedencegroup.end.swift"
1646
+ }
1647
+ },
1648
+ patterns: [
1649
+ {
1650
+ include: "#comments"
1651
+ },
1652
+ {
1653
+ captures: {
1654
+ "1": {
1655
+ name: "storage.modifier.swift"
1656
+ },
1657
+ "2": {
1658
+ name: "entity.other.inherited-class.swift",
1659
+ patterns: [
1660
+ {
1661
+ include: "#types-precedencegroup"
1662
+ }
1663
+ ]
1664
+ },
1665
+ "3": {
1666
+ name: "punctuation.definition.identifier.swift"
1667
+ },
1668
+ "4": {
1669
+ name: "punctuation.definition.identifier.swift"
1670
+ }
1671
+ },
1672
+ match: "\\b(higherThan|lowerThan)\\s*:\\s*((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))"
1673
+ },
1674
+ {
1675
+ captures: {
1676
+ "1": {
1677
+ name: "storage.modifier.swift"
1678
+ },
1679
+ "2": {
1680
+ name: "keyword.other.operator.associativity.swift"
1681
+ }
1682
+ },
1683
+ match: "\\b(associativity)\\b(?:\\s*:\\s*(right|left|none)\\b)?"
1684
+ },
1685
+ {
1686
+ captures: {
1687
+ "1": {
1688
+ name: "storage.modifier.swift"
1689
+ },
1690
+ "2": {
1691
+ name: "constant.language.boolean.swift"
1692
+ }
1693
+ },
1694
+ match: "\\b(assignment)\\b(?:\\s*:\\s*(true|false)\\b)?"
1695
+ }
1696
+ ]
1697
+ }
1698
+ ]
1699
+ },
1700
+ protocol: {
1701
+ begin: "\\b(protocol)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
1702
+ beginCaptures: {
1703
+ "1": {
1704
+ name: "storage.type.$1.swift"
1705
+ },
1706
+ "2": {
1707
+ name: "entity.name.type.$1.swift"
1708
+ },
1709
+ "3": {
1710
+ name: "punctuation.definition.identifier.swift"
1711
+ },
1712
+ "4": {
1713
+ name: "punctuation.definition.identifier.swift"
1714
+ }
1715
+ },
1716
+ end: "(?<=\\})",
1717
+ name: "meta.definition.type.protocol.swift",
1718
+ patterns: [
1719
+ {
1720
+ include: "#comments"
1721
+ },
1722
+ {
1723
+ include: "#inheritance-clause"
1724
+ },
1725
+ {
1726
+ comment: "SE-0142: Permit where clauses to constrain associated types",
1727
+ include: "#generic-where-clause"
1728
+ },
1729
+ {
1730
+ begin: "\\{",
1731
+ beginCaptures: {
1732
+ "0": {
1733
+ name: "punctuation.definition.type.begin.swift"
1734
+ }
1735
+ },
1736
+ end: "\\}",
1737
+ endCaptures: {
1738
+ "0": {
1739
+ name: "punctuation.definition.type.end.swift"
1740
+ }
1741
+ },
1742
+ name: "meta.definition.type.body.swift",
1743
+ patterns: [
1744
+ {
1745
+ include: "#protocol-method"
1746
+ },
1747
+ {
1748
+ include: "#protocol-initializer"
1749
+ },
1750
+ {
1751
+ include: "#associated-type"
1752
+ },
1753
+ {
1754
+ include: "$self"
1755
+ }
1756
+ ]
1757
+ }
1758
+ ],
1759
+ repository: {
1760
+ "associated-type": {
1761
+ begin: "\\b(associatedtype)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
1762
+ beginCaptures: {
1763
+ "1": {
1764
+ name: "keyword.other.declaration-specifier.swift"
1765
+ },
1766
+ "2": {
1767
+ name: "variable.language.associatedtype.swift"
1768
+ },
1769
+ "3": {
1770
+ name: "punctuation.definition.identifier.swift"
1771
+ },
1772
+ "4": {
1773
+ name: "punctuation.definition.identifier.swift"
1774
+ }
1775
+ },
1776
+ end: "(?!\\G)$|(?=[;}]|$)",
1777
+ name: "meta.definition.associatedtype.swift",
1778
+ patterns: [
1779
+ {
1780
+ include: "#inheritance-clause"
1781
+ },
1782
+ {
1783
+ comment: "SE-0142: Permit where clauses to constrain associated types",
1784
+ include: "#generic-where-clause"
1785
+ },
1786
+ {
1787
+ include: "#typealias-assignment"
1788
+ }
1789
+ ]
1790
+ },
1791
+ "protocol-initializer": {
1792
+ begin: "(?<!\\.)\\b(init[?!]*(?# only one is valid, but we want the in⇥ snippet to produce something that looks good))\\s*(?=\\(|<)",
1793
+ beginCaptures: {
1794
+ "1": {
1795
+ name: "storage.type.function.swift",
1796
+ patterns: [
1797
+ {
1798
+ match: "(?<=[?!])[?!]+",
1799
+ name: "invalid.illegal.character-not-allowed-here.swift"
1800
+ }
1801
+ ]
1802
+ }
1803
+ },
1804
+ end: "$|(?=;|//|/\\*|\\})",
1805
+ name: "meta.definition.function.initializer.swift",
1806
+ patterns: [
1807
+ {
1808
+ include: "#comments"
1809
+ },
1810
+ {
1811
+ include: "#generic-parameter-clause"
1812
+ },
1813
+ {
1814
+ include: "#parameter-clause"
1815
+ },
1816
+ {
1817
+ include: "#async-throws"
1818
+ },
1819
+ {
1820
+ comment: "Swift 3: generic constraints after the parameters and return type",
1821
+ include: "#generic-where-clause"
1822
+ },
1823
+ {
1824
+ begin: "\\{",
1825
+ beginCaptures: {
1826
+ "0": {
1827
+ name: "punctuation.section.function.begin.swift"
1828
+ }
1829
+ },
1830
+ end: "\\}",
1831
+ endCaptures: {
1832
+ "0": {
1833
+ name: "punctuation.section.function.end.swift"
1834
+ }
1835
+ },
1836
+ name: "invalid.illegal.function-body-not-allowed-in-protocol.swift",
1837
+ patterns: [
1838
+ {
1839
+ include: "$self"
1840
+ }
1841
+ ]
1842
+ }
1843
+ ]
1844
+ },
1845
+ "protocol-method": {
1846
+ begin: "(?x)\n\t\t\t\t\t\t\t\t\\b\n\t\t\t\t\t\t\t\t(func)\n\t\t\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)\n\t\t \t\t\t\t\t\t | (?:\n\t\t \t\t\t\t\t\t\t\t(\n\t\t \t\t\t\t\t\t\t\t\t(?<oph>\t\t\t\t\t\t\t\t# operator-head\n\t\t \t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t \t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t \t\t\t\t\t\t\t\t\t)\n\t\t \t\t\t\t\t\t\t\t\t(\n\t\t \t\t\t\t\t\t\t\t\t\t\\g<oph>\n\t\t \t\t\t\t\t\t\t\t\t | (?<opc>\t\t\t\t\t\t\t\t# operator-character\n\t\t \t\t\t\t\t\t\t\t\t\t\t[\\x{0300}-\\x{036F}]\n\t\t \t\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t \t\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t \t\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t \t\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t \t\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t \t\t\t\t\t\t\t\t\t\t)\n\t\t \t\t\t\t\t\t\t\t\t)*\n\t\t \t\t\t\t\t\t\t\t)\n\t\t \t\t\t\t\t\t\t | ( \\. ( \\g<oph> | \\g<opc> | \\. )+ )\t\t\t# Dot operators\n\t\t \t\t\t\t\t\t\t)\n\t\t \t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t\t\t(?=\\(|<)\n\t\t\t\t\t\t\t",
1847
+ beginCaptures: {
1848
+ "1": {
1849
+ name: "storage.type.function.swift"
1850
+ },
1851
+ "2": {
1852
+ name: "entity.name.function.swift"
1853
+ },
1854
+ "3": {
1855
+ name: "punctuation.definition.identifier.swift"
1856
+ },
1857
+ "4": {
1858
+ name: "punctuation.definition.identifier.swift"
1859
+ }
1860
+ },
1861
+ end: "$|(?=;|//|/\\*|\\})",
1862
+ name: "meta.definition.function.swift",
1863
+ patterns: [
1864
+ {
1865
+ include: "#comments"
1866
+ },
1867
+ {
1868
+ include: "#generic-parameter-clause"
1869
+ },
1870
+ {
1871
+ include: "#parameter-clause"
1872
+ },
1873
+ {
1874
+ include: "#function-result"
1875
+ },
1876
+ {
1877
+ include: "#async-throws"
1878
+ },
1879
+ {
1880
+ comment: "Swift 3: generic constraints after the parameters and return type",
1881
+ include: "#generic-where-clause"
1882
+ },
1883
+ {
1884
+ begin: "\\{",
1885
+ beginCaptures: {
1886
+ "0": {
1887
+ name: "punctuation.section.function.begin.swift"
1888
+ }
1889
+ },
1890
+ end: "\\}",
1891
+ endCaptures: {
1892
+ "0": {
1893
+ name: "punctuation.section.function.end.swift"
1894
+ }
1895
+ },
1896
+ name: "invalid.illegal.function-body-not-allowed-in-protocol.swift",
1897
+ patterns: [
1898
+ {
1899
+ include: "$self"
1900
+ }
1901
+ ]
1902
+ }
1903
+ ]
1904
+ }
1905
+ }
1906
+ },
1907
+ type: {
1908
+ patterns: [
1909
+ {
1910
+ begin: "\\b(class(?!\\s+(?:func|var|let)\\b)|struct|actor)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
1911
+ beginCaptures: {
1912
+ "1": {
1913
+ name: "storage.type.$1.swift"
1914
+ },
1915
+ "2": {
1916
+ name: "entity.name.type.$1.swift"
1917
+ },
1918
+ "3": {
1919
+ name: "punctuation.definition.identifier.swift"
1920
+ },
1921
+ "4": {
1922
+ name: "punctuation.definition.identifier.swift"
1923
+ }
1924
+ },
1925
+ end: "(?<=\\})",
1926
+ name: "meta.definition.type.$1.swift",
1927
+ patterns: [
1928
+ {
1929
+ include: "#comments"
1930
+ },
1931
+ {
1932
+ include: "#generic-parameter-clause"
1933
+ },
1934
+ {
1935
+ comment: "Swift 3: generic constraints after the generic param list",
1936
+ include: "#generic-where-clause"
1937
+ },
1938
+ {
1939
+ include: "#inheritance-clause"
1940
+ },
1941
+ {
1942
+ begin: "\\{",
1943
+ beginCaptures: {
1944
+ "0": {
1945
+ name: "punctuation.definition.type.begin.swift"
1946
+ }
1947
+ },
1948
+ end: "\\}",
1949
+ endCaptures: {
1950
+ "0": {
1951
+ name: "punctuation.definition.type.end.swift"
1952
+ }
1953
+ },
1954
+ name: "meta.definition.type.body.swift",
1955
+ patterns: [
1956
+ {
1957
+ include: "$self"
1958
+ }
1959
+ ]
1960
+ }
1961
+ ]
1962
+ },
1963
+ {
1964
+ include: "#type-enum"
1965
+ }
1966
+ ]
1967
+ },
1968
+ "type-enum": {
1969
+ begin: "\\b(enum)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))",
1970
+ beginCaptures: {
1971
+ "1": {
1972
+ name: "storage.type.$1.swift"
1973
+ },
1974
+ "2": {
1975
+ name: "entity.name.type.$1.swift"
1976
+ },
1977
+ "3": {
1978
+ name: "punctuation.definition.identifier.swift"
1979
+ },
1980
+ "4": {
1981
+ name: "punctuation.definition.identifier.swift"
1982
+ }
1983
+ },
1984
+ end: "(?<=\\})",
1985
+ name: "meta.definition.type.$1.swift",
1986
+ patterns: [
1987
+ {
1988
+ include: "#comments"
1989
+ },
1990
+ {
1991
+ include: "#generic-parameter-clause"
1992
+ },
1993
+ {
1994
+ comment: "Swift 3: generic constraints after the generic param list",
1995
+ include: "#generic-where-clause"
1996
+ },
1997
+ {
1998
+ include: "#inheritance-clause"
1999
+ },
2000
+ {
2001
+ begin: "\\{",
2002
+ beginCaptures: {
2003
+ "0": {
2004
+ name: "punctuation.definition.type.begin.swift"
2005
+ }
2006
+ },
2007
+ end: "\\}",
2008
+ endCaptures: {
2009
+ "0": {
2010
+ name: "punctuation.definition.type.end.swift"
2011
+ }
2012
+ },
2013
+ name: "meta.definition.type.body.swift",
2014
+ patterns: [
2015
+ {
2016
+ include: "#enum-case-clause"
2017
+ },
2018
+ {
2019
+ include: "$self"
2020
+ }
2021
+ ]
2022
+ }
2023
+ ],
2024
+ repository: {
2025
+ "associated-values": {
2026
+ begin: "\\G\\(",
2027
+ beginCaptures: {
2028
+ "0": {
2029
+ name: "punctuation.definition.parameters.begin.swift"
2030
+ }
2031
+ },
2032
+ end: "\\)",
2033
+ endCaptures: {
2034
+ "0": {
2035
+ name: "punctuation.definition.parameters.end.swift"
2036
+ }
2037
+ },
2038
+ patterns: [
2039
+ {
2040
+ include: "#comments"
2041
+ },
2042
+ {
2043
+ begin: "(?x)\n\t\t\t\t\t\t\t\t\t\t(?:(_)|((?<q1>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k<q1>))\n\t\t\t\t\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t\t\t\t\t(((?<q2>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k<q2>))\n\t\t\t\t\t\t\t\t\t\t\\s*(:)",
2044
+ beginCaptures: {
2045
+ "1": {
2046
+ name: "entity.name.function.swift"
2047
+ },
2048
+ "2": {
2049
+ name: "invalid.illegal.distinct-labels-not-allowed.swift"
2050
+ },
2051
+ "5": {
2052
+ name: "variable.parameter.function.swift"
2053
+ },
2054
+ "7": {
2055
+ name: "punctuation.separator.argument-label.swift"
2056
+ }
2057
+ },
2058
+ end: "(?=[,)\\]])",
2059
+ patterns: [
2060
+ {
2061
+ include: "#available-types"
2062
+ }
2063
+ ]
2064
+ },
2065
+ {
2066
+ begin: "(((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*\\k<q>))\\s*(:)",
2067
+ beginCaptures: {
2068
+ "1": {
2069
+ name: "entity.name.function.swift"
2070
+ },
2071
+ "2": {
2072
+ name: "variable.parameter.function.swift"
2073
+ },
2074
+ "4": {
2075
+ name: "punctuation.separator.argument-label.swift"
2076
+ }
2077
+ },
2078
+ end: "(?=[,)\\]])",
2079
+ patterns: [
2080
+ {
2081
+ include: "#available-types"
2082
+ }
2083
+ ]
2084
+ },
2085
+ {
2086
+ begin: "(?![,)\\]])(?=\\S)",
2087
+ comment: "an element without a label (i.e. anything else)",
2088
+ end: "(?=[,)\\]])",
2089
+ patterns: [
2090
+ {
2091
+ include: "#available-types"
2092
+ },
2093
+ {
2094
+ match: ":",
2095
+ name: "invalid.illegal.extra-colon-in-parameter-list.swift"
2096
+ }
2097
+ ]
2098
+ }
2099
+ ]
2100
+ },
2101
+ "enum-case": {
2102
+ begin: "(?x)((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
2103
+ beginCaptures: {
2104
+ "1": {
2105
+ name: "constant.other.swift"
2106
+ }
2107
+ },
2108
+ end: "(?<=\\))|(?![=(])",
2109
+ patterns: [
2110
+ {
2111
+ include: "#comments"
2112
+ },
2113
+ {
2114
+ include: "#associated-values"
2115
+ },
2116
+ {
2117
+ include: "#raw-value-assignment"
2118
+ }
2119
+ ]
2120
+ },
2121
+ "enum-case-clause": {
2122
+ begin: "\\b(case)\\b\\s*",
2123
+ beginCaptures: {
2124
+ "1": {
2125
+ name: "storage.type.enum.case.swift"
2126
+ }
2127
+ },
2128
+ end: "(?=[;}])|(?!\\G)(?!//|/\\*)(?=[^\\s,])",
2129
+ patterns: [
2130
+ {
2131
+ include: "#comments"
2132
+ },
2133
+ {
2134
+ include: "#enum-case"
2135
+ },
2136
+ {
2137
+ include: "#more-cases"
2138
+ }
2139
+ ]
2140
+ },
2141
+ "more-cases": {
2142
+ begin: ",\\s*",
2143
+ end: "(?!\\G)(?!//|/\\*)(?=[;}]|[^\\s,])",
2144
+ name: "meta.enum-case.more-cases",
2145
+ patterns: [
2146
+ {
2147
+ include: "#comments"
2148
+ },
2149
+ {
2150
+ include: "#enum-case"
2151
+ },
2152
+ {
2153
+ include: "#more-cases"
2154
+ }
2155
+ ]
2156
+ },
2157
+ "raw-value-assignment": {
2158
+ begin: "(=)\\s*",
2159
+ beginCaptures: {
2160
+ "1": {
2161
+ name: "keyword.operator.assignment.swift"
2162
+ }
2163
+ },
2164
+ end: "(?!\\G)",
2165
+ patterns: [
2166
+ {
2167
+ include: "#comments"
2168
+ },
2169
+ {
2170
+ include: "#literals"
2171
+ }
2172
+ ]
2173
+ }
2174
+ }
2175
+ },
2176
+ "type-identifier": {
2177
+ begin: "((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
2178
+ beginCaptures: {
2179
+ "1": {
2180
+ name: "meta.type-name.swift",
2181
+ patterns: [
2182
+ {
2183
+ include: "#builtin-types"
2184
+ }
2185
+ ]
2186
+ },
2187
+ "2": {
2188
+ name: "punctuation.definition.identifier.swift"
2189
+ },
2190
+ "3": {
2191
+ name: "punctuation.definition.identifier.swift"
2192
+ }
2193
+ },
2194
+ end: "(?!<)",
2195
+ patterns: [
2196
+ {
2197
+ begin: "(?=<)",
2198
+ end: "(?!\\G)",
2199
+ patterns: [
2200
+ {
2201
+ include: "#generic-argument-clause"
2202
+ }
2203
+ ]
2204
+ }
2205
+ ]
2206
+ },
2207
+ typealias: {
2208
+ begin: "\\b(typealias)\\s+((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*",
2209
+ beginCaptures: {
2210
+ "1": {
2211
+ name: "keyword.other.declaration-specifier.swift"
2212
+ },
2213
+ "2": {
2214
+ name: "entity.name.type.typealias.swift"
2215
+ },
2216
+ "3": {
2217
+ name: "punctuation.definition.identifier.swift"
2218
+ },
2219
+ "4": {
2220
+ name: "punctuation.definition.identifier.swift"
2221
+ }
2222
+ },
2223
+ end: "(?!\\G)$|(?=;|//|/\\*|$)",
2224
+ name: "meta.definition.typealias.swift",
2225
+ patterns: [
2226
+ {
2227
+ begin: "\\G(?=<)",
2228
+ end: "(?!\\G)",
2229
+ patterns: [
2230
+ {
2231
+ include: "#generic-parameter-clause"
2232
+ }
2233
+ ]
2234
+ },
2235
+ {
2236
+ include: "#typealias-assignment"
2237
+ }
2238
+ ]
2239
+ },
2240
+ "typealias-assignment": {
2241
+ begin: "(=)\\s*",
2242
+ beginCaptures: {
2243
+ "1": {
2244
+ name: "keyword.operator.assignment.swift"
2245
+ }
2246
+ },
2247
+ end: "(?!\\G)$|(?=;|//|/\\*|$)",
2248
+ patterns: [
2249
+ {
2250
+ include: "#available-types"
2251
+ }
2252
+ ]
2253
+ },
2254
+ "typed-variable-declaration": {
2255
+ begin: "(?x)\n\t\t\t\t\t\t\\b(let|var)\\b\\s+\n\t\t\t\t\t\t(?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>)\\s*\n\t\t\t\t\t\t:\n\t\t\t\t\t",
2256
+ beginCaptures: {
2257
+ "1": {
2258
+ name: "keyword.other.declaration-specifier.swift"
2259
+ }
2260
+ },
2261
+ end: "(?=$|[={])",
2262
+ patterns: [
2263
+ {
2264
+ include: "#available-types"
2265
+ }
2266
+ ]
2267
+ },
2268
+ "types-precedencegroup": {
2269
+ patterns: [
2270
+ {
2271
+ comment: "Precedence groups in the standard library",
2272
+ match: "\\b(?:BitwiseShift|Assignment|RangeFormation|Casting|Addition|NilCoalescing|Comparison|LogicalConjunction|LogicalDisjunction|Default|Ternary|Multiplication|FunctionArrow)Precedence\\b",
2273
+ name: "support.type.swift"
2274
+ }
2275
+ ]
2276
+ }
2277
+ }
2278
+ },
2279
+ expressions: {
2280
+ patterns: [
2281
+ {
2282
+ include: "#comments"
2283
+ },
2284
+ {
2285
+ include: "#code-block"
2286
+ },
2287
+ {
2288
+ include: "#attributes"
2289
+ },
2290
+ {
2291
+ include: "#closure-parameter"
2292
+ },
2293
+ {
2294
+ include: "#literals"
2295
+ },
2296
+ {
2297
+ include: "#operators"
2298
+ },
2299
+ {
2300
+ include: "#builtin-types"
2301
+ },
2302
+ {
2303
+ include: "#builtin-functions"
2304
+ },
2305
+ {
2306
+ include: "#builtin-global-functions"
2307
+ },
2308
+ {
2309
+ include: "#builtin-properties"
2310
+ },
2311
+ {
2312
+ include: "#compound-name"
2313
+ },
2314
+ {
2315
+ include: "#keywords"
2316
+ },
2317
+ {
2318
+ include: "#function-call-expression"
2319
+ },
2320
+ {
2321
+ include: "#subscript-expression"
2322
+ },
2323
+ {
2324
+ include: "#parenthesized-expression"
2325
+ },
2326
+ {
2327
+ include: "#member-reference"
2328
+ },
2329
+ {
2330
+ include: "#availability-condition"
2331
+ },
2332
+ {
2333
+ match: "\\b_\\b",
2334
+ name: "support.variable.discard-value.swift"
2335
+ }
2336
+ ],
2337
+ repository: {
2338
+ "availability-condition": {
2339
+ begin: "\\B(#(?:un)?available)(\\()",
2340
+ beginCaptures: {
2341
+ "1": {
2342
+ name: "support.function.availability-condition.swift"
2343
+ },
2344
+ "2": {
2345
+ name: "punctuation.definition.arguments.begin.swift"
2346
+ }
2347
+ },
2348
+ end: "\\)",
2349
+ endCaptures: {
2350
+ "0": {
2351
+ name: "punctuation.definition.arguments.end.swift"
2352
+ }
2353
+ },
2354
+ patterns: [
2355
+ {
2356
+ captures: {
2357
+ "1": {
2358
+ name: "keyword.other.platform.os.swift"
2359
+ },
2360
+ "2": {
2361
+ name: "constant.numeric.swift"
2362
+ }
2363
+ },
2364
+ match: "\\s*\\b((?:iOS|macOS|OSX|watchOS|tvOS|UIKitForMac)(?:ApplicationExtension)?)\\b(?:\\s+([0-9]+(?:\\.[0-9]+)*\\b))"
2365
+ },
2366
+ {
2367
+ captures: {
2368
+ "1": {
2369
+ name: "keyword.other.platform.all.swift"
2370
+ },
2371
+ "2": {
2372
+ name: "invalid.illegal.character-not-allowed-here.swift"
2373
+ }
2374
+ },
2375
+ match: "(\\*)\\s*(.*?)(?=[,)])"
2376
+ },
2377
+ {
2378
+ match: "[^\\s,)]+",
2379
+ name: "invalid.illegal.character-not-allowed-here.swift"
2380
+ }
2381
+ ]
2382
+ },
2383
+ "closure-parameter": {
2384
+ match: "\\$[0-9]+",
2385
+ name: "variable.language.closure-parameter.swift"
2386
+ },
2387
+ "compound-name": {
2388
+ captures: {
2389
+ "1": {
2390
+ name: "entity.name.function.compound-name.swift"
2391
+ },
2392
+ "2": {
2393
+ name: "punctuation.definition.entity.swift"
2394
+ },
2395
+ "3": {
2396
+ name: "punctuation.definition.entity.swift"
2397
+ },
2398
+ "4": {
2399
+ patterns: [
2400
+ {
2401
+ captures: {
2402
+ "1": {
2403
+ name: "punctuation.definition.entity.swift"
2404
+ },
2405
+ "2": {
2406
+ name: "punctuation.definition.entity.swift"
2407
+ }
2408
+ },
2409
+ match: "(?<q>`?)(?!_:)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>):",
2410
+ name: "entity.name.function.compound-name.swift"
2411
+ }
2412
+ ]
2413
+ }
2414
+ },
2415
+ comment: "a reference to a function with disambiguating argument labels, such as foo(_:), foo(bar:), etc.",
2416
+ match: "(?x)\n\t\t\t\t\t\t((?<q1>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q1>)) \t\t# function name\n\t\t\t\t\t\t\\(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t((?<q2>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q2>)) \t# argument label\n\t\t\t\t\t\t\t\t\t:\t\t\t\t\t\t\t\t\t\t\t\t# colon\n\t\t\t\t\t\t\t\t)+\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\\)\n\t\t\t\t\t"
2417
+ },
2418
+ "expression-element-list": {
2419
+ patterns: [
2420
+ {
2421
+ include: "#comments"
2422
+ },
2423
+ {
2424
+ begin: "((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*(:)",
2425
+ beginCaptures: {
2426
+ "1": {
2427
+ name: "support.function.any-method.swift"
2428
+ },
2429
+ "2": {
2430
+ name: "punctuation.definition.identifier.swift"
2431
+ },
2432
+ "3": {
2433
+ name: "punctuation.definition.identifier.swift"
2434
+ },
2435
+ "4": {
2436
+ name: "punctuation.separator.argument-label.swift"
2437
+ }
2438
+ },
2439
+ comment: "an element with a label",
2440
+ end: "(?=[,)\\]])",
2441
+ patterns: [
2442
+ {
2443
+ include: "#expressions"
2444
+ }
2445
+ ]
2446
+ },
2447
+ {
2448
+ begin: "(?![,)\\]])(?=\\S)",
2449
+ comment: "an element without a label (i.e. anything else)",
2450
+ end: "(?=[,)\\]])",
2451
+ patterns: [
2452
+ {
2453
+ include: "#expressions"
2454
+ }
2455
+ ]
2456
+ }
2457
+ ]
2458
+ },
2459
+ "function-call-expression": {
2460
+ patterns: [
2461
+ {
2462
+ begin: "((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))\\s*(\\()",
2463
+ beginCaptures: {
2464
+ "1": {
2465
+ name: "support.function.any-method.swift"
2466
+ },
2467
+ "2": {
2468
+ name: "punctuation.definition.identifier.swift"
2469
+ },
2470
+ "3": {
2471
+ name: "punctuation.definition.identifier.swift"
2472
+ },
2473
+ "4": {
2474
+ name: "punctuation.definition.arguments.begin.swift"
2475
+ }
2476
+ },
2477
+ comment: "foo(args) -- a call whose callee is a highlightable name",
2478
+ end: "\\)",
2479
+ endCaptures: {
2480
+ "0": {
2481
+ name: "punctuation.definition.arguments.end.swift"
2482
+ }
2483
+ },
2484
+ name: "meta.function-call.swift",
2485
+ patterns: [
2486
+ {
2487
+ include: "#expression-element-list"
2488
+ }
2489
+ ]
2490
+ },
2491
+ {
2492
+ begin: "(?<=[`\\])}>\\p{L}_\\p{N}\\p{M}])\\s*(\\()",
2493
+ beginCaptures: {
2494
+ "1": {
2495
+ name: "punctuation.definition.arguments.begin.swift"
2496
+ }
2497
+ },
2498
+ comment: "[Int](args) -- a call whose callee is a more complicated expression",
2499
+ end: "\\)",
2500
+ endCaptures: {
2501
+ "0": {
2502
+ name: "punctuation.definition.arguments.end.swift"
2503
+ }
2504
+ },
2505
+ name: "meta.function-call.swift",
2506
+ patterns: [
2507
+ {
2508
+ include: "#expression-element-list"
2509
+ }
2510
+ ]
2511
+ }
2512
+ ]
2513
+ },
2514
+ "member-reference": {
2515
+ patterns: [
2516
+ {
2517
+ captures: {
2518
+ "1": {
2519
+ name: "variable.other.swift"
2520
+ },
2521
+ "2": {
2522
+ name: "punctuation.definition.identifier.swift"
2523
+ },
2524
+ "3": {
2525
+ name: "punctuation.definition.identifier.swift"
2526
+ }
2527
+ },
2528
+ match: "(?<=\\.)((?<q>`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k<q>))"
2529
+ }
2530
+ ]
2531
+ },
2532
+ "parenthesized-expression": {
2533
+ begin: "\\(",
2534
+ beginCaptures: {
2535
+ "0": {
2536
+ name: "punctuation.section.tuple.begin.swift"
2537
+ }
2538
+ },
2539
+ 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",
2540
+ end: "(\\))\\s*((?:\\b(?:async|throws|rethrows)\\s)*)",
2541
+ endCaptures: {
2542
+ "1": {
2543
+ name: "punctuation.section.tuple.end.swift"
2544
+ },
2545
+ "2": {
2546
+ patterns: [
2547
+ {
2548
+ match: "\\brethrows\\b",
2549
+ name: "invalid.illegal.rethrows-only-allowed-on-function-declarations.swift"
2550
+ },
2551
+ {
2552
+ include: "#async-throws"
2553
+ }
2554
+ ]
2555
+ }
2556
+ },
2557
+ patterns: [
2558
+ {
2559
+ include: "#expression-element-list"
2560
+ }
2561
+ ]
2562
+ },
2563
+ "subscript-expression": {
2564
+ begin: "(?<=[`\\p{L}_\\p{N}\\p{M}])\\s*(\\[)",
2565
+ beginCaptures: {
2566
+ "1": {
2567
+ name: "punctuation.definition.arguments.begin.swift"
2568
+ }
2569
+ },
2570
+ end: "\\]",
2571
+ endCaptures: {
2572
+ "0": {
2573
+ name: "punctuation.definition.arguments.end.swift"
2574
+ }
2575
+ },
2576
+ name: "meta.subscript-expression.swift",
2577
+ patterns: [
2578
+ {
2579
+ include: "#expression-element-list"
2580
+ }
2581
+ ]
2582
+ }
2583
+ }
2584
+ },
2585
+ keywords: {
2586
+ patterns: [
2587
+ {
2588
+ match: "(?<!\\.)\\b(?:if|else|guard|where|switch|case|default|fallthrough)\\b",
2589
+ name: "keyword.control.branch.swift"
2590
+ },
2591
+ {
2592
+ match: "(?<!\\.)\\b(?:continue|break|fallthrough|return)\\b",
2593
+ name: "keyword.control.transfer.swift"
2594
+ },
2595
+ {
2596
+ match: "(?<!\\.)\\b(?:while|for|in)\\b",
2597
+ name: "keyword.control.loop.swift"
2598
+ },
2599
+ {
2600
+ captures: {
2601
+ "1": {
2602
+ name: "keyword.control.loop.swift"
2603
+ },
2604
+ "2": {
2605
+ name: "punctuation.whitespace.trailing.repeat.swift"
2606
+ }
2607
+ },
2608
+ comment: "extra scopes for repeat-while snippet",
2609
+ match: "(?<!\\.)\\b(repeat)\\b(\\s*)"
2610
+ },
2611
+ {
2612
+ match: "(?<!\\.)\\bdefer\\b",
2613
+ name: "keyword.control.defer.swift"
2614
+ },
2615
+ {
2616
+ captures: {
2617
+ "1": {
2618
+ name: "invalid.illegal.try-must-precede-await.swift"
2619
+ },
2620
+ "2": {
2621
+ name: "keyword.control.await.swift"
2622
+ }
2623
+ },
2624
+ match: "(?<!\\.)\\b(?:(await\\s+try)|(await)\\b)"
2625
+ },
2626
+ {
2627
+ match: "(?<!\\.)\\b(?:catch|throws?|rethrows|try)\\b|\\btry[?!]\\B",
2628
+ name: "keyword.control.exception.swift"
2629
+ },
2630
+ {
2631
+ captures: {
2632
+ "1": {
2633
+ name: "keyword.control.exception.swift"
2634
+ },
2635
+ "2": {
2636
+ name: "punctuation.whitespace.trailing.do.swift"
2637
+ }
2638
+ },
2639
+ comment: "extra scopes for do-catch snippet",
2640
+ match: "(?<!\\.)\\b(do)\\b(\\s*)"
2641
+ },
2642
+ {
2643
+ match: "(?<!\\.)\\b(?:associatedtype|let|operator|typealias|var)\\b",
2644
+ name: "keyword.other.declaration-specifier.swift"
2645
+ },
2646
+ {
2647
+ match: "(?<!\\.)\\b(class|enum|extension|precedencegroup|protocol|struct|actor)\\b",
2648
+ name: "storage.type.$1.swift"
2649
+ },
2650
+ {
2651
+ match: "(?<!\\.)\\b(?:inout|static|final|lazy|mutating|nonmutating|optional|indirect|required|override|dynamic|convenience|infix|prefix|postfix)\\b",
2652
+ name: "storage.modifier.swift"
2653
+ },
2654
+ {
2655
+ match: "\\binit[?!]|\\binit\\b|(?<!\\.)\\b(?:func|deinit|subscript|didSet|get|set|willSet)\\b",
2656
+ name: "storage.type.function.swift"
2657
+ },
2658
+ {
2659
+ match: "(?<!\\.)\\b(?:fileprivate|private|internal|public|open)\\b",
2660
+ name: "keyword.other.declaration-specifier.accessibility.swift"
2661
+ },
2662
+ {
2663
+ comment: "matches weak, unowned, unowned(safe), unowned(unsafe)",
2664
+ match: "(?<!\\.)\\bunowned\\((?:safe|unsafe)\\)|(?<!\\.)\\b(?:weak|unowned)\\b",
2665
+ name: "keyword.other.capture-specifier.swift"
2666
+ },
2667
+ {
2668
+ captures: {
2669
+ "1": {
2670
+ name: "keyword.operator.type.swift"
2671
+ },
2672
+ "2": {
2673
+ name: "keyword.operator.type.metatype.swift"
2674
+ }
2675
+ },
2676
+ match: "(?<=\\.)(?:(dynamicType|self)|(Protocol|Type))\\b"
2677
+ },
2678
+ {
2679
+ match: "(?<!\\.)\\b(?:super|self|Self)\\b",
2680
+ name: "variable.language.swift"
2681
+ },
2682
+ {
2683
+ match: "\\B(?:#file|#filePath|#fileID|#line|#column|#function|#dsohandle)\\b|\\b(?:__FILE__|__LINE__|__COLUMN__|__FUNCTION__|__DSO_HANDLE__)\\b",
2684
+ name: "support.variable.swift"
2685
+ },
2686
+ {
2687
+ match: "(?<!\\.)\\bimport\\b",
2688
+ name: "keyword.control.import.swift"
2689
+ }
2690
+ ]
2691
+ },
2692
+ literals: {
2693
+ patterns: [
2694
+ {
2695
+ include: "#boolean"
2696
+ },
2697
+ {
2698
+ include: "#numeric"
2699
+ },
2700
+ {
2701
+ include: "#string"
2702
+ },
2703
+ {
2704
+ match: "\\bnil\\b",
2705
+ name: "constant.language.nil.swift"
2706
+ },
2707
+ {
2708
+ comment: "object \"literals\" used in playgrounds",
2709
+ match: "\\B#(colorLiteral|imageLiteral|fileLiteral)\\b",
2710
+ name: "support.function.object-literal.swift"
2711
+ },
2712
+ {
2713
+ match: "\\B#keyPath\\b",
2714
+ name: "support.function.key-path.swift"
2715
+ },
2716
+ {
2717
+ begin: "\\B(#selector)(\\()(?:\\s*(getter|setter)\\s*(:))?",
2718
+ beginCaptures: {
2719
+ "1": {
2720
+ name: "support.function.selector-reference.swift"
2721
+ },
2722
+ "2": {
2723
+ name: "punctuation.definition.arguments.begin.swift"
2724
+ },
2725
+ "3": {
2726
+ name: "support.variable.parameter.swift"
2727
+ },
2728
+ "4": {
2729
+ name: "punctuation.separator.argument-label.swift"
2730
+ }
2731
+ },
2732
+ end: "\\)",
2733
+ endCaptures: {
2734
+ "0": {
2735
+ name: "punctuation.definition.arguments.end.swift"
2736
+ }
2737
+ },
2738
+ patterns: [
2739
+ {
2740
+ include: "#expressions"
2741
+ }
2742
+ ]
2743
+ }
2744
+ ],
2745
+ repository: {
2746
+ boolean: {
2747
+ match: "\\b(true|false)\\b",
2748
+ name: "constant.language.boolean.swift"
2749
+ },
2750
+ numeric: {
2751
+ patterns: [
2752
+ {
2753
+ comment: "0.1, -4_2.5, 6.022e23, 10E-5",
2754
+ 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])",
2755
+ name: "constant.numeric.float.decimal.swift"
2756
+ },
2757
+ {
2758
+ comment: "-0x1.ap2_3, 0x31p-4",
2759
+ 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])",
2760
+ name: "constant.numeric.float.hexadecimal.swift"
2761
+ },
2762
+ {
2763
+ comment: "0x1p, 0x1p_2, 0x1.5pa, 0x1.1p+1f, 0x1pz",
2764
+ 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])",
2765
+ name: "invalid.illegal.numeric.float.invalid-exponent.swift"
2766
+ },
2767
+ {
2768
+ comment: "0x1.5w (note that 0x1.f may be a valid expression)",
2769
+ match: "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)(0x[0-9a-fA-F][0-9a-fA-F_]*)\\.[0-9][\\w.]*",
2770
+ name: "invalid.illegal.numeric.float.missing-exponent.swift"
2771
+ },
2772
+ {
2773
+ comment: "-.5, .2f (note that 1.-.5 may be a valid expression)",
2774
+ match: "(?<=\\s|^)\\-?\\.[0-9][\\w.]*",
2775
+ name: "invalid.illegal.numeric.float.missing-leading-zero.swift"
2776
+ },
2777
+ {
2778
+ comment: "0b_0_1, 0x_1p+3q",
2779
+ match: "(\\B\\-|\\b)0[box]_[0-9a-fA-F_]*(?:[pPeE][+-]?\\w+)?[\\w.]+",
2780
+ name: "invalid.illegal.numeric.leading-underscore.swift"
2781
+ },
2782
+ {
2783
+ comment: "tuple positional member: not really a numeric literal, but not invalid",
2784
+ match: "(?<=[\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)[0-9]+\\b"
2785
+ },
2786
+ {
2787
+ comment: "0b010, 0b1_0",
2788
+ match: "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)0b[01][01_]*\\b(?!\\.[0-9])",
2789
+ name: "constant.numeric.integer.binary.swift"
2790
+ },
2791
+ {
2792
+ comment: "0o1, 0o7_3",
2793
+ match: "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)0o[0-7][0-7_]*\\b(?!\\.[0-9])",
2794
+ name: "constant.numeric.integer.octal.swift"
2795
+ },
2796
+ {
2797
+ comment: "02, 3_456",
2798
+ match: "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)[0-9][0-9_]*\\b(?!\\.[0-9])",
2799
+ name: "constant.numeric.integer.decimal.swift"
2800
+ },
2801
+ {
2802
+ comment: "0x4, 0xF_7",
2803
+ match: "(\\B\\-|\\b)(?<![\\[\\](){}\\p{L}_\\p{N}\\p{M}]\\.)0x[0-9a-fA-F][0-9a-fA-F_]*\\b(?!\\.[0-9])",
2804
+ name: "constant.numeric.integer.hexadecimal.swift"
2805
+ },
2806
+ {
2807
+ match: "(\\B\\-|\\b)[0-9][\\w.]*",
2808
+ name: "invalid.illegal.numeric.other.swift"
2809
+ }
2810
+ ]
2811
+ },
2812
+ string: {
2813
+ patterns: [
2814
+ {
2815
+ begin: "\"\"\"",
2816
+ beginCaptures: {
2817
+ "0": {
2818
+ name: "punctuation.definition.string.begin.swift"
2819
+ }
2820
+ },
2821
+ comment: "SE-0168: Multi-Line String Literals",
2822
+ end: "\"\"\"(#*)",
2823
+ endCaptures: {
2824
+ "0": {
2825
+ name: "punctuation.definition.string.end.swift"
2826
+ },
2827
+ "1": {
2828
+ name: "invalid.illegal.extra-closing-delimiter.swift"
2829
+ }
2830
+ },
2831
+ name: "string.quoted.double.block.swift",
2832
+ patterns: [
2833
+ {
2834
+ match: "\\G.+(?=\"\"\")|\\G.+",
2835
+ name: "invalid.illegal.content-after-opening-delimiter.swift"
2836
+ },
2837
+ {
2838
+ match: "\\\\\\s*\\n",
2839
+ name: "constant.character.escape.newline.swift"
2840
+ },
2841
+ {
2842
+ include: "#string-guts"
2843
+ },
2844
+ {
2845
+ comment: "Allow \\(\"\"\"...\"\"\") to appear inside a block string",
2846
+ match: "\\S((?!\\\\\\().)*(?=\"\"\")",
2847
+ name: "invalid.illegal.content-before-closing-delimiter.swift"
2848
+ }
2849
+ ]
2850
+ },
2851
+ {
2852
+ begin: "#\"\"\"",
2853
+ beginCaptures: {
2854
+ "0": {
2855
+ name: "punctuation.definition.string.begin.swift"
2856
+ }
2857
+ },
2858
+ end: "\"\"\"#(#*)",
2859
+ endCaptures: {
2860
+ "0": {
2861
+ name: "punctuation.definition.string.end.swift"
2862
+ },
2863
+ "1": {
2864
+ name: "invalid.illegal.extra-closing-delimiter.swift"
2865
+ }
2866
+ },
2867
+ name: "string.quoted.double.block.raw.swift",
2868
+ patterns: [
2869
+ {
2870
+ match: "\\G.+(?=\"\"\")|\\G.+",
2871
+ name: "invalid.illegal.content-after-opening-delimiter.swift"
2872
+ },
2873
+ {
2874
+ match: "\\\\#\\s*\\n",
2875
+ name: "constant.character.escape.newline.swift"
2876
+ },
2877
+ {
2878
+ include: "#raw-string-guts"
2879
+ },
2880
+ {
2881
+ comment: "Allow \\(\"\"\"...\"\"\") to appear inside a block string",
2882
+ match: "\\S((?!\\\\#\\().)*(?=\"\"\")",
2883
+ name: "invalid.illegal.content-before-closing-delimiter.swift"
2884
+ }
2885
+ ]
2886
+ },
2887
+ {
2888
+ begin: "(##+)\"\"\"",
2889
+ beginCaptures: {
2890
+ "0": {
2891
+ name: "punctuation.definition.string.begin.swift"
2892
+ }
2893
+ },
2894
+ end: "\"\"\"\\1(#*)",
2895
+ endCaptures: {
2896
+ "0": {
2897
+ name: "punctuation.definition.string.end.swift"
2898
+ },
2899
+ "1": {
2900
+ name: "invalid.illegal.extra-closing-delimiter.swift"
2901
+ }
2902
+ },
2903
+ name: "string.quoted.double.block.raw.swift",
2904
+ patterns: [
2905
+ {
2906
+ match: "\\G.+(?=\"\"\")|\\G.+",
2907
+ name: "invalid.illegal.content-after-opening-delimiter.swift"
2908
+ }
2909
+ ]
2910
+ },
2911
+ {
2912
+ begin: "\"",
2913
+ beginCaptures: {
2914
+ "0": {
2915
+ name: "punctuation.definition.string.begin.swift"
2916
+ }
2917
+ },
2918
+ end: "\"(#*)",
2919
+ endCaptures: {
2920
+ "0": {
2921
+ name: "punctuation.definition.string.end.swift"
2922
+ },
2923
+ "1": {
2924
+ name: "invalid.illegal.extra-closing-delimiter.swift"
2925
+ }
2926
+ },
2927
+ name: "string.quoted.double.single-line.swift",
2928
+ patterns: [
2929
+ {
2930
+ match: "\\r|\\n",
2931
+ name: "invalid.illegal.returns-not-allowed.swift"
2932
+ },
2933
+ {
2934
+ include: "#string-guts"
2935
+ }
2936
+ ]
2937
+ },
2938
+ {
2939
+ begin: "(##+)\"",
2940
+ beginCaptures: {
2941
+ "0": {
2942
+ name: "punctuation.definition.string.begin.raw.swift"
2943
+ }
2944
+ },
2945
+ comment: "SE-0168: raw string literals (more than one #, grammar limitations prevent us from supporting escapes)",
2946
+ end: "\"\\1(#*)",
2947
+ endCaptures: {
2948
+ "0": {
2949
+ name: "punctuation.definition.string.end.raw.swift"
2950
+ },
2951
+ "1": {
2952
+ name: "invalid.illegal.extra-closing-delimiter.swift"
2953
+ }
2954
+ },
2955
+ name: "string.quoted.double.single-line.raw.swift",
2956
+ patterns: [
2957
+ {
2958
+ match: "\\r|\\n",
2959
+ name: "invalid.illegal.returns-not-allowed.swift"
2960
+ }
2961
+ ]
2962
+ },
2963
+ {
2964
+ begin: "#\"",
2965
+ beginCaptures: {
2966
+ "0": {
2967
+ name: "punctuation.definition.string.begin.raw.swift"
2968
+ }
2969
+ },
2970
+ comment: "SE-0168: raw string literals (one #, escapes supported)",
2971
+ end: "\"#(#*)",
2972
+ endCaptures: {
2973
+ "0": {
2974
+ name: "punctuation.definition.string.end.raw.swift"
2975
+ },
2976
+ "1": {
2977
+ name: "invalid.illegal.extra-closing-delimiter.swift"
2978
+ }
2979
+ },
2980
+ name: "string.quoted.double.single-line.raw.swift",
2981
+ patterns: [
2982
+ {
2983
+ match: "\\r|\\n",
2984
+ name: "invalid.illegal.returns-not-allowed.swift"
2985
+ },
2986
+ {
2987
+ include: "#raw-string-guts"
2988
+ }
2989
+ ]
2990
+ }
2991
+ ],
2992
+ repository: {
2993
+ "raw-string-guts": {
2994
+ comment: "the same as #string-guts but with # in escapes",
2995
+ patterns: [
2996
+ {
2997
+ match: "\\\\#[0\\\\tnr\"']",
2998
+ name: "constant.character.escape.swift"
2999
+ },
3000
+ {
3001
+ match: "\\\\#u\\{[0-9a-fA-F]{1,8}\\}",
3002
+ name: "constant.character.escape.unicode.swift"
3003
+ },
3004
+ {
3005
+ begin: "\\\\#\\(",
3006
+ beginCaptures: {
3007
+ "0": {
3008
+ name: "punctuation.section.embedded.begin.swift"
3009
+ }
3010
+ },
3011
+ contentName: "source.swift",
3012
+ end: "(\\))",
3013
+ endCaptures: {
3014
+ "0": {
3015
+ name: "punctuation.section.embedded.end.swift"
3016
+ },
3017
+ "1": {
3018
+ name: "source.swift"
3019
+ }
3020
+ },
3021
+ name: "meta.embedded.line.swift",
3022
+ patterns: [
3023
+ {
3024
+ include: "$self"
3025
+ },
3026
+ {
3027
+ begin: "\\(",
3028
+ comment: "Nested parens",
3029
+ end: "\\)"
3030
+ }
3031
+ ]
3032
+ },
3033
+ {
3034
+ match: "\\\\#.",
3035
+ name: "invalid.illegal.escape-not-recognized"
3036
+ }
3037
+ ]
3038
+ },
3039
+ "string-guts": {
3040
+ patterns: [
3041
+ {
3042
+ match: "\\\\[0\\\\tnr\"']",
3043
+ name: "constant.character.escape.swift"
3044
+ },
3045
+ {
3046
+ match: "\\\\u\\{[0-9a-fA-F]{1,8}\\}",
3047
+ name: "constant.character.escape.unicode.swift"
3048
+ },
3049
+ {
3050
+ begin: "\\\\\\(",
3051
+ beginCaptures: {
3052
+ "0": {
3053
+ name: "punctuation.section.embedded.begin.swift"
3054
+ }
3055
+ },
3056
+ contentName: "source.swift",
3057
+ end: "(\\))",
3058
+ endCaptures: {
3059
+ "0": {
3060
+ name: "punctuation.section.embedded.end.swift"
3061
+ },
3062
+ "1": {
3063
+ name: "source.swift"
3064
+ }
3065
+ },
3066
+ name: "meta.embedded.line.swift",
3067
+ patterns: [
3068
+ {
3069
+ include: "$self"
3070
+ },
3071
+ {
3072
+ begin: "\\(",
3073
+ comment: "Nested parens",
3074
+ end: "\\)"
3075
+ }
3076
+ ]
3077
+ },
3078
+ {
3079
+ match: "\\\\.",
3080
+ name: "invalid.illegal.escape-not-recognized"
3081
+ }
3082
+ ]
3083
+ }
3084
+ }
3085
+ }
3086
+ }
3087
+ },
3088
+ operators: {
3089
+ patterns: [
3090
+ {
3091
+ comment: "Type casting",
3092
+ match: "\\b(is\\b|as([!?]\\B|\\b))",
3093
+ name: "keyword.operator.type-casting.swift"
3094
+ },
3095
+ {
3096
+ begin: "(?x)\n\t\t\t\t\t\t(?=\n\t\t\t\t\t\t\t(?<oph>\t\t\t\t\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\n\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t | \\.\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\\g<oph>\t\t\t\t\t\t\t# operator-head\n\t\t\t\t\t\t\t | \\.\n\t\t\t\t\t\t\t | [\\x{0300}-\\x{036F}]\t\t\t\t# operator-character\n\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t",
3097
+ comment: "This rule helps us speed up the matching.",
3098
+ end: "(?!\\G)",
3099
+ patterns: [
3100
+ {
3101
+ captures: {
3102
+ "0": {
3103
+ patterns: [
3104
+ {
3105
+ match: "\\G(\\+\\+|\\-\\-)$",
3106
+ name: "keyword.operator.increment-or-decrement.swift"
3107
+ },
3108
+ {
3109
+ match: "\\G(\\+|\\-)$",
3110
+ name: "keyword.operator.arithmetic.unary.swift"
3111
+ },
3112
+ {
3113
+ match: "\\G!$",
3114
+ name: "keyword.operator.logical.not.swift"
3115
+ },
3116
+ {
3117
+ match: "\\G~$",
3118
+ name: "keyword.operator.bitwise.not.swift"
3119
+ },
3120
+ {
3121
+ match: ".+",
3122
+ name: "keyword.operator.custom.prefix.swift"
3123
+ }
3124
+ ]
3125
+ }
3126
+ },
3127
+ comment: "Prefix unary operator",
3128
+ match: "(?x)\n\t\t\t\t\t\t\t\t\\G\t\t\t\t\t\t\t\t\t\t# Matching from the beginning ensures\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# that we start with operator-head\n\t\t\t\t\t\t\t\t(?<=^|[\\s(\\[{,;:])\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?!(//|/\\*|\\*/))\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t | [\\x{0300}-\\x{036F}]\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)++\n\t\t\t\t\t\t\t\t(?![\\s)\\]},;:]|\\z)\n\t\t\t\t\t\t\t"
3129
+ },
3130
+ {
3131
+ captures: {
3132
+ "0": {
3133
+ patterns: [
3134
+ {
3135
+ match: "\\G(\\+\\+|\\-\\-)$",
3136
+ name: "keyword.operator.increment-or-decrement.swift"
3137
+ },
3138
+ {
3139
+ match: "\\G!$",
3140
+ name: "keyword.operator.increment-or-decrement.swift"
3141
+ },
3142
+ {
3143
+ match: ".+",
3144
+ name: "keyword.operator.custom.postfix.swift"
3145
+ }
3146
+ ]
3147
+ }
3148
+ },
3149
+ comment: "Postfix unary operator",
3150
+ match: "(?x)\n\t\t\t\t\t\t\t\t\\G\t\t\t\t\t\t\t\t\t\t# Matching from the beginning ensures\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# that we start with operator-head\n\t\t\t\t\t\t\t\t(?<!^|[\\s(\\[{,;:])\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?!(//|/\\*|\\*/))\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t | [\\x{0300}-\\x{036F}]\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)++\n\t\t\t\t\t\t\t\t(?=[\\s)\\]},;:]|\\z)\n\t\t\t\t\t\t\t"
3151
+ },
3152
+ {
3153
+ captures: {
3154
+ "0": {
3155
+ patterns: [
3156
+ {
3157
+ match: "\\G=$",
3158
+ name: "keyword.operator.assignment.swift"
3159
+ },
3160
+ {
3161
+ match: "\\G(\\+|\\-|\\*|/|%|<<|>>|&|\\^|\\||&&|\\|\\|)=$",
3162
+ name: "keyword.operator.assignment.compound.swift"
3163
+ },
3164
+ {
3165
+ match: "\\G(\\+|\\-|\\*|/)$",
3166
+ name: "keyword.operator.arithmetic.swift"
3167
+ },
3168
+ {
3169
+ match: "\\G&(\\+|\\-|\\*)$",
3170
+ name: "keyword.operator.arithmetic.overflow.swift"
3171
+ },
3172
+ {
3173
+ match: "\\G%$",
3174
+ name: "keyword.operator.arithmetic.remainder.swift"
3175
+ },
3176
+ {
3177
+ match: "\\G(==|!=|>|<|>=|<=|~=)$",
3178
+ name: "keyword.operator.comparison.swift"
3179
+ },
3180
+ {
3181
+ match: "\\G\\?\\?$",
3182
+ name: "keyword.operator.coalescing.swift"
3183
+ },
3184
+ {
3185
+ match: "\\G(&&|\\|\\|)$",
3186
+ name: "keyword.operator.logical.swift"
3187
+ },
3188
+ {
3189
+ match: "\\G(&|\\||\\^|<<|>>)$",
3190
+ name: "keyword.operator.bitwise.swift"
3191
+ },
3192
+ {
3193
+ match: "\\G(===|!==)$",
3194
+ name: "keyword.operator.bitwise.swift"
3195
+ },
3196
+ {
3197
+ match: "\\G\\?$",
3198
+ name: "keyword.operator.ternary.swift"
3199
+ },
3200
+ {
3201
+ match: ".+",
3202
+ name: "keyword.operator.custom.infix.swift"
3203
+ }
3204
+ ]
3205
+ }
3206
+ },
3207
+ comment: "Infix operator",
3208
+ match: "(?x)\n\t\t\t\t\t\t\t\t\\G\t\t\t\t\t\t\t\t\t\t# Matching from the beginning ensures\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# that we start with operator-head\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?!(//|/\\*|\\*/))\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t | [\\x{0300}-\\x{036F}]\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)++\n\t\t\t\t\t\t\t"
3209
+ },
3210
+ {
3211
+ captures: {
3212
+ "0": {
3213
+ patterns: [
3214
+ {
3215
+ match: ".+",
3216
+ name: "keyword.operator.custom.prefix.dot.swift"
3217
+ }
3218
+ ]
3219
+ }
3220
+ },
3221
+ comment: "Dot prefix unary operator",
3222
+ match: "(?x)\n\t\t\t\t\t\t\t\t\\G\t\t\t\t\t\t\t\t\t\t# Matching from the beginning ensures\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# that we start with operator-head\n\t\t\t\t\t\t\t\t(?<=^|[\\s(\\[{,;:])\n\t\t\t\t\t\t\t\t\\.\t\t\t\t\t\t\t\t\t\t# dot\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?!(//|/\\*|\\*/))\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\\.\t\t\t\t\t\t\t\t# dot\n\t\t\t\t\t\t\t\t\t | [/=\\-+!*%<>&|^~?]\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t | [\\x{0300}-\\x{036F}]\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)++\n\t\t\t\t\t\t\t\t(?![\\s)\\]},;:]|\\z)\n\t\t\t\t\t\t\t"
3223
+ },
3224
+ {
3225
+ captures: {
3226
+ "0": {
3227
+ patterns: [
3228
+ {
3229
+ match: ".+",
3230
+ name: "keyword.operator.custom.postfix.dot.swift"
3231
+ }
3232
+ ]
3233
+ }
3234
+ },
3235
+ comment: "Dot postfix unary operator",
3236
+ match: "(?x)\n\t\t\t\t\t\t\t\t\\G\t\t\t\t\t\t\t\t\t\t# Matching from the beginning ensures\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# that we start with operator-head\n\t\t\t\t\t\t\t\t(?<!^|[\\s(\\[{,;:])\n\t\t\t\t\t\t\t\t\\.\t\t\t\t\t\t\t\t\t\t# dot\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?!(//|/\\*|\\*/))\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\\.\t\t\t\t\t\t\t\t# dot\n\t\t\t\t\t\t\t\t\t | [/=\\-+!*%<>&|^~?]\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t | [\\x{0300}-\\x{036F}]\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)++\n\t\t\t\t\t\t\t\t(?=[\\s)\\]},;:]|\\z)\n\t\t\t\t\t\t\t"
3237
+ },
3238
+ {
3239
+ captures: {
3240
+ "0": {
3241
+ patterns: [
3242
+ {
3243
+ match: "\\G\\.\\.[.<]$",
3244
+ name: "keyword.operator.range.swift"
3245
+ },
3246
+ {
3247
+ match: ".+",
3248
+ name: "keyword.operator.custom.infix.dot.swift"
3249
+ }
3250
+ ]
3251
+ }
3252
+ },
3253
+ comment: "Dot infix operator",
3254
+ match: "(?x)\n\t\t\t\t\t\t\t\t\\G\t\t\t\t\t\t\t\t\t\t# Matching from the beginning ensures\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# that we start with operator-head\n\t\t\t\t\t\t\t\t\\.\t\t\t\t\t\t\t\t\t\t# dot\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?!(//|/\\*|\\*/))\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\\.\t\t\t\t\t\t\t\t# dot\n\t\t\t\t\t\t\t\t\t | [/=\\-+!*%<>&|^~?]\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t | [\\x{0300}-\\x{036F}]\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)++\n\t\t\t\t\t\t\t"
3255
+ }
3256
+ ]
3257
+ },
3258
+ {
3259
+ match: ":",
3260
+ name: "keyword.operator.ternary.swift"
3261
+ }
3262
+ ]
3263
+ },
3264
+ root: {
3265
+ patterns: [
3266
+ {
3267
+ include: "#compiler-control"
3268
+ },
3269
+ {
3270
+ include: "#declarations"
3271
+ },
3272
+ {
3273
+ include: "#expressions"
3274
+ }
3275
+ ]
3276
+ }
3277
+ };
3278
+ var swift_tmLanguage = {
3279
+ information_for_contributors: information_for_contributors,
3280
+ version: version,
3281
+ name: name,
3282
+ scopeName: scopeName,
3283
+ comment: comment,
3284
+ patterns: patterns,
3285
+ repository: repository
3286
+ };
3287
+
3288
+ export { comment, swift_tmLanguage as default, information_for_contributors, name, patterns, repository, scopeName, version };