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