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,4208 @@
1
+ {
2
+ "displayName": "MagicPython",
3
+ "name": "python",
4
+ "patterns": [
5
+ {
6
+ "include": "#statement"
7
+ },
8
+ {
9
+ "include": "#expression"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "annotated-parameter": {
14
+ "begin": "(?x)\n \\b\n ([[:alpha:]_]\\w*) \\s* (:)\n",
15
+ "beginCaptures": {
16
+ "1": {
17
+ "name": "variable.parameter.function.language.python"
18
+ },
19
+ "2": {
20
+ "name": "punctuation.separator.annotation.python"
21
+ }
22
+ },
23
+ "end": "(,)|(?=\\))",
24
+ "endCaptures": {
25
+ "1": {
26
+ "name": "punctuation.separator.parameters.python"
27
+ }
28
+ },
29
+ "patterns": [
30
+ {
31
+ "include": "#expression"
32
+ },
33
+ {
34
+ "match": "=(?!=)",
35
+ "name": "keyword.operator.assignment.python"
36
+ }
37
+ ]
38
+ },
39
+ "assignment-operator": {
40
+ "match": "(?x)\n <<= | >>= | //= | \\*\\*=\n | \\+= | -= | /= | @=\n | \\*= | %= | ~= | \\^= | &= | \\|=\n | =(?!=)\n",
41
+ "name": "keyword.operator.assignment.python"
42
+ },
43
+ "backticks": {
44
+ "begin": "\\`",
45
+ "end": "(?:\\`|(?<!\\\\)(\\n))",
46
+ "name": "invalid.deprecated.backtick.python",
47
+ "patterns": [
48
+ {
49
+ "include": "#expression"
50
+ }
51
+ ]
52
+ },
53
+ "builtin-callables": {
54
+ "patterns": [
55
+ {
56
+ "include": "#illegal-names"
57
+ },
58
+ {
59
+ "include": "#illegal-object-name"
60
+ },
61
+ {
62
+ "include": "#builtin-exceptions"
63
+ },
64
+ {
65
+ "include": "#builtin-functions"
66
+ },
67
+ {
68
+ "include": "#builtin-types"
69
+ }
70
+ ]
71
+ },
72
+ "builtin-exceptions": {
73
+ "match": "(?x) (?<!\\.) \\b(\n (\n Arithmetic | Assertion | Attribute | Buffer | BlockingIO\n | BrokenPipe | ChildProcess\n | (Connection (Aborted | Refused | Reset)?)\n | EOF | Environment | FileExists | FileNotFound\n | FloatingPoint | IO | Import | Indentation | Index | Interrupted\n | IsADirectory | NotADirectory | Permission | ProcessLookup\n | Timeout\n | Key | Lookup | Memory | Name | NotImplemented | OS | Overflow\n | Reference | Runtime | Recursion | Syntax | System\n | Tab | Type | UnboundLocal | Unicode(Encode|Decode|Translate)?\n | Value | Windows | ZeroDivision | ModuleNotFound\n ) Error\n|\n ((Pending)?Deprecation | Runtime | Syntax | User | Future | Import\n | Unicode | Bytes | Resource\n )? Warning\n|\n SystemExit | Stop(Async)?Iteration\n | KeyboardInterrupt\n | GeneratorExit | (Base)?Exception\n)\\b\n",
74
+ "name": "support.type.exception.python"
75
+ },
76
+ "builtin-functions": {
77
+ "patterns": [
78
+ {
79
+ "match": "(?x)\n (?<!\\.) \\b(\n __import__ | abs | aiter | all | any | anext | ascii | bin\n | breakpoint | callable | chr | compile | copyright | credits\n | delattr | dir | divmod | enumerate | eval | exec | exit\n | filter | format | getattr | globals | hasattr | hash | help\n | hex | id | input | isinstance | issubclass | iter | len\n | license | locals | map | max | memoryview | min | next\n | oct | open | ord | pow | print | quit | range | reload | repr\n | reversed | round | setattr | sorted | sum | vars | zip\n )\\b\n",
80
+ "name": "support.function.builtin.python"
81
+ },
82
+ {
83
+ "match": "(?x)\n (?<!\\.) \\b(\n file | reduce | intern | raw_input | unicode | cmp | basestring\n | execfile | long | xrange\n )\\b\n",
84
+ "name": "variable.legacy.builtin.python"
85
+ }
86
+ ]
87
+ },
88
+ "builtin-possible-callables": {
89
+ "patterns": [
90
+ {
91
+ "include": "#builtin-callables"
92
+ },
93
+ {
94
+ "include": "#magic-names"
95
+ }
96
+ ]
97
+ },
98
+ "builtin-types": {
99
+ "match": "(?x)\n (?<!\\.) \\b(\n bool | bytearray | bytes | classmethod | complex | dict\n | float | frozenset | int | list | object | property\n | set | slice | staticmethod | str | tuple | type\n\n (?# Although 'super' is not a type, it's related to types,\n and is special enough to be highlighted differently from\n other built-ins)\n | super\n )\\b\n",
100
+ "name": "support.type.python"
101
+ },
102
+ "call-wrapper-inheritance": {
103
+ "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n",
104
+ "comment": "same as a function call, but in inheritance context",
105
+ "end": "(\\))",
106
+ "endCaptures": {
107
+ "1": {
108
+ "name": "punctuation.definition.arguments.end.python"
109
+ }
110
+ },
111
+ "name": "meta.function-call.python",
112
+ "patterns": [
113
+ {
114
+ "include": "#inheritance-name"
115
+ },
116
+ {
117
+ "include": "#function-arguments"
118
+ }
119
+ ]
120
+ },
121
+ "class-declaration": {
122
+ "patterns": [
123
+ {
124
+ "begin": "(?x)\n \\s*(class)\\s+\n (?=\n [[:alpha:]_]\\w* \\s* (:|\\()\n )\n",
125
+ "beginCaptures": {
126
+ "1": {
127
+ "name": "storage.type.class.python"
128
+ }
129
+ },
130
+ "end": "(:)",
131
+ "endCaptures": {
132
+ "1": {
133
+ "name": "punctuation.section.class.begin.python"
134
+ }
135
+ },
136
+ "name": "meta.class.python",
137
+ "patterns": [
138
+ {
139
+ "include": "#class-name"
140
+ },
141
+ {
142
+ "include": "#class-inheritance"
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ },
148
+ "class-inheritance": {
149
+ "begin": "(\\()",
150
+ "beginCaptures": {
151
+ "1": {
152
+ "name": "punctuation.definition.inheritance.begin.python"
153
+ }
154
+ },
155
+ "end": "(\\))",
156
+ "endCaptures": {
157
+ "1": {
158
+ "name": "punctuation.definition.inheritance.end.python"
159
+ }
160
+ },
161
+ "name": "meta.class.inheritance.python",
162
+ "patterns": [
163
+ {
164
+ "match": "(\\*\\*|\\*)",
165
+ "name": "keyword.operator.unpacking.arguments.python"
166
+ },
167
+ {
168
+ "match": ",",
169
+ "name": "punctuation.separator.inheritance.python"
170
+ },
171
+ {
172
+ "match": "=(?!=)",
173
+ "name": "keyword.operator.assignment.python"
174
+ },
175
+ {
176
+ "match": "\\bmetaclass\\b",
177
+ "name": "support.type.metaclass.python"
178
+ },
179
+ {
180
+ "include": "#illegal-names"
181
+ },
182
+ {
183
+ "include": "#class-kwarg"
184
+ },
185
+ {
186
+ "include": "#call-wrapper-inheritance"
187
+ },
188
+ {
189
+ "include": "#expression-base"
190
+ },
191
+ {
192
+ "include": "#member-access-class"
193
+ },
194
+ {
195
+ "include": "#inheritance-identifier"
196
+ }
197
+ ]
198
+ },
199
+ "class-kwarg": {
200
+ "captures": {
201
+ "1": {
202
+ "name": "entity.other.inherited-class.python variable.parameter.class.python"
203
+ },
204
+ "2": {
205
+ "name": "keyword.operator.assignment.python"
206
+ }
207
+ },
208
+ "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\s*(=)(?!=)\n"
209
+ },
210
+ "class-name": {
211
+ "patterns": [
212
+ {
213
+ "include": "#illegal-object-name"
214
+ },
215
+ {
216
+ "include": "#builtin-possible-callables"
217
+ },
218
+ {
219
+ "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n",
220
+ "name": "entity.name.type.class.python"
221
+ }
222
+ ]
223
+ },
224
+ "codetags": {
225
+ "captures": {
226
+ "1": {
227
+ "name": "keyword.codetag.notation.python"
228
+ }
229
+ },
230
+ "match": "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)"
231
+ },
232
+ "comments": {
233
+ "patterns": [
234
+ {
235
+ "begin": "(?x)\n (?:\n \\# \\s* (type:)\n \\s*+ (?# we want `\\s*+` which is possessive quantifier since\n we do not actually want to backtrack when matching\n whitespace here)\n (?! $ | \\#)\n )\n",
236
+ "beginCaptures": {
237
+ "0": {
238
+ "name": "meta.typehint.comment.python"
239
+ },
240
+ "1": {
241
+ "name": "comment.typehint.directive.notation.python"
242
+ }
243
+ },
244
+ "contentName": "meta.typehint.comment.python",
245
+ "end": "(?:$|(?=\\#))",
246
+ "name": "comment.line.number-sign.python",
247
+ "patterns": [
248
+ {
249
+ "match": "(?x)\n \\G ignore\n (?= \\s* (?: $ | \\#))\n",
250
+ "name": "comment.typehint.ignore.notation.python"
251
+ },
252
+ {
253
+ "match": "(?x)\n (?<!\\.)\\b(\n bool | bytes | float | int | object | str\n | List | Dict | Iterable | Sequence | Set\n | FrozenSet | Callable | Union | Tuple\n | Any | None\n )\\b\n",
254
+ "name": "comment.typehint.type.notation.python"
255
+ },
256
+ {
257
+ "match": "([\\[\\]\\(\\),\\.\\=\\*]|(->))",
258
+ "name": "comment.typehint.punctuation.notation.python"
259
+ },
260
+ {
261
+ "match": "([[:alpha:]_]\\w*)",
262
+ "name": "comment.typehint.variable.notation.python"
263
+ }
264
+ ]
265
+ },
266
+ {
267
+ "include": "#comments-base"
268
+ }
269
+ ]
270
+ },
271
+ "comments-base": {
272
+ "begin": "(\\#)",
273
+ "beginCaptures": {
274
+ "1": {
275
+ "name": "punctuation.definition.comment.python"
276
+ }
277
+ },
278
+ "end": "($)",
279
+ "name": "comment.line.number-sign.python",
280
+ "patterns": [
281
+ {
282
+ "include": "#codetags"
283
+ }
284
+ ]
285
+ },
286
+ "comments-string-double-three": {
287
+ "begin": "(\\#)",
288
+ "beginCaptures": {
289
+ "1": {
290
+ "name": "punctuation.definition.comment.python"
291
+ }
292
+ },
293
+ "end": "($|(?=\"\"\"))",
294
+ "name": "comment.line.number-sign.python",
295
+ "patterns": [
296
+ {
297
+ "include": "#codetags"
298
+ }
299
+ ]
300
+ },
301
+ "comments-string-single-three": {
302
+ "begin": "(\\#)",
303
+ "beginCaptures": {
304
+ "1": {
305
+ "name": "punctuation.definition.comment.python"
306
+ }
307
+ },
308
+ "end": "($|(?='''))",
309
+ "name": "comment.line.number-sign.python",
310
+ "patterns": [
311
+ {
312
+ "include": "#codetags"
313
+ }
314
+ ]
315
+ },
316
+ "curly-braces": {
317
+ "begin": "\\{",
318
+ "beginCaptures": {
319
+ "0": {
320
+ "name": "punctuation.definition.dict.begin.python"
321
+ }
322
+ },
323
+ "end": "\\}",
324
+ "endCaptures": {
325
+ "0": {
326
+ "name": "punctuation.definition.dict.end.python"
327
+ }
328
+ },
329
+ "patterns": [
330
+ {
331
+ "match": ":",
332
+ "name": "punctuation.separator.dict.python"
333
+ },
334
+ {
335
+ "include": "#expression"
336
+ }
337
+ ]
338
+ },
339
+ "decorator": {
340
+ "begin": "(?x)\n ^\\s*\n ((@)) \\s* (?=[[:alpha:]_]\\w*)\n",
341
+ "beginCaptures": {
342
+ "1": {
343
+ "name": "entity.name.function.decorator.python"
344
+ },
345
+ "2": {
346
+ "name": "punctuation.definition.decorator.python"
347
+ }
348
+ },
349
+ "end": "(?x)\n ( \\) )\n # trailing whitespace and comments are legal\n (?: (.*?) (?=\\s*(?:\\#|$)) )\n | (?=\\n|\\#)\n",
350
+ "endCaptures": {
351
+ "1": {
352
+ "name": "punctuation.definition.arguments.end.python"
353
+ },
354
+ "2": {
355
+ "name": "invalid.illegal.decorator.python"
356
+ }
357
+ },
358
+ "name": "meta.function.decorator.python",
359
+ "patterns": [
360
+ {
361
+ "include": "#decorator-name"
362
+ },
363
+ {
364
+ "include": "#function-arguments"
365
+ }
366
+ ]
367
+ },
368
+ "decorator-name": {
369
+ "patterns": [
370
+ {
371
+ "include": "#builtin-callables"
372
+ },
373
+ {
374
+ "include": "#illegal-object-name"
375
+ },
376
+ {
377
+ "captures": {
378
+ "2": {
379
+ "name": "punctuation.separator.period.python"
380
+ }
381
+ },
382
+ "match": "(?x)\n ([[:alpha:]_]\\w*) | (\\.)\n",
383
+ "name": "entity.name.function.decorator.python"
384
+ },
385
+ {
386
+ "include": "#line-continuation"
387
+ },
388
+ {
389
+ "captures": {
390
+ "1": {
391
+ "name": "invalid.illegal.decorator.python"
392
+ }
393
+ },
394
+ "match": "(?x)\n \\s* ([^([:alpha:]\\s_\\.#\\\\] .*?) (?=\\#|$)\n",
395
+ "name": "invalid.illegal.decorator.python"
396
+ }
397
+ ]
398
+ },
399
+ "docstring": {
400
+ "patterns": [
401
+ {
402
+ "begin": "(\\'\\'\\'|\\\"\\\"\\\")",
403
+ "beginCaptures": {
404
+ "1": {
405
+ "name": "punctuation.definition.string.begin.python"
406
+ }
407
+ },
408
+ "end": "(\\1)",
409
+ "endCaptures": {
410
+ "1": {
411
+ "name": "punctuation.definition.string.end.python"
412
+ }
413
+ },
414
+ "name": "string.quoted.docstring.multi.python",
415
+ "patterns": [
416
+ {
417
+ "include": "#docstring-prompt"
418
+ },
419
+ {
420
+ "include": "#codetags"
421
+ },
422
+ {
423
+ "include": "#docstring-guts-unicode"
424
+ }
425
+ ]
426
+ },
427
+ {
428
+ "begin": "([rR])(\\'\\'\\'|\\\"\\\"\\\")",
429
+ "beginCaptures": {
430
+ "1": {
431
+ "name": "storage.type.string.python"
432
+ },
433
+ "2": {
434
+ "name": "punctuation.definition.string.begin.python"
435
+ }
436
+ },
437
+ "end": "(\\2)",
438
+ "endCaptures": {
439
+ "1": {
440
+ "name": "punctuation.definition.string.end.python"
441
+ }
442
+ },
443
+ "name": "string.quoted.docstring.raw.multi.python",
444
+ "patterns": [
445
+ {
446
+ "include": "#string-consume-escape"
447
+ },
448
+ {
449
+ "include": "#docstring-prompt"
450
+ },
451
+ {
452
+ "include": "#codetags"
453
+ }
454
+ ]
455
+ },
456
+ {
457
+ "begin": "(\\'|\\\")",
458
+ "beginCaptures": {
459
+ "1": {
460
+ "name": "punctuation.definition.string.begin.python"
461
+ }
462
+ },
463
+ "end": "(\\1)|(\\n)",
464
+ "endCaptures": {
465
+ "1": {
466
+ "name": "punctuation.definition.string.end.python"
467
+ },
468
+ "2": {
469
+ "name": "invalid.illegal.newline.python"
470
+ }
471
+ },
472
+ "name": "string.quoted.docstring.single.python",
473
+ "patterns": [
474
+ {
475
+ "include": "#codetags"
476
+ },
477
+ {
478
+ "include": "#docstring-guts-unicode"
479
+ }
480
+ ]
481
+ },
482
+ {
483
+ "begin": "([rR])(\\'|\\\")",
484
+ "beginCaptures": {
485
+ "1": {
486
+ "name": "storage.type.string.python"
487
+ },
488
+ "2": {
489
+ "name": "punctuation.definition.string.begin.python"
490
+ }
491
+ },
492
+ "end": "(\\2)|(\\n)",
493
+ "endCaptures": {
494
+ "1": {
495
+ "name": "punctuation.definition.string.end.python"
496
+ },
497
+ "2": {
498
+ "name": "invalid.illegal.newline.python"
499
+ }
500
+ },
501
+ "name": "string.quoted.docstring.raw.single.python",
502
+ "patterns": [
503
+ {
504
+ "include": "#string-consume-escape"
505
+ },
506
+ {
507
+ "include": "#codetags"
508
+ }
509
+ ]
510
+ }
511
+ ]
512
+ },
513
+ "docstring-guts-unicode": {
514
+ "patterns": [
515
+ {
516
+ "include": "#escape-sequence-unicode"
517
+ },
518
+ {
519
+ "include": "#escape-sequence"
520
+ },
521
+ {
522
+ "include": "#string-line-continuation"
523
+ }
524
+ ]
525
+ },
526
+ "docstring-prompt": {
527
+ "captures": {
528
+ "1": {
529
+ "name": "keyword.control.flow.python"
530
+ }
531
+ },
532
+ "match": "(?x)\n (?:\n (?:^|\\G) \\s* (?# '\\G' is necessary for ST)\n ((?:>>>|\\.\\.\\.) \\s) (?=\\s*\\S)\n )\n"
533
+ },
534
+ "docstring-statement": {
535
+ "begin": "^(?=\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
536
+ "comment": "the string either terminates correctly or by the beginning of a new line (this is for single line docstrings that aren't terminated) AND it's not followed by another docstring",
537
+ "end": "((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))",
538
+ "patterns": [
539
+ {
540
+ "include": "#docstring"
541
+ }
542
+ ]
543
+ },
544
+ "double-one-regexp-character-set": {
545
+ "patterns": [
546
+ {
547
+ "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
548
+ },
549
+ {
550
+ "begin": "(\\[)(\\^)?(\\])?",
551
+ "beginCaptures": {
552
+ "1": {
553
+ "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
554
+ },
555
+ "2": {
556
+ "name": "keyword.operator.negation.regexp"
557
+ },
558
+ "3": {
559
+ "name": "constant.character.set.regexp"
560
+ }
561
+ },
562
+ "end": "(\\]|(?=\"))|((?=(?<!\\\\)\\n))",
563
+ "endCaptures": {
564
+ "1": {
565
+ "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
566
+ },
567
+ "2": {
568
+ "name": "invalid.illegal.newline.python"
569
+ }
570
+ },
571
+ "name": "meta.character.set.regexp",
572
+ "patterns": [
573
+ {
574
+ "include": "#regexp-charecter-set-escapes"
575
+ },
576
+ {
577
+ "match": "[^\\n]",
578
+ "name": "constant.character.set.regexp"
579
+ }
580
+ ]
581
+ }
582
+ ]
583
+ },
584
+ "double-one-regexp-comments": {
585
+ "begin": "\\(\\?#",
586
+ "beginCaptures": {
587
+ "0": {
588
+ "name": "punctuation.comment.begin.regexp"
589
+ }
590
+ },
591
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
592
+ "endCaptures": {
593
+ "1": {
594
+ "name": "punctuation.comment.end.regexp"
595
+ },
596
+ "2": {
597
+ "name": "invalid.illegal.newline.python"
598
+ }
599
+ },
600
+ "name": "comment.regexp",
601
+ "patterns": [
602
+ {
603
+ "include": "#codetags"
604
+ }
605
+ ]
606
+ },
607
+ "double-one-regexp-conditional": {
608
+ "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
609
+ "beginCaptures": {
610
+ "0": {
611
+ "name": "keyword.operator.conditional.regexp"
612
+ },
613
+ "1": {
614
+ "name": "punctuation.parenthesis.conditional.begin.regexp"
615
+ }
616
+ },
617
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
618
+ "endCaptures": {
619
+ "1": {
620
+ "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
621
+ },
622
+ "2": {
623
+ "name": "invalid.illegal.newline.python"
624
+ }
625
+ },
626
+ "patterns": [
627
+ {
628
+ "include": "#double-one-regexp-expression"
629
+ }
630
+ ]
631
+ },
632
+ "double-one-regexp-expression": {
633
+ "patterns": [
634
+ {
635
+ "include": "#regexp-base-expression"
636
+ },
637
+ {
638
+ "include": "#double-one-regexp-character-set"
639
+ },
640
+ {
641
+ "include": "#double-one-regexp-comments"
642
+ },
643
+ {
644
+ "include": "#regexp-flags"
645
+ },
646
+ {
647
+ "include": "#double-one-regexp-named-group"
648
+ },
649
+ {
650
+ "include": "#regexp-backreference"
651
+ },
652
+ {
653
+ "include": "#double-one-regexp-lookahead"
654
+ },
655
+ {
656
+ "include": "#double-one-regexp-lookahead-negative"
657
+ },
658
+ {
659
+ "include": "#double-one-regexp-lookbehind"
660
+ },
661
+ {
662
+ "include": "#double-one-regexp-lookbehind-negative"
663
+ },
664
+ {
665
+ "include": "#double-one-regexp-conditional"
666
+ },
667
+ {
668
+ "include": "#double-one-regexp-parentheses-non-capturing"
669
+ },
670
+ {
671
+ "include": "#double-one-regexp-parentheses"
672
+ }
673
+ ]
674
+ },
675
+ "double-one-regexp-lookahead": {
676
+ "begin": "(\\()\\?=",
677
+ "beginCaptures": {
678
+ "0": {
679
+ "name": "keyword.operator.lookahead.regexp"
680
+ },
681
+ "1": {
682
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
683
+ }
684
+ },
685
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
686
+ "endCaptures": {
687
+ "1": {
688
+ "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
689
+ },
690
+ "2": {
691
+ "name": "invalid.illegal.newline.python"
692
+ }
693
+ },
694
+ "patterns": [
695
+ {
696
+ "include": "#double-one-regexp-expression"
697
+ }
698
+ ]
699
+ },
700
+ "double-one-regexp-lookahead-negative": {
701
+ "begin": "(\\()\\?!",
702
+ "beginCaptures": {
703
+ "0": {
704
+ "name": "keyword.operator.lookahead.negative.regexp"
705
+ },
706
+ "1": {
707
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
708
+ }
709
+ },
710
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
711
+ "endCaptures": {
712
+ "1": {
713
+ "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
714
+ },
715
+ "2": {
716
+ "name": "invalid.illegal.newline.python"
717
+ }
718
+ },
719
+ "patterns": [
720
+ {
721
+ "include": "#double-one-regexp-expression"
722
+ }
723
+ ]
724
+ },
725
+ "double-one-regexp-lookbehind": {
726
+ "begin": "(\\()\\?<=",
727
+ "beginCaptures": {
728
+ "0": {
729
+ "name": "keyword.operator.lookbehind.regexp"
730
+ },
731
+ "1": {
732
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
733
+ }
734
+ },
735
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
736
+ "endCaptures": {
737
+ "1": {
738
+ "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
739
+ },
740
+ "2": {
741
+ "name": "invalid.illegal.newline.python"
742
+ }
743
+ },
744
+ "patterns": [
745
+ {
746
+ "include": "#double-one-regexp-expression"
747
+ }
748
+ ]
749
+ },
750
+ "double-one-regexp-lookbehind-negative": {
751
+ "begin": "(\\()\\?<!",
752
+ "beginCaptures": {
753
+ "0": {
754
+ "name": "keyword.operator.lookbehind.negative.regexp"
755
+ },
756
+ "1": {
757
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
758
+ }
759
+ },
760
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
761
+ "endCaptures": {
762
+ "1": {
763
+ "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
764
+ },
765
+ "2": {
766
+ "name": "invalid.illegal.newline.python"
767
+ }
768
+ },
769
+ "patterns": [
770
+ {
771
+ "include": "#double-one-regexp-expression"
772
+ }
773
+ ]
774
+ },
775
+ "double-one-regexp-named-group": {
776
+ "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
777
+ "beginCaptures": {
778
+ "1": {
779
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
780
+ },
781
+ "2": {
782
+ "name": "entity.name.tag.named.group.regexp"
783
+ }
784
+ },
785
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
786
+ "endCaptures": {
787
+ "1": {
788
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
789
+ },
790
+ "2": {
791
+ "name": "invalid.illegal.newline.python"
792
+ }
793
+ },
794
+ "name": "meta.named.regexp",
795
+ "patterns": [
796
+ {
797
+ "include": "#double-one-regexp-expression"
798
+ }
799
+ ]
800
+ },
801
+ "double-one-regexp-parentheses": {
802
+ "begin": "\\(",
803
+ "beginCaptures": {
804
+ "0": {
805
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
806
+ }
807
+ },
808
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
809
+ "endCaptures": {
810
+ "1": {
811
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
812
+ },
813
+ "2": {
814
+ "name": "invalid.illegal.newline.python"
815
+ }
816
+ },
817
+ "patterns": [
818
+ {
819
+ "include": "#double-one-regexp-expression"
820
+ }
821
+ ]
822
+ },
823
+ "double-one-regexp-parentheses-non-capturing": {
824
+ "begin": "\\(\\?:",
825
+ "beginCaptures": {
826
+ "0": {
827
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
828
+ }
829
+ },
830
+ "end": "(\\)|(?=\"))|((?=(?<!\\\\)\\n))",
831
+ "endCaptures": {
832
+ "1": {
833
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
834
+ },
835
+ "2": {
836
+ "name": "invalid.illegal.newline.python"
837
+ }
838
+ },
839
+ "patterns": [
840
+ {
841
+ "include": "#double-one-regexp-expression"
842
+ }
843
+ ]
844
+ },
845
+ "double-three-regexp-character-set": {
846
+ "patterns": [
847
+ {
848
+ "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
849
+ },
850
+ {
851
+ "begin": "(\\[)(\\^)?(\\])?",
852
+ "beginCaptures": {
853
+ "1": {
854
+ "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
855
+ },
856
+ "2": {
857
+ "name": "keyword.operator.negation.regexp"
858
+ },
859
+ "3": {
860
+ "name": "constant.character.set.regexp"
861
+ }
862
+ },
863
+ "end": "(\\]|(?=\"\"\"))",
864
+ "endCaptures": {
865
+ "1": {
866
+ "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
867
+ },
868
+ "2": {
869
+ "name": "invalid.illegal.newline.python"
870
+ }
871
+ },
872
+ "name": "meta.character.set.regexp",
873
+ "patterns": [
874
+ {
875
+ "include": "#regexp-charecter-set-escapes"
876
+ },
877
+ {
878
+ "match": "[^\\n]",
879
+ "name": "constant.character.set.regexp"
880
+ }
881
+ ]
882
+ }
883
+ ]
884
+ },
885
+ "double-three-regexp-comments": {
886
+ "begin": "\\(\\?#",
887
+ "beginCaptures": {
888
+ "0": {
889
+ "name": "punctuation.comment.begin.regexp"
890
+ }
891
+ },
892
+ "end": "(\\)|(?=\"\"\"))",
893
+ "endCaptures": {
894
+ "1": {
895
+ "name": "punctuation.comment.end.regexp"
896
+ },
897
+ "2": {
898
+ "name": "invalid.illegal.newline.python"
899
+ }
900
+ },
901
+ "name": "comment.regexp",
902
+ "patterns": [
903
+ {
904
+ "include": "#codetags"
905
+ }
906
+ ]
907
+ },
908
+ "double-three-regexp-conditional": {
909
+ "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
910
+ "beginCaptures": {
911
+ "0": {
912
+ "name": "keyword.operator.conditional.regexp"
913
+ },
914
+ "1": {
915
+ "name": "punctuation.parenthesis.conditional.begin.regexp"
916
+ }
917
+ },
918
+ "end": "(\\)|(?=\"\"\"))",
919
+ "endCaptures": {
920
+ "1": {
921
+ "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
922
+ },
923
+ "2": {
924
+ "name": "invalid.illegal.newline.python"
925
+ }
926
+ },
927
+ "patterns": [
928
+ {
929
+ "include": "#double-three-regexp-expression"
930
+ },
931
+ {
932
+ "include": "#comments-string-double-three"
933
+ }
934
+ ]
935
+ },
936
+ "double-three-regexp-expression": {
937
+ "patterns": [
938
+ {
939
+ "include": "#regexp-base-expression"
940
+ },
941
+ {
942
+ "include": "#double-three-regexp-character-set"
943
+ },
944
+ {
945
+ "include": "#double-three-regexp-comments"
946
+ },
947
+ {
948
+ "include": "#regexp-flags"
949
+ },
950
+ {
951
+ "include": "#double-three-regexp-named-group"
952
+ },
953
+ {
954
+ "include": "#regexp-backreference"
955
+ },
956
+ {
957
+ "include": "#double-three-regexp-lookahead"
958
+ },
959
+ {
960
+ "include": "#double-three-regexp-lookahead-negative"
961
+ },
962
+ {
963
+ "include": "#double-three-regexp-lookbehind"
964
+ },
965
+ {
966
+ "include": "#double-three-regexp-lookbehind-negative"
967
+ },
968
+ {
969
+ "include": "#double-three-regexp-conditional"
970
+ },
971
+ {
972
+ "include": "#double-three-regexp-parentheses-non-capturing"
973
+ },
974
+ {
975
+ "include": "#double-three-regexp-parentheses"
976
+ },
977
+ {
978
+ "include": "#comments-string-double-three"
979
+ }
980
+ ]
981
+ },
982
+ "double-three-regexp-lookahead": {
983
+ "begin": "(\\()\\?=",
984
+ "beginCaptures": {
985
+ "0": {
986
+ "name": "keyword.operator.lookahead.regexp"
987
+ },
988
+ "1": {
989
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
990
+ }
991
+ },
992
+ "end": "(\\)|(?=\"\"\"))",
993
+ "endCaptures": {
994
+ "1": {
995
+ "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
996
+ },
997
+ "2": {
998
+ "name": "invalid.illegal.newline.python"
999
+ }
1000
+ },
1001
+ "patterns": [
1002
+ {
1003
+ "include": "#double-three-regexp-expression"
1004
+ },
1005
+ {
1006
+ "include": "#comments-string-double-three"
1007
+ }
1008
+ ]
1009
+ },
1010
+ "double-three-regexp-lookahead-negative": {
1011
+ "begin": "(\\()\\?!",
1012
+ "beginCaptures": {
1013
+ "0": {
1014
+ "name": "keyword.operator.lookahead.negative.regexp"
1015
+ },
1016
+ "1": {
1017
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
1018
+ }
1019
+ },
1020
+ "end": "(\\)|(?=\"\"\"))",
1021
+ "endCaptures": {
1022
+ "1": {
1023
+ "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
1024
+ },
1025
+ "2": {
1026
+ "name": "invalid.illegal.newline.python"
1027
+ }
1028
+ },
1029
+ "patterns": [
1030
+ {
1031
+ "include": "#double-three-regexp-expression"
1032
+ },
1033
+ {
1034
+ "include": "#comments-string-double-three"
1035
+ }
1036
+ ]
1037
+ },
1038
+ "double-three-regexp-lookbehind": {
1039
+ "begin": "(\\()\\?<=",
1040
+ "beginCaptures": {
1041
+ "0": {
1042
+ "name": "keyword.operator.lookbehind.regexp"
1043
+ },
1044
+ "1": {
1045
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
1046
+ }
1047
+ },
1048
+ "end": "(\\)|(?=\"\"\"))",
1049
+ "endCaptures": {
1050
+ "1": {
1051
+ "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
1052
+ },
1053
+ "2": {
1054
+ "name": "invalid.illegal.newline.python"
1055
+ }
1056
+ },
1057
+ "patterns": [
1058
+ {
1059
+ "include": "#double-three-regexp-expression"
1060
+ },
1061
+ {
1062
+ "include": "#comments-string-double-three"
1063
+ }
1064
+ ]
1065
+ },
1066
+ "double-three-regexp-lookbehind-negative": {
1067
+ "begin": "(\\()\\?<!",
1068
+ "beginCaptures": {
1069
+ "0": {
1070
+ "name": "keyword.operator.lookbehind.negative.regexp"
1071
+ },
1072
+ "1": {
1073
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
1074
+ }
1075
+ },
1076
+ "end": "(\\)|(?=\"\"\"))",
1077
+ "endCaptures": {
1078
+ "1": {
1079
+ "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
1080
+ },
1081
+ "2": {
1082
+ "name": "invalid.illegal.newline.python"
1083
+ }
1084
+ },
1085
+ "patterns": [
1086
+ {
1087
+ "include": "#double-three-regexp-expression"
1088
+ },
1089
+ {
1090
+ "include": "#comments-string-double-three"
1091
+ }
1092
+ ]
1093
+ },
1094
+ "double-three-regexp-named-group": {
1095
+ "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
1096
+ "beginCaptures": {
1097
+ "1": {
1098
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
1099
+ },
1100
+ "2": {
1101
+ "name": "entity.name.tag.named.group.regexp"
1102
+ }
1103
+ },
1104
+ "end": "(\\)|(?=\"\"\"))",
1105
+ "endCaptures": {
1106
+ "1": {
1107
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
1108
+ },
1109
+ "2": {
1110
+ "name": "invalid.illegal.newline.python"
1111
+ }
1112
+ },
1113
+ "name": "meta.named.regexp",
1114
+ "patterns": [
1115
+ {
1116
+ "include": "#double-three-regexp-expression"
1117
+ },
1118
+ {
1119
+ "include": "#comments-string-double-three"
1120
+ }
1121
+ ]
1122
+ },
1123
+ "double-three-regexp-parentheses": {
1124
+ "begin": "\\(",
1125
+ "beginCaptures": {
1126
+ "0": {
1127
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
1128
+ }
1129
+ },
1130
+ "end": "(\\)|(?=\"\"\"))",
1131
+ "endCaptures": {
1132
+ "1": {
1133
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
1134
+ },
1135
+ "2": {
1136
+ "name": "invalid.illegal.newline.python"
1137
+ }
1138
+ },
1139
+ "patterns": [
1140
+ {
1141
+ "include": "#double-three-regexp-expression"
1142
+ },
1143
+ {
1144
+ "include": "#comments-string-double-three"
1145
+ }
1146
+ ]
1147
+ },
1148
+ "double-three-regexp-parentheses-non-capturing": {
1149
+ "begin": "\\(\\?:",
1150
+ "beginCaptures": {
1151
+ "0": {
1152
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
1153
+ }
1154
+ },
1155
+ "end": "(\\)|(?=\"\"\"))",
1156
+ "endCaptures": {
1157
+ "1": {
1158
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
1159
+ },
1160
+ "2": {
1161
+ "name": "invalid.illegal.newline.python"
1162
+ }
1163
+ },
1164
+ "patterns": [
1165
+ {
1166
+ "include": "#double-three-regexp-expression"
1167
+ },
1168
+ {
1169
+ "include": "#comments-string-double-three"
1170
+ }
1171
+ ]
1172
+ },
1173
+ "ellipsis": {
1174
+ "match": "\\.\\.\\.",
1175
+ "name": "constant.other.ellipsis.python"
1176
+ },
1177
+ "escape-sequence": {
1178
+ "match": "(?x)\n \\\\ (\n x[0-9A-Fa-f]{2}\n | [0-7]{1,3}\n | [\\\\\"'abfnrtv]\n )\n",
1179
+ "name": "constant.character.escape.python"
1180
+ },
1181
+ "escape-sequence-unicode": {
1182
+ "patterns": [
1183
+ {
1184
+ "match": "(?x)\n \\\\ (\n u[0-9A-Fa-f]{4}\n | U[0-9A-Fa-f]{8}\n | N\\{[\\w\\s]+?\\}\n )\n",
1185
+ "name": "constant.character.escape.python"
1186
+ }
1187
+ ]
1188
+ },
1189
+ "expression": {
1190
+ "comment": "All valid Python expressions",
1191
+ "patterns": [
1192
+ {
1193
+ "include": "#expression-base"
1194
+ },
1195
+ {
1196
+ "include": "#member-access"
1197
+ },
1198
+ {
1199
+ "comment": "Tokenize identifiers to help linters",
1200
+ "match": "(?x) \\b ([[:alpha:]_]\\w*) \\b"
1201
+ }
1202
+ ]
1203
+ },
1204
+ "expression-bare": {
1205
+ "comment": "valid Python expressions w/o comments and line continuation",
1206
+ "patterns": [
1207
+ {
1208
+ "include": "#backticks"
1209
+ },
1210
+ {
1211
+ "include": "#illegal-anno"
1212
+ },
1213
+ {
1214
+ "include": "#literal"
1215
+ },
1216
+ {
1217
+ "include": "#regexp"
1218
+ },
1219
+ {
1220
+ "include": "#string"
1221
+ },
1222
+ {
1223
+ "include": "#lambda"
1224
+ },
1225
+ {
1226
+ "include": "#generator"
1227
+ },
1228
+ {
1229
+ "include": "#illegal-operator"
1230
+ },
1231
+ {
1232
+ "include": "#operator"
1233
+ },
1234
+ {
1235
+ "include": "#curly-braces"
1236
+ },
1237
+ {
1238
+ "include": "#item-access"
1239
+ },
1240
+ {
1241
+ "include": "#list"
1242
+ },
1243
+ {
1244
+ "include": "#odd-function-call"
1245
+ },
1246
+ {
1247
+ "include": "#round-braces"
1248
+ },
1249
+ {
1250
+ "include": "#function-call"
1251
+ },
1252
+ {
1253
+ "include": "#builtin-functions"
1254
+ },
1255
+ {
1256
+ "include": "#builtin-types"
1257
+ },
1258
+ {
1259
+ "include": "#builtin-exceptions"
1260
+ },
1261
+ {
1262
+ "include": "#magic-names"
1263
+ },
1264
+ {
1265
+ "include": "#special-names"
1266
+ },
1267
+ {
1268
+ "include": "#illegal-names"
1269
+ },
1270
+ {
1271
+ "include": "#special-variables"
1272
+ },
1273
+ {
1274
+ "include": "#ellipsis"
1275
+ },
1276
+ {
1277
+ "include": "#punctuation"
1278
+ },
1279
+ {
1280
+ "include": "#line-continuation"
1281
+ }
1282
+ ]
1283
+ },
1284
+ "expression-base": {
1285
+ "comment": "valid Python expressions with comments and line continuation",
1286
+ "patterns": [
1287
+ {
1288
+ "include": "#comments"
1289
+ },
1290
+ {
1291
+ "include": "#expression-bare"
1292
+ },
1293
+ {
1294
+ "include": "#line-continuation"
1295
+ }
1296
+ ]
1297
+ },
1298
+ "f-expression": {
1299
+ "comment": "All valid Python expressions, except comments and line continuation",
1300
+ "patterns": [
1301
+ {
1302
+ "include": "#expression-bare"
1303
+ },
1304
+ {
1305
+ "include": "#member-access"
1306
+ },
1307
+ {
1308
+ "comment": "Tokenize identifiers to help linters",
1309
+ "match": "(?x) \\b ([[:alpha:]_]\\w*) \\b"
1310
+ }
1311
+ ]
1312
+ },
1313
+ "fregexp-base-expression": {
1314
+ "patterns": [
1315
+ {
1316
+ "include": "#fregexp-quantifier"
1317
+ },
1318
+ {
1319
+ "include": "#fstring-formatting-braces"
1320
+ },
1321
+ {
1322
+ "match": "\\{.*?\\}"
1323
+ },
1324
+ {
1325
+ "include": "#regexp-base-common"
1326
+ }
1327
+ ]
1328
+ },
1329
+ "fregexp-quantifier": {
1330
+ "match": "(?x)\n \\{\\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\\}\n",
1331
+ "name": "keyword.operator.quantifier.regexp"
1332
+ },
1333
+ "fstring-fnorm-quoted-multi-line": {
1334
+ "begin": "(\\b[fF])([bBuU])?('''|\"\"\")",
1335
+ "beginCaptures": {
1336
+ "1": {
1337
+ "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python"
1338
+ },
1339
+ "2": {
1340
+ "name": "invalid.illegal.prefix.python"
1341
+ },
1342
+ "3": {
1343
+ "name": "punctuation.definition.string.begin.python string.interpolated.python string.quoted.multi.python"
1344
+ }
1345
+ },
1346
+ "end": "(\\3)",
1347
+ "endCaptures": {
1348
+ "1": {
1349
+ "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python"
1350
+ },
1351
+ "2": {
1352
+ "name": "invalid.illegal.newline.python"
1353
+ }
1354
+ },
1355
+ "name": "meta.fstring.python",
1356
+ "patterns": [
1357
+ {
1358
+ "include": "#fstring-guts"
1359
+ },
1360
+ {
1361
+ "include": "#fstring-illegal-multi-brace"
1362
+ },
1363
+ {
1364
+ "include": "#fstring-multi-brace"
1365
+ },
1366
+ {
1367
+ "include": "#fstring-multi-core"
1368
+ }
1369
+ ]
1370
+ },
1371
+ "fstring-fnorm-quoted-single-line": {
1372
+ "begin": "(\\b[fF])([bBuU])?((['\"]))",
1373
+ "beginCaptures": {
1374
+ "1": {
1375
+ "name": "string.interpolated.python string.quoted.single.python storage.type.string.python"
1376
+ },
1377
+ "2": {
1378
+ "name": "invalid.illegal.prefix.python"
1379
+ },
1380
+ "3": {
1381
+ "name": "punctuation.definition.string.begin.python string.interpolated.python string.quoted.single.python"
1382
+ }
1383
+ },
1384
+ "end": "(\\3)|((?<!\\\\)\\n)",
1385
+ "endCaptures": {
1386
+ "1": {
1387
+ "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python"
1388
+ },
1389
+ "2": {
1390
+ "name": "invalid.illegal.newline.python"
1391
+ }
1392
+ },
1393
+ "name": "meta.fstring.python",
1394
+ "patterns": [
1395
+ {
1396
+ "include": "#fstring-guts"
1397
+ },
1398
+ {
1399
+ "include": "#fstring-illegal-single-brace"
1400
+ },
1401
+ {
1402
+ "include": "#fstring-single-brace"
1403
+ },
1404
+ {
1405
+ "include": "#fstring-single-core"
1406
+ }
1407
+ ]
1408
+ },
1409
+ "fstring-formatting": {
1410
+ "patterns": [
1411
+ {
1412
+ "include": "#fstring-formatting-braces"
1413
+ },
1414
+ {
1415
+ "include": "#fstring-formatting-singe-brace"
1416
+ }
1417
+ ]
1418
+ },
1419
+ "fstring-formatting-braces": {
1420
+ "patterns": [
1421
+ {
1422
+ "captures": {
1423
+ "1": {
1424
+ "name": "constant.character.format.placeholder.other.python"
1425
+ },
1426
+ "2": {
1427
+ "name": "invalid.illegal.brace.python"
1428
+ },
1429
+ "3": {
1430
+ "name": "constant.character.format.placeholder.other.python"
1431
+ }
1432
+ },
1433
+ "comment": "empty braces are illegal",
1434
+ "match": "({)(\\s*?)(})"
1435
+ },
1436
+ {
1437
+ "match": "({{|}})",
1438
+ "name": "constant.character.escape.python"
1439
+ }
1440
+ ]
1441
+ },
1442
+ "fstring-formatting-singe-brace": {
1443
+ "match": "(}(?!}))",
1444
+ "name": "invalid.illegal.brace.python"
1445
+ },
1446
+ "fstring-guts": {
1447
+ "patterns": [
1448
+ {
1449
+ "include": "#escape-sequence-unicode"
1450
+ },
1451
+ {
1452
+ "include": "#escape-sequence"
1453
+ },
1454
+ {
1455
+ "include": "#string-line-continuation"
1456
+ },
1457
+ {
1458
+ "include": "#fstring-formatting"
1459
+ }
1460
+ ]
1461
+ },
1462
+ "fstring-illegal-multi-brace": {
1463
+ "patterns": [
1464
+ {
1465
+ "include": "#impossible"
1466
+ }
1467
+ ]
1468
+ },
1469
+ "fstring-illegal-single-brace": {
1470
+ "begin": "(\\{)(?=[^\\n}]*$\\n?)",
1471
+ "beginCaptures": {
1472
+ "1": {
1473
+ "name": "constant.character.format.placeholder.other.python"
1474
+ }
1475
+ },
1476
+ "comment": "it is illegal to have a multiline brace inside a single-line string",
1477
+ "end": "(\\})|(?=\\n)",
1478
+ "endCaptures": {
1479
+ "1": {
1480
+ "name": "constant.character.format.placeholder.other.python"
1481
+ }
1482
+ },
1483
+ "patterns": [
1484
+ {
1485
+ "include": "#fstring-terminator-single"
1486
+ },
1487
+ {
1488
+ "include": "#f-expression"
1489
+ }
1490
+ ]
1491
+ },
1492
+ "fstring-multi-brace": {
1493
+ "begin": "(\\{)",
1494
+ "beginCaptures": {
1495
+ "1": {
1496
+ "name": "constant.character.format.placeholder.other.python"
1497
+ }
1498
+ },
1499
+ "comment": "value interpolation using { ... }",
1500
+ "end": "(?x)\n (\\})\n",
1501
+ "endCaptures": {
1502
+ "1": {
1503
+ "name": "constant.character.format.placeholder.other.python"
1504
+ }
1505
+ },
1506
+ "patterns": [
1507
+ {
1508
+ "include": "#fstring-terminator-multi"
1509
+ },
1510
+ {
1511
+ "include": "#f-expression"
1512
+ }
1513
+ ]
1514
+ },
1515
+ "fstring-multi-core": {
1516
+ "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n",
1517
+ "name": "string.interpolated.python string.quoted.multi.python"
1518
+ },
1519
+ "fstring-normf-quoted-multi-line": {
1520
+ "begin": "(\\b[bBuU])([fF])('''|\"\"\")",
1521
+ "beginCaptures": {
1522
+ "1": {
1523
+ "name": "invalid.illegal.prefix.python"
1524
+ },
1525
+ "2": {
1526
+ "name": "string.interpolated.python string.quoted.multi.python storage.type.string.python"
1527
+ },
1528
+ "3": {
1529
+ "name": "punctuation.definition.string.begin.python string.quoted.multi.python"
1530
+ }
1531
+ },
1532
+ "end": "(\\3)",
1533
+ "endCaptures": {
1534
+ "1": {
1535
+ "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python"
1536
+ },
1537
+ "2": {
1538
+ "name": "invalid.illegal.newline.python"
1539
+ }
1540
+ },
1541
+ "name": "meta.fstring.python",
1542
+ "patterns": [
1543
+ {
1544
+ "include": "#fstring-guts"
1545
+ },
1546
+ {
1547
+ "include": "#fstring-illegal-multi-brace"
1548
+ },
1549
+ {
1550
+ "include": "#fstring-multi-brace"
1551
+ },
1552
+ {
1553
+ "include": "#fstring-multi-core"
1554
+ }
1555
+ ]
1556
+ },
1557
+ "fstring-normf-quoted-single-line": {
1558
+ "begin": "(\\b[bBuU])([fF])((['\"]))",
1559
+ "beginCaptures": {
1560
+ "1": {
1561
+ "name": "invalid.illegal.prefix.python"
1562
+ },
1563
+ "2": {
1564
+ "name": "string.interpolated.python string.quoted.single.python storage.type.string.python"
1565
+ },
1566
+ "3": {
1567
+ "name": "punctuation.definition.string.begin.python string.quoted.single.python"
1568
+ }
1569
+ },
1570
+ "end": "(\\3)|((?<!\\\\)\\n)",
1571
+ "endCaptures": {
1572
+ "1": {
1573
+ "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python"
1574
+ },
1575
+ "2": {
1576
+ "name": "invalid.illegal.newline.python"
1577
+ }
1578
+ },
1579
+ "name": "meta.fstring.python",
1580
+ "patterns": [
1581
+ {
1582
+ "include": "#fstring-guts"
1583
+ },
1584
+ {
1585
+ "include": "#fstring-illegal-single-brace"
1586
+ },
1587
+ {
1588
+ "include": "#fstring-single-brace"
1589
+ },
1590
+ {
1591
+ "include": "#fstring-single-core"
1592
+ }
1593
+ ]
1594
+ },
1595
+ "fstring-raw-guts": {
1596
+ "patterns": [
1597
+ {
1598
+ "include": "#string-consume-escape"
1599
+ },
1600
+ {
1601
+ "include": "#fstring-formatting"
1602
+ }
1603
+ ]
1604
+ },
1605
+ "fstring-raw-multi-core": {
1606
+ "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|'''|\"\"\")\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n",
1607
+ "name": "string.interpolated.python string.quoted.raw.multi.python"
1608
+ },
1609
+ "fstring-raw-quoted-multi-line": {
1610
+ "begin": "(\\b(?:[rR][fF]|[fF][rR]))('''|\"\"\")",
1611
+ "beginCaptures": {
1612
+ "1": {
1613
+ "name": "string.interpolated.python string.quoted.raw.multi.python storage.type.string.python"
1614
+ },
1615
+ "2": {
1616
+ "name": "punctuation.definition.string.begin.python string.quoted.raw.multi.python"
1617
+ }
1618
+ },
1619
+ "end": "(\\2)",
1620
+ "endCaptures": {
1621
+ "1": {
1622
+ "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.multi.python"
1623
+ },
1624
+ "2": {
1625
+ "name": "invalid.illegal.newline.python"
1626
+ }
1627
+ },
1628
+ "name": "meta.fstring.python",
1629
+ "patterns": [
1630
+ {
1631
+ "include": "#fstring-raw-guts"
1632
+ },
1633
+ {
1634
+ "include": "#fstring-illegal-multi-brace"
1635
+ },
1636
+ {
1637
+ "include": "#fstring-multi-brace"
1638
+ },
1639
+ {
1640
+ "include": "#fstring-raw-multi-core"
1641
+ }
1642
+ ]
1643
+ },
1644
+ "fstring-raw-quoted-single-line": {
1645
+ "begin": "(\\b(?:[rR][fF]|[fF][rR]))((['\"]))",
1646
+ "beginCaptures": {
1647
+ "1": {
1648
+ "name": "string.interpolated.python string.quoted.raw.single.python storage.type.string.python"
1649
+ },
1650
+ "2": {
1651
+ "name": "punctuation.definition.string.begin.python string.quoted.raw.single.python"
1652
+ }
1653
+ },
1654
+ "end": "(\\2)|((?<!\\\\)\\n)",
1655
+ "endCaptures": {
1656
+ "1": {
1657
+ "name": "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.single.python"
1658
+ },
1659
+ "2": {
1660
+ "name": "invalid.illegal.newline.python"
1661
+ }
1662
+ },
1663
+ "name": "meta.fstring.python",
1664
+ "patterns": [
1665
+ {
1666
+ "include": "#fstring-raw-guts"
1667
+ },
1668
+ {
1669
+ "include": "#fstring-illegal-single-brace"
1670
+ },
1671
+ {
1672
+ "include": "#fstring-single-brace"
1673
+ },
1674
+ {
1675
+ "include": "#fstring-raw-single-core"
1676
+ }
1677
+ ]
1678
+ },
1679
+ "fstring-raw-single-core": {
1680
+ "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|(['\"])|((?<!\\\\)\\n))\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n",
1681
+ "name": "string.interpolated.python string.quoted.raw.single.python"
1682
+ },
1683
+ "fstring-single-brace": {
1684
+ "begin": "(\\{)",
1685
+ "beginCaptures": {
1686
+ "1": {
1687
+ "name": "constant.character.format.placeholder.other.python"
1688
+ }
1689
+ },
1690
+ "comment": "value interpolation using { ... }",
1691
+ "end": "(?x)\n (\\})|(?=\\n)\n",
1692
+ "endCaptures": {
1693
+ "1": {
1694
+ "name": "constant.character.format.placeholder.other.python"
1695
+ }
1696
+ },
1697
+ "patterns": [
1698
+ {
1699
+ "include": "#fstring-terminator-single"
1700
+ },
1701
+ {
1702
+ "include": "#f-expression"
1703
+ }
1704
+ ]
1705
+ },
1706
+ "fstring-single-core": {
1707
+ "match": "(?x)\n (.+?)\n (\n (?# .* and .*? in multi-line match need special handling of\n newlines otherwise SublimeText and Atom will match slightly\n differently.\n\n The guard for newlines has to be separate from the\n lookahead because of special $ matching rule.)\n ($\\n?)\n |\n (?=[\\\\\\}\\{]|(['\"])|((?<!\\\\)\\n))\n )\n (?# due to how multiline regexps are matched we need a special case\n for matching a newline character)\n | \\n\n",
1708
+ "name": "string.interpolated.python string.quoted.single.python"
1709
+ },
1710
+ "fstring-terminator-multi": {
1711
+ "patterns": [
1712
+ {
1713
+ "match": "(=(![rsa])?)(?=})",
1714
+ "name": "storage.type.format.python"
1715
+ },
1716
+ {
1717
+ "match": "(=?![rsa])(?=})",
1718
+ "name": "storage.type.format.python"
1719
+ },
1720
+ {
1721
+ "captures": {
1722
+ "1": {
1723
+ "name": "storage.type.format.python"
1724
+ },
1725
+ "2": {
1726
+ "name": "storage.type.format.python"
1727
+ }
1728
+ },
1729
+ "match": "(?x)\n ( (?: =?) (?: ![rsa])? )\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n"
1730
+ },
1731
+ {
1732
+ "include": "#fstring-terminator-multi-tail"
1733
+ }
1734
+ ]
1735
+ },
1736
+ "fstring-terminator-multi-tail": {
1737
+ "begin": "((?:=?)(?:![rsa])?)(:)(?=.*?{)",
1738
+ "beginCaptures": {
1739
+ "1": {
1740
+ "name": "storage.type.format.python"
1741
+ },
1742
+ "2": {
1743
+ "name": "storage.type.format.python"
1744
+ }
1745
+ },
1746
+ "end": "(?=})",
1747
+ "patterns": [
1748
+ {
1749
+ "include": "#fstring-illegal-multi-brace"
1750
+ },
1751
+ {
1752
+ "include": "#fstring-multi-brace"
1753
+ },
1754
+ {
1755
+ "match": "([bcdeEfFgGnosxX%])(?=})",
1756
+ "name": "storage.type.format.python"
1757
+ },
1758
+ {
1759
+ "match": "(\\.\\d+)",
1760
+ "name": "storage.type.format.python"
1761
+ },
1762
+ {
1763
+ "match": "(,)",
1764
+ "name": "storage.type.format.python"
1765
+ },
1766
+ {
1767
+ "match": "(\\d+)",
1768
+ "name": "storage.type.format.python"
1769
+ },
1770
+ {
1771
+ "match": "(\\#)",
1772
+ "name": "storage.type.format.python"
1773
+ },
1774
+ {
1775
+ "match": "([-+ ])",
1776
+ "name": "storage.type.format.python"
1777
+ },
1778
+ {
1779
+ "match": "([<>=^])",
1780
+ "name": "storage.type.format.python"
1781
+ },
1782
+ {
1783
+ "match": "(\\w)",
1784
+ "name": "storage.type.format.python"
1785
+ }
1786
+ ]
1787
+ },
1788
+ "fstring-terminator-single": {
1789
+ "patterns": [
1790
+ {
1791
+ "match": "(=(![rsa])?)(?=})",
1792
+ "name": "storage.type.format.python"
1793
+ },
1794
+ {
1795
+ "match": "(=?![rsa])(?=})",
1796
+ "name": "storage.type.format.python"
1797
+ },
1798
+ {
1799
+ "captures": {
1800
+ "1": {
1801
+ "name": "storage.type.format.python"
1802
+ },
1803
+ "2": {
1804
+ "name": "storage.type.format.python"
1805
+ }
1806
+ },
1807
+ "match": "(?x)\n ( (?: =?) (?: ![rsa])? )\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n"
1808
+ },
1809
+ {
1810
+ "include": "#fstring-terminator-single-tail"
1811
+ }
1812
+ ]
1813
+ },
1814
+ "fstring-terminator-single-tail": {
1815
+ "begin": "((?:=?)(?:![rsa])?)(:)(?=.*?{)",
1816
+ "beginCaptures": {
1817
+ "1": {
1818
+ "name": "storage.type.format.python"
1819
+ },
1820
+ "2": {
1821
+ "name": "storage.type.format.python"
1822
+ }
1823
+ },
1824
+ "end": "(?=})|(?=\\n)",
1825
+ "patterns": [
1826
+ {
1827
+ "include": "#fstring-illegal-single-brace"
1828
+ },
1829
+ {
1830
+ "include": "#fstring-single-brace"
1831
+ },
1832
+ {
1833
+ "match": "([bcdeEfFgGnosxX%])(?=})",
1834
+ "name": "storage.type.format.python"
1835
+ },
1836
+ {
1837
+ "match": "(\\.\\d+)",
1838
+ "name": "storage.type.format.python"
1839
+ },
1840
+ {
1841
+ "match": "(,)",
1842
+ "name": "storage.type.format.python"
1843
+ },
1844
+ {
1845
+ "match": "(\\d+)",
1846
+ "name": "storage.type.format.python"
1847
+ },
1848
+ {
1849
+ "match": "(\\#)",
1850
+ "name": "storage.type.format.python"
1851
+ },
1852
+ {
1853
+ "match": "([-+ ])",
1854
+ "name": "storage.type.format.python"
1855
+ },
1856
+ {
1857
+ "match": "([<>=^])",
1858
+ "name": "storage.type.format.python"
1859
+ },
1860
+ {
1861
+ "match": "(\\w)",
1862
+ "name": "storage.type.format.python"
1863
+ }
1864
+ ]
1865
+ },
1866
+ "function-arguments": {
1867
+ "begin": "(\\()",
1868
+ "beginCaptures": {
1869
+ "1": {
1870
+ "name": "punctuation.definition.arguments.begin.python"
1871
+ }
1872
+ },
1873
+ "contentName": "meta.function-call.arguments.python",
1874
+ "end": "(?=\\))(?!\\)\\s*\\()",
1875
+ "patterns": [
1876
+ {
1877
+ "match": "(,)",
1878
+ "name": "punctuation.separator.arguments.python"
1879
+ },
1880
+ {
1881
+ "captures": {
1882
+ "1": {
1883
+ "name": "keyword.operator.unpacking.arguments.python"
1884
+ }
1885
+ },
1886
+ "match": "(?x)\n (?:(?<=[,(])|^) \\s* (\\*{1,2})\n"
1887
+ },
1888
+ {
1889
+ "include": "#lambda-incomplete"
1890
+ },
1891
+ {
1892
+ "include": "#illegal-names"
1893
+ },
1894
+ {
1895
+ "captures": {
1896
+ "1": {
1897
+ "name": "variable.parameter.function-call.python"
1898
+ },
1899
+ "2": {
1900
+ "name": "keyword.operator.assignment.python"
1901
+ }
1902
+ },
1903
+ "match": "\\b([[:alpha:]_]\\w*)\\s*(=)(?!=)"
1904
+ },
1905
+ {
1906
+ "match": "=(?!=)",
1907
+ "name": "keyword.operator.assignment.python"
1908
+ },
1909
+ {
1910
+ "include": "#expression"
1911
+ },
1912
+ {
1913
+ "captures": {
1914
+ "1": {
1915
+ "name": "punctuation.definition.arguments.end.python"
1916
+ },
1917
+ "2": {
1918
+ "name": "punctuation.definition.arguments.begin.python"
1919
+ }
1920
+ },
1921
+ "match": "\\s*(\\))\\s*(\\()"
1922
+ }
1923
+ ]
1924
+ },
1925
+ "function-call": {
1926
+ "begin": "(?x)\n \\b(?=\n ([[:alpha:]_]\\w*) \\s* (\\()\n )\n",
1927
+ "comment": "Regular function call of the type \"name(args)\"",
1928
+ "end": "(\\))",
1929
+ "endCaptures": {
1930
+ "1": {
1931
+ "name": "punctuation.definition.arguments.end.python"
1932
+ }
1933
+ },
1934
+ "name": "meta.function-call.python",
1935
+ "patterns": [
1936
+ {
1937
+ "include": "#special-variables"
1938
+ },
1939
+ {
1940
+ "include": "#function-name"
1941
+ },
1942
+ {
1943
+ "include": "#function-arguments"
1944
+ }
1945
+ ]
1946
+ },
1947
+ "function-declaration": {
1948
+ "begin": "(?x)\n \\s*\n (?:\\b(async) \\s+)? \\b(def)\\s+\n (?=\n [[:alpha:]_][[:word:]]* \\s* \\(\n )\n",
1949
+ "beginCaptures": {
1950
+ "1": {
1951
+ "name": "storage.type.function.async.python"
1952
+ },
1953
+ "2": {
1954
+ "name": "storage.type.function.python"
1955
+ }
1956
+ },
1957
+ "end": "(:|(?=[#'\"\\n]))",
1958
+ "endCaptures": {
1959
+ "1": {
1960
+ "name": "punctuation.section.function.begin.python"
1961
+ }
1962
+ },
1963
+ "name": "meta.function.python",
1964
+ "patterns": [
1965
+ {
1966
+ "include": "#function-def-name"
1967
+ },
1968
+ {
1969
+ "include": "#parameters"
1970
+ },
1971
+ {
1972
+ "include": "#line-continuation"
1973
+ },
1974
+ {
1975
+ "include": "#return-annotation"
1976
+ }
1977
+ ]
1978
+ },
1979
+ "function-def-name": {
1980
+ "patterns": [
1981
+ {
1982
+ "include": "#illegal-object-name"
1983
+ },
1984
+ {
1985
+ "include": "#builtin-possible-callables"
1986
+ },
1987
+ {
1988
+ "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n",
1989
+ "name": "entity.name.function.python"
1990
+ }
1991
+ ]
1992
+ },
1993
+ "function-name": {
1994
+ "patterns": [
1995
+ {
1996
+ "include": "#builtin-possible-callables"
1997
+ },
1998
+ {
1999
+ "comment": "Some color schemas support meta.function-call.generic scope",
2000
+ "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n",
2001
+ "name": "meta.function-call.generic.python"
2002
+ }
2003
+ ]
2004
+ },
2005
+ "generator": {
2006
+ "begin": "\\bfor\\b",
2007
+ "beginCaptures": {
2008
+ "0": {
2009
+ "name": "keyword.control.flow.python"
2010
+ }
2011
+ },
2012
+ "comment": "Match \"for ... in\" construct used in generators and for loops to\ncorrectly identify the \"in\" as a control flow keyword.\n",
2013
+ "end": "\\bin\\b",
2014
+ "endCaptures": {
2015
+ "0": {
2016
+ "name": "keyword.control.flow.python"
2017
+ }
2018
+ },
2019
+ "patterns": [
2020
+ {
2021
+ "include": "#expression"
2022
+ }
2023
+ ]
2024
+ },
2025
+ "illegal-anno": {
2026
+ "match": "->",
2027
+ "name": "invalid.illegal.annotation.python"
2028
+ },
2029
+ "illegal-names": {
2030
+ "captures": {
2031
+ "1": {
2032
+ "name": "keyword.control.flow.python"
2033
+ },
2034
+ "2": {
2035
+ "name": "keyword.control.import.python"
2036
+ }
2037
+ },
2038
+ "match": "(?x)\n \\b(?:\n (\n and | assert | async | await | break | class | continue | def\n | del | elif | else | except | finally | for | from | global\n | if | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=])\n | nonlocal | not | or | pass | raise | return | try | while | with\n | yield\n ) | (\n as | import\n )\n )\\b\n"
2039
+ },
2040
+ "illegal-object-name": {
2041
+ "comment": "It's illegal to name class or function \"True\"",
2042
+ "match": "\\b(True|False|None)\\b",
2043
+ "name": "keyword.illegal.name.python"
2044
+ },
2045
+ "illegal-operator": {
2046
+ "patterns": [
2047
+ {
2048
+ "match": "&&|\\|\\||--|\\+\\+",
2049
+ "name": "invalid.illegal.operator.python"
2050
+ },
2051
+ {
2052
+ "match": "[?$]",
2053
+ "name": "invalid.illegal.operator.python"
2054
+ },
2055
+ {
2056
+ "comment": "We don't want `!` to flash when we're typing `!=`",
2057
+ "match": "!\\b",
2058
+ "name": "invalid.illegal.operator.python"
2059
+ }
2060
+ ]
2061
+ },
2062
+ "import": {
2063
+ "comment": "Import statements used to correctly mark `from`, `import`, and `as`\n",
2064
+ "patterns": [
2065
+ {
2066
+ "begin": "\\b(?<!\\.)(from)\\b(?=.+import)",
2067
+ "beginCaptures": {
2068
+ "1": {
2069
+ "name": "keyword.control.import.python"
2070
+ }
2071
+ },
2072
+ "end": "$|(?=import)",
2073
+ "patterns": [
2074
+ {
2075
+ "match": "\\.+",
2076
+ "name": "punctuation.separator.period.python"
2077
+ },
2078
+ {
2079
+ "include": "#expression"
2080
+ }
2081
+ ]
2082
+ },
2083
+ {
2084
+ "begin": "\\b(?<!\\.)(import)\\b",
2085
+ "beginCaptures": {
2086
+ "1": {
2087
+ "name": "keyword.control.import.python"
2088
+ }
2089
+ },
2090
+ "end": "$",
2091
+ "patterns": [
2092
+ {
2093
+ "match": "\\b(?<!\\.)as\\b",
2094
+ "name": "keyword.control.import.python"
2095
+ },
2096
+ {
2097
+ "include": "#expression"
2098
+ }
2099
+ ]
2100
+ }
2101
+ ]
2102
+ },
2103
+ "impossible": {
2104
+ "comment": "This is a special rule that should be used where no match is desired. It is not a good idea to match something like '1{0}' because in some cases that can result in infinite loops in token generation. So the rule instead matches and impossible expression to allow a match to fail and move to the next token.",
2105
+ "match": "$.^"
2106
+ },
2107
+ "inheritance-identifier": {
2108
+ "captures": {
2109
+ "1": {
2110
+ "name": "entity.other.inherited-class.python"
2111
+ }
2112
+ },
2113
+ "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n"
2114
+ },
2115
+ "inheritance-name": {
2116
+ "patterns": [
2117
+ {
2118
+ "include": "#lambda-incomplete"
2119
+ },
2120
+ {
2121
+ "include": "#builtin-possible-callables"
2122
+ },
2123
+ {
2124
+ "include": "#inheritance-identifier"
2125
+ }
2126
+ ]
2127
+ },
2128
+ "item-access": {
2129
+ "patterns": [
2130
+ {
2131
+ "begin": "(?x)\n \\b(?=\n [[:alpha:]_]\\w* \\s* \\[\n )\n",
2132
+ "end": "(\\])",
2133
+ "endCaptures": {
2134
+ "1": {
2135
+ "name": "punctuation.definition.arguments.end.python"
2136
+ }
2137
+ },
2138
+ "name": "meta.item-access.python",
2139
+ "patterns": [
2140
+ {
2141
+ "include": "#item-name"
2142
+ },
2143
+ {
2144
+ "include": "#item-index"
2145
+ },
2146
+ {
2147
+ "include": "#expression"
2148
+ }
2149
+ ]
2150
+ }
2151
+ ]
2152
+ },
2153
+ "item-index": {
2154
+ "begin": "(\\[)",
2155
+ "beginCaptures": {
2156
+ "1": {
2157
+ "name": "punctuation.definition.arguments.begin.python"
2158
+ }
2159
+ },
2160
+ "contentName": "meta.item-access.arguments.python",
2161
+ "end": "(?=\\])",
2162
+ "patterns": [
2163
+ {
2164
+ "match": ":",
2165
+ "name": "punctuation.separator.slice.python"
2166
+ },
2167
+ {
2168
+ "include": "#expression"
2169
+ }
2170
+ ]
2171
+ },
2172
+ "item-name": {
2173
+ "patterns": [
2174
+ {
2175
+ "include": "#special-variables"
2176
+ },
2177
+ {
2178
+ "include": "#builtin-functions"
2179
+ },
2180
+ {
2181
+ "include": "#special-names"
2182
+ },
2183
+ {
2184
+ "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n",
2185
+ "name": "meta.indexed-name.python"
2186
+ }
2187
+ ]
2188
+ },
2189
+ "lambda": {
2190
+ "patterns": [
2191
+ {
2192
+ "captures": {
2193
+ "1": {
2194
+ "name": "keyword.control.flow.python"
2195
+ }
2196
+ },
2197
+ "match": "((?<=\\.)lambda|lambda(?=\\s*[\\.=]))"
2198
+ },
2199
+ {
2200
+ "captures": {
2201
+ "1": {
2202
+ "name": "storage.type.function.lambda.python"
2203
+ }
2204
+ },
2205
+ "match": "\\b(lambda)\\s*?(?=[,\\n]|$)"
2206
+ },
2207
+ {
2208
+ "begin": "(?x)\n \\b (lambda) \\b\n",
2209
+ "beginCaptures": {
2210
+ "1": {
2211
+ "name": "storage.type.function.lambda.python"
2212
+ }
2213
+ },
2214
+ "contentName": "meta.function.lambda.parameters.python",
2215
+ "end": "(:)|(\\n)",
2216
+ "endCaptures": {
2217
+ "1": {
2218
+ "name": "punctuation.section.function.lambda.begin.python"
2219
+ }
2220
+ },
2221
+ "name": "meta.lambda-function.python",
2222
+ "patterns": [
2223
+ {
2224
+ "match": "/",
2225
+ "name": "keyword.operator.positional.parameter.python"
2226
+ },
2227
+ {
2228
+ "match": "(\\*\\*|\\*)",
2229
+ "name": "keyword.operator.unpacking.parameter.python"
2230
+ },
2231
+ {
2232
+ "include": "#lambda-nested-incomplete"
2233
+ },
2234
+ {
2235
+ "include": "#illegal-names"
2236
+ },
2237
+ {
2238
+ "captures": {
2239
+ "1": {
2240
+ "name": "variable.parameter.function.language.python"
2241
+ },
2242
+ "2": {
2243
+ "name": "punctuation.separator.parameters.python"
2244
+ }
2245
+ },
2246
+ "match": "([[:alpha:]_]\\w*)\\s*(?:(,)|(?=:|$))"
2247
+ },
2248
+ {
2249
+ "include": "#comments"
2250
+ },
2251
+ {
2252
+ "include": "#backticks"
2253
+ },
2254
+ {
2255
+ "include": "#illegal-anno"
2256
+ },
2257
+ {
2258
+ "include": "#lambda-parameter-with-default"
2259
+ },
2260
+ {
2261
+ "include": "#line-continuation"
2262
+ },
2263
+ {
2264
+ "include": "#illegal-operator"
2265
+ }
2266
+ ]
2267
+ }
2268
+ ]
2269
+ },
2270
+ "lambda-incomplete": {
2271
+ "match": "\\blambda(?=\\s*[,)])",
2272
+ "name": "storage.type.function.lambda.python"
2273
+ },
2274
+ "lambda-nested-incomplete": {
2275
+ "match": "\\blambda(?=\\s*[:,)])",
2276
+ "name": "storage.type.function.lambda.python"
2277
+ },
2278
+ "lambda-parameter-with-default": {
2279
+ "begin": "(?x)\n \\b\n ([[:alpha:]_]\\w*) \\s* (=)\n",
2280
+ "beginCaptures": {
2281
+ "1": {
2282
+ "name": "variable.parameter.function.language.python"
2283
+ },
2284
+ "2": {
2285
+ "name": "keyword.operator.python"
2286
+ }
2287
+ },
2288
+ "end": "(,)|(?=:|$)",
2289
+ "endCaptures": {
2290
+ "1": {
2291
+ "name": "punctuation.separator.parameters.python"
2292
+ }
2293
+ },
2294
+ "patterns": [
2295
+ {
2296
+ "include": "#expression"
2297
+ }
2298
+ ]
2299
+ },
2300
+ "line-continuation": {
2301
+ "patterns": [
2302
+ {
2303
+ "captures": {
2304
+ "1": {
2305
+ "name": "punctuation.separator.continuation.line.python"
2306
+ },
2307
+ "2": {
2308
+ "name": "invalid.illegal.line.continuation.python"
2309
+ }
2310
+ },
2311
+ "match": "(\\\\)\\s*(\\S.*$\\n?)"
2312
+ },
2313
+ {
2314
+ "begin": "(\\\\)\\s*$\\n?",
2315
+ "beginCaptures": {
2316
+ "1": {
2317
+ "name": "punctuation.separator.continuation.line.python"
2318
+ }
2319
+ },
2320
+ "end": "(?x)\n (?=^\\s*$)\n |\n (?! (\\s* [rR]? (\\'\\'\\'|\\\"\\\"\\\"|\\'|\\\"))\n |\n (\\G $) (?# '\\G' is necessary for ST)\n )\n",
2321
+ "patterns": [
2322
+ {
2323
+ "include": "#regexp"
2324
+ },
2325
+ {
2326
+ "include": "#string"
2327
+ }
2328
+ ]
2329
+ }
2330
+ ]
2331
+ },
2332
+ "list": {
2333
+ "begin": "\\[",
2334
+ "beginCaptures": {
2335
+ "0": {
2336
+ "name": "punctuation.definition.list.begin.python"
2337
+ }
2338
+ },
2339
+ "end": "\\]",
2340
+ "endCaptures": {
2341
+ "0": {
2342
+ "name": "punctuation.definition.list.end.python"
2343
+ }
2344
+ },
2345
+ "patterns": [
2346
+ {
2347
+ "include": "#expression"
2348
+ }
2349
+ ]
2350
+ },
2351
+ "literal": {
2352
+ "patterns": [
2353
+ {
2354
+ "match": "\\b(True|False|None|NotImplemented|Ellipsis)\\b",
2355
+ "name": "constant.language.python"
2356
+ },
2357
+ {
2358
+ "include": "#number"
2359
+ }
2360
+ ]
2361
+ },
2362
+ "loose-default": {
2363
+ "begin": "(=)",
2364
+ "beginCaptures": {
2365
+ "1": {
2366
+ "name": "keyword.operator.python"
2367
+ }
2368
+ },
2369
+ "end": "(,)|(?=\\))",
2370
+ "endCaptures": {
2371
+ "1": {
2372
+ "name": "punctuation.separator.parameters.python"
2373
+ }
2374
+ },
2375
+ "patterns": [
2376
+ {
2377
+ "include": "#expression"
2378
+ }
2379
+ ]
2380
+ },
2381
+ "magic-function-names": {
2382
+ "captures": {
2383
+ "1": {
2384
+ "name": "support.function.magic.python"
2385
+ }
2386
+ },
2387
+ "comment": "these methods have magic interpretation by python and are generally called\nindirectly through syntactic constructs\n",
2388
+ "match": "(?x)\n \\b(\n __(?:\n abs | add | aenter | aexit | aiter | and | anext\n | await | bool | call | ceil | class_getitem\n | cmp | coerce | complex | contains | copy\n | deepcopy | del | delattr | delete | delitem\n | delslice | dir | div | divmod | enter | eq\n | exit | float | floor | floordiv | format | ge\n | get | getattr | getattribute | getinitargs\n | getitem | getnewargs | getslice | getstate | gt\n | hash | hex | iadd | iand | idiv | ifloordiv |\n | ilshift | imod | imul | index | init\n | instancecheck | int | invert | ior | ipow\n | irshift | isub | iter | itruediv | ixor | le\n | len | long | lshift | lt | missing | mod | mul\n | ne | neg | new | next | nonzero | oct | or | pos\n | pow | radd | rand | rdiv | rdivmod | reduce\n | reduce_ex | repr | reversed | rfloordiv |\n | rlshift | rmod | rmul | ror | round | rpow\n | rrshift | rshift | rsub | rtruediv | rxor | set\n | setattr | setitem | set_name | setslice\n | setstate | sizeof | str | sub | subclasscheck\n | truediv | trunc | unicode | xor | matmul\n | rmatmul | imatmul | init_subclass | set_name\n | fspath | bytes | prepare | length_hint\n )__\n )\\b\n"
2389
+ },
2390
+ "magic-names": {
2391
+ "patterns": [
2392
+ {
2393
+ "include": "#magic-function-names"
2394
+ },
2395
+ {
2396
+ "include": "#magic-variable-names"
2397
+ }
2398
+ ]
2399
+ },
2400
+ "magic-variable-names": {
2401
+ "captures": {
2402
+ "1": {
2403
+ "name": "support.variable.magic.python"
2404
+ }
2405
+ },
2406
+ "comment": "magic variables which a class/module may have.",
2407
+ "match": "(?x)\n \\b(\n __(?:\n all | annotations | bases | builtins | class\n | closure | code | debug | defaults | dict | doc | file | func\n | globals | kwdefaults | match_args | members | metaclass | methods\n | module | mro | mro_entries | name | qualname | post_init | self\n | signature | slots | subclasses | version | weakref | wrapped\n | classcell | spec | path | package | future | traceback\n )__\n )\\b\n"
2408
+ },
2409
+ "member-access": {
2410
+ "begin": "(\\.)\\s*(?!\\.)",
2411
+ "beginCaptures": {
2412
+ "1": {
2413
+ "name": "punctuation.separator.period.python"
2414
+ }
2415
+ },
2416
+ "end": "(?x)\n # stop when you've just read non-whitespace followed by non-word\n # i.e. when finished reading an identifier or function call\n (?<=\\S)(?=\\W) |\n # stop when seeing the start of something that's not a word,\n # i.e. when seeing a non-identifier\n (^|(?<=\\s))(?=[^\\\\\\w\\s]) |\n $\n",
2417
+ "name": "meta.member.access.python",
2418
+ "patterns": [
2419
+ {
2420
+ "include": "#function-call"
2421
+ },
2422
+ {
2423
+ "include": "#member-access-base"
2424
+ },
2425
+ {
2426
+ "include": "#member-access-attribute"
2427
+ }
2428
+ ]
2429
+ },
2430
+ "member-access-attribute": {
2431
+ "comment": "Highlight attribute access in otherwise non-specialized cases.",
2432
+ "match": "(?x)\n \\b ([[:alpha:]_]\\w*) \\b\n",
2433
+ "name": "meta.attribute.python"
2434
+ },
2435
+ "member-access-base": {
2436
+ "patterns": [
2437
+ {
2438
+ "include": "#magic-names"
2439
+ },
2440
+ {
2441
+ "include": "#illegal-names"
2442
+ },
2443
+ {
2444
+ "include": "#illegal-object-name"
2445
+ },
2446
+ {
2447
+ "include": "#special-names"
2448
+ },
2449
+ {
2450
+ "include": "#line-continuation"
2451
+ },
2452
+ {
2453
+ "include": "#item-access"
2454
+ }
2455
+ ]
2456
+ },
2457
+ "member-access-class": {
2458
+ "begin": "(\\.)\\s*(?!\\.)",
2459
+ "beginCaptures": {
2460
+ "1": {
2461
+ "name": "punctuation.separator.period.python"
2462
+ }
2463
+ },
2464
+ "end": "(?<=\\S)(?=\\W)|$",
2465
+ "name": "meta.member.access.python",
2466
+ "patterns": [
2467
+ {
2468
+ "include": "#call-wrapper-inheritance"
2469
+ },
2470
+ {
2471
+ "include": "#member-access-base"
2472
+ },
2473
+ {
2474
+ "include": "#inheritance-identifier"
2475
+ }
2476
+ ]
2477
+ },
2478
+ "number": {
2479
+ "name": "constant.numeric.python",
2480
+ "patterns": [
2481
+ {
2482
+ "include": "#number-float"
2483
+ },
2484
+ {
2485
+ "include": "#number-dec"
2486
+ },
2487
+ {
2488
+ "include": "#number-hex"
2489
+ },
2490
+ {
2491
+ "include": "#number-oct"
2492
+ },
2493
+ {
2494
+ "include": "#number-bin"
2495
+ },
2496
+ {
2497
+ "include": "#number-long"
2498
+ },
2499
+ {
2500
+ "match": "\\b[0-9]+\\w+",
2501
+ "name": "invalid.illegal.name.python"
2502
+ }
2503
+ ]
2504
+ },
2505
+ "number-bin": {
2506
+ "captures": {
2507
+ "1": {
2508
+ "name": "storage.type.number.python"
2509
+ }
2510
+ },
2511
+ "match": "(?x)\n (?<![\\w\\.])\n (0[bB]) (_?[01])+\n \\b\n",
2512
+ "name": "constant.numeric.bin.python"
2513
+ },
2514
+ "number-dec": {
2515
+ "captures": {
2516
+ "1": {
2517
+ "name": "storage.type.imaginary.number.python"
2518
+ },
2519
+ "2": {
2520
+ "name": "invalid.illegal.dec.python"
2521
+ }
2522
+ },
2523
+ "match": "(?x)\n (?<![\\w\\.])(?:\n [1-9](?: _?[0-9] )*\n |\n 0+\n |\n [0-9](?: _?[0-9] )* ([jJ])\n |\n 0 ([0-9]+)(?![eE\\.])\n )\\b\n",
2524
+ "name": "constant.numeric.dec.python"
2525
+ },
2526
+ "number-float": {
2527
+ "captures": {
2528
+ "1": {
2529
+ "name": "storage.type.imaginary.number.python"
2530
+ }
2531
+ },
2532
+ "match": "(?x)\n (?<! \\w)(?:\n (?:\n \\.[0-9](?: _?[0-9] )*\n |\n [0-9](?: _?[0-9] )* \\. [0-9](?: _?[0-9] )*\n |\n [0-9](?: _?[0-9] )* \\.\n ) (?: [eE][+-]?[0-9](?: _?[0-9] )* )?\n |\n [0-9](?: _?[0-9] )* (?: [eE][+-]?[0-9](?: _?[0-9] )* )\n )([jJ])?\\b\n",
2533
+ "name": "constant.numeric.float.python"
2534
+ },
2535
+ "number-hex": {
2536
+ "captures": {
2537
+ "1": {
2538
+ "name": "storage.type.number.python"
2539
+ }
2540
+ },
2541
+ "match": "(?x)\n (?<![\\w\\.])\n (0[xX]) (_?[0-9a-fA-F])+\n \\b\n",
2542
+ "name": "constant.numeric.hex.python"
2543
+ },
2544
+ "number-long": {
2545
+ "captures": {
2546
+ "2": {
2547
+ "name": "storage.type.number.python"
2548
+ }
2549
+ },
2550
+ "comment": "this is to support python2 syntax for long ints",
2551
+ "match": "(?x)\n (?<![\\w\\.])\n ([1-9][0-9]* | 0) ([lL])\n \\b\n",
2552
+ "name": "constant.numeric.bin.python"
2553
+ },
2554
+ "number-oct": {
2555
+ "captures": {
2556
+ "1": {
2557
+ "name": "storage.type.number.python"
2558
+ }
2559
+ },
2560
+ "match": "(?x)\n (?<![\\w\\.])\n (0[oO]) (_?[0-7])+\n \\b\n",
2561
+ "name": "constant.numeric.oct.python"
2562
+ },
2563
+ "odd-function-call": {
2564
+ "begin": "(?x)\n (?<= \\] | \\) ) \\s*\n (?=\\()\n",
2565
+ "comment": "A bit obscured function call where there may have been an\narbitrary number of other operations to get the function.\nE.g. \"arr[idx](args)\"\n",
2566
+ "end": "(\\))",
2567
+ "endCaptures": {
2568
+ "1": {
2569
+ "name": "punctuation.definition.arguments.end.python"
2570
+ }
2571
+ },
2572
+ "patterns": [
2573
+ {
2574
+ "include": "#function-arguments"
2575
+ }
2576
+ ]
2577
+ },
2578
+ "operator": {
2579
+ "captures": {
2580
+ "1": {
2581
+ "name": "keyword.operator.logical.python"
2582
+ },
2583
+ "2": {
2584
+ "name": "keyword.control.flow.python"
2585
+ },
2586
+ "3": {
2587
+ "name": "keyword.operator.bitwise.python"
2588
+ },
2589
+ "4": {
2590
+ "name": "keyword.operator.arithmetic.python"
2591
+ },
2592
+ "5": {
2593
+ "name": "keyword.operator.comparison.python"
2594
+ },
2595
+ "6": {
2596
+ "name": "keyword.operator.assignment.python"
2597
+ }
2598
+ },
2599
+ "match": "(?x)\n \\b(?<!\\.)\n (?:\n (and | or | not | in | is) (?# 1)\n |\n (for | if | else | await | (?:yield(?:\\s+from)?)) (?# 2)\n )\n (?!\\s*:)\\b\n\n | (<< | >> | & | \\| | \\^ | ~) (?# 3)\n\n | (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)\n\n | (!= | == | >= | <= | < | >) (?# 5)\n\n | (:=) (?# 6)\n"
2600
+ },
2601
+ "parameter-special": {
2602
+ "captures": {
2603
+ "1": {
2604
+ "name": "variable.parameter.function.language.python"
2605
+ },
2606
+ "2": {
2607
+ "name": "variable.parameter.function.language.special.self.python"
2608
+ },
2609
+ "3": {
2610
+ "name": "variable.parameter.function.language.special.cls.python"
2611
+ },
2612
+ "4": {
2613
+ "name": "punctuation.separator.parameters.python"
2614
+ }
2615
+ },
2616
+ "match": "(?x)\n \\b ((self)|(cls)) \\b \\s*(?:(,)|(?=\\)))\n"
2617
+ },
2618
+ "parameters": {
2619
+ "begin": "(\\()",
2620
+ "beginCaptures": {
2621
+ "1": {
2622
+ "name": "punctuation.definition.parameters.begin.python"
2623
+ }
2624
+ },
2625
+ "end": "(\\))",
2626
+ "endCaptures": {
2627
+ "1": {
2628
+ "name": "punctuation.definition.parameters.end.python"
2629
+ }
2630
+ },
2631
+ "name": "meta.function.parameters.python",
2632
+ "patterns": [
2633
+ {
2634
+ "match": "/",
2635
+ "name": "keyword.operator.positional.parameter.python"
2636
+ },
2637
+ {
2638
+ "match": "(\\*\\*|\\*)",
2639
+ "name": "keyword.operator.unpacking.parameter.python"
2640
+ },
2641
+ {
2642
+ "include": "#lambda-incomplete"
2643
+ },
2644
+ {
2645
+ "include": "#illegal-names"
2646
+ },
2647
+ {
2648
+ "include": "#illegal-object-name"
2649
+ },
2650
+ {
2651
+ "include": "#parameter-special"
2652
+ },
2653
+ {
2654
+ "captures": {
2655
+ "1": {
2656
+ "name": "variable.parameter.function.language.python"
2657
+ },
2658
+ "2": {
2659
+ "name": "punctuation.separator.parameters.python"
2660
+ }
2661
+ },
2662
+ "match": "(?x)\n ([[:alpha:]_]\\w*)\n \\s* (?: (,) | (?=[)#\\n=]))\n"
2663
+ },
2664
+ {
2665
+ "include": "#comments"
2666
+ },
2667
+ {
2668
+ "include": "#loose-default"
2669
+ },
2670
+ {
2671
+ "include": "#annotated-parameter"
2672
+ }
2673
+ ]
2674
+ },
2675
+ "punctuation": {
2676
+ "patterns": [
2677
+ {
2678
+ "match": ":",
2679
+ "name": "punctuation.separator.colon.python"
2680
+ },
2681
+ {
2682
+ "match": ",",
2683
+ "name": "punctuation.separator.element.python"
2684
+ }
2685
+ ]
2686
+ },
2687
+ "regexp": {
2688
+ "patterns": [
2689
+ {
2690
+ "include": "#regexp-single-three-line"
2691
+ },
2692
+ {
2693
+ "include": "#regexp-double-three-line"
2694
+ },
2695
+ {
2696
+ "include": "#regexp-single-one-line"
2697
+ },
2698
+ {
2699
+ "include": "#regexp-double-one-line"
2700
+ }
2701
+ ]
2702
+ },
2703
+ "regexp-backreference": {
2704
+ "captures": {
2705
+ "1": {
2706
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.begin.regexp"
2707
+ },
2708
+ "2": {
2709
+ "name": "entity.name.tag.named.backreference.regexp"
2710
+ },
2711
+ "3": {
2712
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.end.regexp"
2713
+ }
2714
+ },
2715
+ "match": "(?x)\n (\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))\n",
2716
+ "name": "meta.backreference.named.regexp"
2717
+ },
2718
+ "regexp-backreference-number": {
2719
+ "captures": {
2720
+ "1": {
2721
+ "name": "entity.name.tag.backreference.regexp"
2722
+ }
2723
+ },
2724
+ "match": "(\\\\[1-9]\\d?)",
2725
+ "name": "meta.backreference.regexp"
2726
+ },
2727
+ "regexp-base-common": {
2728
+ "patterns": [
2729
+ {
2730
+ "match": "\\.",
2731
+ "name": "support.other.match.any.regexp"
2732
+ },
2733
+ {
2734
+ "match": "\\^",
2735
+ "name": "support.other.match.begin.regexp"
2736
+ },
2737
+ {
2738
+ "match": "\\$",
2739
+ "name": "support.other.match.end.regexp"
2740
+ },
2741
+ {
2742
+ "match": "[+*?]\\??",
2743
+ "name": "keyword.operator.quantifier.regexp"
2744
+ },
2745
+ {
2746
+ "match": "\\|",
2747
+ "name": "keyword.operator.disjunction.regexp"
2748
+ },
2749
+ {
2750
+ "include": "#regexp-escape-sequence"
2751
+ }
2752
+ ]
2753
+ },
2754
+ "regexp-base-expression": {
2755
+ "patterns": [
2756
+ {
2757
+ "include": "#regexp-quantifier"
2758
+ },
2759
+ {
2760
+ "include": "#regexp-base-common"
2761
+ }
2762
+ ]
2763
+ },
2764
+ "regexp-charecter-set-escapes": {
2765
+ "patterns": [
2766
+ {
2767
+ "match": "\\\\[abfnrtv\\\\]",
2768
+ "name": "constant.character.escape.regexp"
2769
+ },
2770
+ {
2771
+ "include": "#regexp-escape-special"
2772
+ },
2773
+ {
2774
+ "match": "\\\\([0-7]{1,3})",
2775
+ "name": "constant.character.escape.regexp"
2776
+ },
2777
+ {
2778
+ "include": "#regexp-escape-character"
2779
+ },
2780
+ {
2781
+ "include": "#regexp-escape-unicode"
2782
+ },
2783
+ {
2784
+ "include": "#regexp-escape-catchall"
2785
+ }
2786
+ ]
2787
+ },
2788
+ "regexp-double-one-line": {
2789
+ "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\")",
2790
+ "beginCaptures": {
2791
+ "2": {
2792
+ "name": "invalid.deprecated.prefix.python"
2793
+ },
2794
+ "3": {
2795
+ "name": "storage.type.string.python"
2796
+ },
2797
+ "4": {
2798
+ "name": "storage.type.string.python"
2799
+ },
2800
+ "5": {
2801
+ "name": "punctuation.definition.string.begin.python"
2802
+ }
2803
+ },
2804
+ "end": "(\")|(?<!\\\\)(\\n)",
2805
+ "endCaptures": {
2806
+ "1": {
2807
+ "name": "punctuation.definition.string.end.python"
2808
+ },
2809
+ "2": {
2810
+ "name": "invalid.illegal.newline.python"
2811
+ }
2812
+ },
2813
+ "name": "string.regexp.quoted.single.python",
2814
+ "patterns": [
2815
+ {
2816
+ "include": "#double-one-regexp-expression"
2817
+ }
2818
+ ]
2819
+ },
2820
+ "regexp-double-three-line": {
2821
+ "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\"\"\")",
2822
+ "beginCaptures": {
2823
+ "2": {
2824
+ "name": "invalid.deprecated.prefix.python"
2825
+ },
2826
+ "3": {
2827
+ "name": "storage.type.string.python"
2828
+ },
2829
+ "4": {
2830
+ "name": "storage.type.string.python"
2831
+ },
2832
+ "5": {
2833
+ "name": "punctuation.definition.string.begin.python"
2834
+ }
2835
+ },
2836
+ "end": "(\"\"\")",
2837
+ "endCaptures": {
2838
+ "1": {
2839
+ "name": "punctuation.definition.string.end.python"
2840
+ },
2841
+ "2": {
2842
+ "name": "invalid.illegal.newline.python"
2843
+ }
2844
+ },
2845
+ "name": "string.regexp.quoted.multi.python",
2846
+ "patterns": [
2847
+ {
2848
+ "include": "#double-three-regexp-expression"
2849
+ }
2850
+ ]
2851
+ },
2852
+ "regexp-escape-catchall": {
2853
+ "match": "\\\\(.|\\n)",
2854
+ "name": "constant.character.escape.regexp"
2855
+ },
2856
+ "regexp-escape-character": {
2857
+ "match": "(?x)\n \\\\ (\n x[0-9A-Fa-f]{2}\n | 0[0-7]{1,2}\n | [0-7]{3}\n )\n",
2858
+ "name": "constant.character.escape.regexp"
2859
+ },
2860
+ "regexp-escape-sequence": {
2861
+ "patterns": [
2862
+ {
2863
+ "include": "#regexp-escape-special"
2864
+ },
2865
+ {
2866
+ "include": "#regexp-escape-character"
2867
+ },
2868
+ {
2869
+ "include": "#regexp-escape-unicode"
2870
+ },
2871
+ {
2872
+ "include": "#regexp-backreference-number"
2873
+ },
2874
+ {
2875
+ "include": "#regexp-escape-catchall"
2876
+ }
2877
+ ]
2878
+ },
2879
+ "regexp-escape-special": {
2880
+ "match": "\\\\([AbBdDsSwWZ])",
2881
+ "name": "support.other.escape.special.regexp"
2882
+ },
2883
+ "regexp-escape-unicode": {
2884
+ "match": "(?x)\n \\\\ (\n u[0-9A-Fa-f]{4}\n | U[0-9A-Fa-f]{8}\n )\n",
2885
+ "name": "constant.character.unicode.regexp"
2886
+ },
2887
+ "regexp-flags": {
2888
+ "match": "\\(\\?[aiLmsux]+\\)",
2889
+ "name": "storage.modifier.flag.regexp"
2890
+ },
2891
+ "regexp-quantifier": {
2892
+ "match": "(?x)\n \\{(\n \\d+ | \\d+,(\\d+)? | ,\\d+\n )\\}\n",
2893
+ "name": "keyword.operator.quantifier.regexp"
2894
+ },
2895
+ "regexp-single-one-line": {
2896
+ "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\\')",
2897
+ "beginCaptures": {
2898
+ "2": {
2899
+ "name": "invalid.deprecated.prefix.python"
2900
+ },
2901
+ "3": {
2902
+ "name": "storage.type.string.python"
2903
+ },
2904
+ "4": {
2905
+ "name": "storage.type.string.python"
2906
+ },
2907
+ "5": {
2908
+ "name": "punctuation.definition.string.begin.python"
2909
+ }
2910
+ },
2911
+ "end": "(\\')|(?<!\\\\)(\\n)",
2912
+ "endCaptures": {
2913
+ "1": {
2914
+ "name": "punctuation.definition.string.end.python"
2915
+ },
2916
+ "2": {
2917
+ "name": "invalid.illegal.newline.python"
2918
+ }
2919
+ },
2920
+ "name": "string.regexp.quoted.single.python",
2921
+ "patterns": [
2922
+ {
2923
+ "include": "#single-one-regexp-expression"
2924
+ }
2925
+ ]
2926
+ },
2927
+ "regexp-single-three-line": {
2928
+ "begin": "\\b(([uU]r)|([bB]r)|(r[bB]?))(\\'\\'\\')",
2929
+ "beginCaptures": {
2930
+ "2": {
2931
+ "name": "invalid.deprecated.prefix.python"
2932
+ },
2933
+ "3": {
2934
+ "name": "storage.type.string.python"
2935
+ },
2936
+ "4": {
2937
+ "name": "storage.type.string.python"
2938
+ },
2939
+ "5": {
2940
+ "name": "punctuation.definition.string.begin.python"
2941
+ }
2942
+ },
2943
+ "end": "(\\'\\'\\')",
2944
+ "endCaptures": {
2945
+ "1": {
2946
+ "name": "punctuation.definition.string.end.python"
2947
+ },
2948
+ "2": {
2949
+ "name": "invalid.illegal.newline.python"
2950
+ }
2951
+ },
2952
+ "name": "string.regexp.quoted.multi.python",
2953
+ "patterns": [
2954
+ {
2955
+ "include": "#single-three-regexp-expression"
2956
+ }
2957
+ ]
2958
+ },
2959
+ "return-annotation": {
2960
+ "begin": "(->)",
2961
+ "beginCaptures": {
2962
+ "1": {
2963
+ "name": "punctuation.separator.annotation.result.python"
2964
+ }
2965
+ },
2966
+ "end": "(?=:)",
2967
+ "patterns": [
2968
+ {
2969
+ "include": "#expression"
2970
+ }
2971
+ ]
2972
+ },
2973
+ "round-braces": {
2974
+ "begin": "\\(",
2975
+ "beginCaptures": {
2976
+ "0": {
2977
+ "name": "punctuation.parenthesis.begin.python"
2978
+ }
2979
+ },
2980
+ "end": "\\)",
2981
+ "endCaptures": {
2982
+ "0": {
2983
+ "name": "punctuation.parenthesis.end.python"
2984
+ }
2985
+ },
2986
+ "patterns": [
2987
+ {
2988
+ "include": "#expression"
2989
+ }
2990
+ ]
2991
+ },
2992
+ "semicolon": {
2993
+ "patterns": [
2994
+ {
2995
+ "match": "\\;$",
2996
+ "name": "invalid.deprecated.semicolon.python"
2997
+ }
2998
+ ]
2999
+ },
3000
+ "single-one-regexp-character-set": {
3001
+ "patterns": [
3002
+ {
3003
+ "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
3004
+ },
3005
+ {
3006
+ "begin": "(\\[)(\\^)?(\\])?",
3007
+ "beginCaptures": {
3008
+ "1": {
3009
+ "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
3010
+ },
3011
+ "2": {
3012
+ "name": "keyword.operator.negation.regexp"
3013
+ },
3014
+ "3": {
3015
+ "name": "constant.character.set.regexp"
3016
+ }
3017
+ },
3018
+ "end": "(\\]|(?=\\'))|((?=(?<!\\\\)\\n))",
3019
+ "endCaptures": {
3020
+ "1": {
3021
+ "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
3022
+ },
3023
+ "2": {
3024
+ "name": "invalid.illegal.newline.python"
3025
+ }
3026
+ },
3027
+ "name": "meta.character.set.regexp",
3028
+ "patterns": [
3029
+ {
3030
+ "include": "#regexp-charecter-set-escapes"
3031
+ },
3032
+ {
3033
+ "match": "[^\\n]",
3034
+ "name": "constant.character.set.regexp"
3035
+ }
3036
+ ]
3037
+ }
3038
+ ]
3039
+ },
3040
+ "single-one-regexp-comments": {
3041
+ "begin": "\\(\\?#",
3042
+ "beginCaptures": {
3043
+ "0": {
3044
+ "name": "punctuation.comment.begin.regexp"
3045
+ }
3046
+ },
3047
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3048
+ "endCaptures": {
3049
+ "1": {
3050
+ "name": "punctuation.comment.end.regexp"
3051
+ },
3052
+ "2": {
3053
+ "name": "invalid.illegal.newline.python"
3054
+ }
3055
+ },
3056
+ "name": "comment.regexp",
3057
+ "patterns": [
3058
+ {
3059
+ "include": "#codetags"
3060
+ }
3061
+ ]
3062
+ },
3063
+ "single-one-regexp-conditional": {
3064
+ "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
3065
+ "beginCaptures": {
3066
+ "0": {
3067
+ "name": "keyword.operator.conditional.regexp"
3068
+ },
3069
+ "1": {
3070
+ "name": "punctuation.parenthesis.conditional.begin.regexp"
3071
+ }
3072
+ },
3073
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3074
+ "endCaptures": {
3075
+ "1": {
3076
+ "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
3077
+ },
3078
+ "2": {
3079
+ "name": "invalid.illegal.newline.python"
3080
+ }
3081
+ },
3082
+ "patterns": [
3083
+ {
3084
+ "include": "#single-one-regexp-expression"
3085
+ }
3086
+ ]
3087
+ },
3088
+ "single-one-regexp-expression": {
3089
+ "patterns": [
3090
+ {
3091
+ "include": "#regexp-base-expression"
3092
+ },
3093
+ {
3094
+ "include": "#single-one-regexp-character-set"
3095
+ },
3096
+ {
3097
+ "include": "#single-one-regexp-comments"
3098
+ },
3099
+ {
3100
+ "include": "#regexp-flags"
3101
+ },
3102
+ {
3103
+ "include": "#single-one-regexp-named-group"
3104
+ },
3105
+ {
3106
+ "include": "#regexp-backreference"
3107
+ },
3108
+ {
3109
+ "include": "#single-one-regexp-lookahead"
3110
+ },
3111
+ {
3112
+ "include": "#single-one-regexp-lookahead-negative"
3113
+ },
3114
+ {
3115
+ "include": "#single-one-regexp-lookbehind"
3116
+ },
3117
+ {
3118
+ "include": "#single-one-regexp-lookbehind-negative"
3119
+ },
3120
+ {
3121
+ "include": "#single-one-regexp-conditional"
3122
+ },
3123
+ {
3124
+ "include": "#single-one-regexp-parentheses-non-capturing"
3125
+ },
3126
+ {
3127
+ "include": "#single-one-regexp-parentheses"
3128
+ }
3129
+ ]
3130
+ },
3131
+ "single-one-regexp-lookahead": {
3132
+ "begin": "(\\()\\?=",
3133
+ "beginCaptures": {
3134
+ "0": {
3135
+ "name": "keyword.operator.lookahead.regexp"
3136
+ },
3137
+ "1": {
3138
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
3139
+ }
3140
+ },
3141
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3142
+ "endCaptures": {
3143
+ "1": {
3144
+ "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
3145
+ },
3146
+ "2": {
3147
+ "name": "invalid.illegal.newline.python"
3148
+ }
3149
+ },
3150
+ "patterns": [
3151
+ {
3152
+ "include": "#single-one-regexp-expression"
3153
+ }
3154
+ ]
3155
+ },
3156
+ "single-one-regexp-lookahead-negative": {
3157
+ "begin": "(\\()\\?!",
3158
+ "beginCaptures": {
3159
+ "0": {
3160
+ "name": "keyword.operator.lookahead.negative.regexp"
3161
+ },
3162
+ "1": {
3163
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
3164
+ }
3165
+ },
3166
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3167
+ "endCaptures": {
3168
+ "1": {
3169
+ "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
3170
+ },
3171
+ "2": {
3172
+ "name": "invalid.illegal.newline.python"
3173
+ }
3174
+ },
3175
+ "patterns": [
3176
+ {
3177
+ "include": "#single-one-regexp-expression"
3178
+ }
3179
+ ]
3180
+ },
3181
+ "single-one-regexp-lookbehind": {
3182
+ "begin": "(\\()\\?<=",
3183
+ "beginCaptures": {
3184
+ "0": {
3185
+ "name": "keyword.operator.lookbehind.regexp"
3186
+ },
3187
+ "1": {
3188
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
3189
+ }
3190
+ },
3191
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3192
+ "endCaptures": {
3193
+ "1": {
3194
+ "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
3195
+ },
3196
+ "2": {
3197
+ "name": "invalid.illegal.newline.python"
3198
+ }
3199
+ },
3200
+ "patterns": [
3201
+ {
3202
+ "include": "#single-one-regexp-expression"
3203
+ }
3204
+ ]
3205
+ },
3206
+ "single-one-regexp-lookbehind-negative": {
3207
+ "begin": "(\\()\\?<!",
3208
+ "beginCaptures": {
3209
+ "0": {
3210
+ "name": "keyword.operator.lookbehind.negative.regexp"
3211
+ },
3212
+ "1": {
3213
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
3214
+ }
3215
+ },
3216
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3217
+ "endCaptures": {
3218
+ "1": {
3219
+ "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
3220
+ },
3221
+ "2": {
3222
+ "name": "invalid.illegal.newline.python"
3223
+ }
3224
+ },
3225
+ "patterns": [
3226
+ {
3227
+ "include": "#single-one-regexp-expression"
3228
+ }
3229
+ ]
3230
+ },
3231
+ "single-one-regexp-named-group": {
3232
+ "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
3233
+ "beginCaptures": {
3234
+ "1": {
3235
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
3236
+ },
3237
+ "2": {
3238
+ "name": "entity.name.tag.named.group.regexp"
3239
+ }
3240
+ },
3241
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3242
+ "endCaptures": {
3243
+ "1": {
3244
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
3245
+ },
3246
+ "2": {
3247
+ "name": "invalid.illegal.newline.python"
3248
+ }
3249
+ },
3250
+ "name": "meta.named.regexp",
3251
+ "patterns": [
3252
+ {
3253
+ "include": "#single-one-regexp-expression"
3254
+ }
3255
+ ]
3256
+ },
3257
+ "single-one-regexp-parentheses": {
3258
+ "begin": "\\(",
3259
+ "beginCaptures": {
3260
+ "0": {
3261
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
3262
+ }
3263
+ },
3264
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3265
+ "endCaptures": {
3266
+ "1": {
3267
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
3268
+ },
3269
+ "2": {
3270
+ "name": "invalid.illegal.newline.python"
3271
+ }
3272
+ },
3273
+ "patterns": [
3274
+ {
3275
+ "include": "#single-one-regexp-expression"
3276
+ }
3277
+ ]
3278
+ },
3279
+ "single-one-regexp-parentheses-non-capturing": {
3280
+ "begin": "\\(\\?:",
3281
+ "beginCaptures": {
3282
+ "0": {
3283
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
3284
+ }
3285
+ },
3286
+ "end": "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))",
3287
+ "endCaptures": {
3288
+ "1": {
3289
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
3290
+ },
3291
+ "2": {
3292
+ "name": "invalid.illegal.newline.python"
3293
+ }
3294
+ },
3295
+ "patterns": [
3296
+ {
3297
+ "include": "#single-one-regexp-expression"
3298
+ }
3299
+ ]
3300
+ },
3301
+ "single-three-regexp-character-set": {
3302
+ "patterns": [
3303
+ {
3304
+ "match": "(?x)\n \\[ \\^? \\] (?! .*?\\])\n"
3305
+ },
3306
+ {
3307
+ "begin": "(\\[)(\\^)?(\\])?",
3308
+ "beginCaptures": {
3309
+ "1": {
3310
+ "name": "punctuation.character.set.begin.regexp constant.other.set.regexp"
3311
+ },
3312
+ "2": {
3313
+ "name": "keyword.operator.negation.regexp"
3314
+ },
3315
+ "3": {
3316
+ "name": "constant.character.set.regexp"
3317
+ }
3318
+ },
3319
+ "end": "(\\]|(?=\\'\\'\\'))",
3320
+ "endCaptures": {
3321
+ "1": {
3322
+ "name": "punctuation.character.set.end.regexp constant.other.set.regexp"
3323
+ },
3324
+ "2": {
3325
+ "name": "invalid.illegal.newline.python"
3326
+ }
3327
+ },
3328
+ "name": "meta.character.set.regexp",
3329
+ "patterns": [
3330
+ {
3331
+ "include": "#regexp-charecter-set-escapes"
3332
+ },
3333
+ {
3334
+ "match": "[^\\n]",
3335
+ "name": "constant.character.set.regexp"
3336
+ }
3337
+ ]
3338
+ }
3339
+ ]
3340
+ },
3341
+ "single-three-regexp-comments": {
3342
+ "begin": "\\(\\?#",
3343
+ "beginCaptures": {
3344
+ "0": {
3345
+ "name": "punctuation.comment.begin.regexp"
3346
+ }
3347
+ },
3348
+ "end": "(\\)|(?=\\'\\'\\'))",
3349
+ "endCaptures": {
3350
+ "1": {
3351
+ "name": "punctuation.comment.end.regexp"
3352
+ },
3353
+ "2": {
3354
+ "name": "invalid.illegal.newline.python"
3355
+ }
3356
+ },
3357
+ "name": "comment.regexp",
3358
+ "patterns": [
3359
+ {
3360
+ "include": "#codetags"
3361
+ }
3362
+ ]
3363
+ },
3364
+ "single-three-regexp-conditional": {
3365
+ "begin": "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)",
3366
+ "beginCaptures": {
3367
+ "0": {
3368
+ "name": "keyword.operator.conditional.regexp"
3369
+ },
3370
+ "1": {
3371
+ "name": "punctuation.parenthesis.conditional.begin.regexp"
3372
+ }
3373
+ },
3374
+ "end": "(\\)|(?=\\'\\'\\'))",
3375
+ "endCaptures": {
3376
+ "1": {
3377
+ "name": "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp"
3378
+ },
3379
+ "2": {
3380
+ "name": "invalid.illegal.newline.python"
3381
+ }
3382
+ },
3383
+ "patterns": [
3384
+ {
3385
+ "include": "#single-three-regexp-expression"
3386
+ },
3387
+ {
3388
+ "include": "#comments-string-single-three"
3389
+ }
3390
+ ]
3391
+ },
3392
+ "single-three-regexp-expression": {
3393
+ "patterns": [
3394
+ {
3395
+ "include": "#regexp-base-expression"
3396
+ },
3397
+ {
3398
+ "include": "#single-three-regexp-character-set"
3399
+ },
3400
+ {
3401
+ "include": "#single-three-regexp-comments"
3402
+ },
3403
+ {
3404
+ "include": "#regexp-flags"
3405
+ },
3406
+ {
3407
+ "include": "#single-three-regexp-named-group"
3408
+ },
3409
+ {
3410
+ "include": "#regexp-backreference"
3411
+ },
3412
+ {
3413
+ "include": "#single-three-regexp-lookahead"
3414
+ },
3415
+ {
3416
+ "include": "#single-three-regexp-lookahead-negative"
3417
+ },
3418
+ {
3419
+ "include": "#single-three-regexp-lookbehind"
3420
+ },
3421
+ {
3422
+ "include": "#single-three-regexp-lookbehind-negative"
3423
+ },
3424
+ {
3425
+ "include": "#single-three-regexp-conditional"
3426
+ },
3427
+ {
3428
+ "include": "#single-three-regexp-parentheses-non-capturing"
3429
+ },
3430
+ {
3431
+ "include": "#single-three-regexp-parentheses"
3432
+ },
3433
+ {
3434
+ "include": "#comments-string-single-three"
3435
+ }
3436
+ ]
3437
+ },
3438
+ "single-three-regexp-lookahead": {
3439
+ "begin": "(\\()\\?=",
3440
+ "beginCaptures": {
3441
+ "0": {
3442
+ "name": "keyword.operator.lookahead.regexp"
3443
+ },
3444
+ "1": {
3445
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
3446
+ }
3447
+ },
3448
+ "end": "(\\)|(?=\\'\\'\\'))",
3449
+ "endCaptures": {
3450
+ "1": {
3451
+ "name": "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp"
3452
+ },
3453
+ "2": {
3454
+ "name": "invalid.illegal.newline.python"
3455
+ }
3456
+ },
3457
+ "patterns": [
3458
+ {
3459
+ "include": "#single-three-regexp-expression"
3460
+ },
3461
+ {
3462
+ "include": "#comments-string-single-three"
3463
+ }
3464
+ ]
3465
+ },
3466
+ "single-three-regexp-lookahead-negative": {
3467
+ "begin": "(\\()\\?!",
3468
+ "beginCaptures": {
3469
+ "0": {
3470
+ "name": "keyword.operator.lookahead.negative.regexp"
3471
+ },
3472
+ "1": {
3473
+ "name": "punctuation.parenthesis.lookahead.begin.regexp"
3474
+ }
3475
+ },
3476
+ "end": "(\\)|(?=\\'\\'\\'))",
3477
+ "endCaptures": {
3478
+ "1": {
3479
+ "name": "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp"
3480
+ },
3481
+ "2": {
3482
+ "name": "invalid.illegal.newline.python"
3483
+ }
3484
+ },
3485
+ "patterns": [
3486
+ {
3487
+ "include": "#single-three-regexp-expression"
3488
+ },
3489
+ {
3490
+ "include": "#comments-string-single-three"
3491
+ }
3492
+ ]
3493
+ },
3494
+ "single-three-regexp-lookbehind": {
3495
+ "begin": "(\\()\\?<=",
3496
+ "beginCaptures": {
3497
+ "0": {
3498
+ "name": "keyword.operator.lookbehind.regexp"
3499
+ },
3500
+ "1": {
3501
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
3502
+ }
3503
+ },
3504
+ "end": "(\\)|(?=\\'\\'\\'))",
3505
+ "endCaptures": {
3506
+ "1": {
3507
+ "name": "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp"
3508
+ },
3509
+ "2": {
3510
+ "name": "invalid.illegal.newline.python"
3511
+ }
3512
+ },
3513
+ "patterns": [
3514
+ {
3515
+ "include": "#single-three-regexp-expression"
3516
+ },
3517
+ {
3518
+ "include": "#comments-string-single-three"
3519
+ }
3520
+ ]
3521
+ },
3522
+ "single-three-regexp-lookbehind-negative": {
3523
+ "begin": "(\\()\\?<!",
3524
+ "beginCaptures": {
3525
+ "0": {
3526
+ "name": "keyword.operator.lookbehind.negative.regexp"
3527
+ },
3528
+ "1": {
3529
+ "name": "punctuation.parenthesis.lookbehind.begin.regexp"
3530
+ }
3531
+ },
3532
+ "end": "(\\)|(?=\\'\\'\\'))",
3533
+ "endCaptures": {
3534
+ "1": {
3535
+ "name": "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp"
3536
+ },
3537
+ "2": {
3538
+ "name": "invalid.illegal.newline.python"
3539
+ }
3540
+ },
3541
+ "patterns": [
3542
+ {
3543
+ "include": "#single-three-regexp-expression"
3544
+ },
3545
+ {
3546
+ "include": "#comments-string-single-three"
3547
+ }
3548
+ ]
3549
+ },
3550
+ "single-three-regexp-named-group": {
3551
+ "begin": "(?x)\n (\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n",
3552
+ "beginCaptures": {
3553
+ "1": {
3554
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp"
3555
+ },
3556
+ "2": {
3557
+ "name": "entity.name.tag.named.group.regexp"
3558
+ }
3559
+ },
3560
+ "end": "(\\)|(?=\\'\\'\\'))",
3561
+ "endCaptures": {
3562
+ "1": {
3563
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp"
3564
+ },
3565
+ "2": {
3566
+ "name": "invalid.illegal.newline.python"
3567
+ }
3568
+ },
3569
+ "name": "meta.named.regexp",
3570
+ "patterns": [
3571
+ {
3572
+ "include": "#single-three-regexp-expression"
3573
+ },
3574
+ {
3575
+ "include": "#comments-string-single-three"
3576
+ }
3577
+ ]
3578
+ },
3579
+ "single-three-regexp-parentheses": {
3580
+ "begin": "\\(",
3581
+ "beginCaptures": {
3582
+ "0": {
3583
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp"
3584
+ }
3585
+ },
3586
+ "end": "(\\)|(?=\\'\\'\\'))",
3587
+ "endCaptures": {
3588
+ "1": {
3589
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp"
3590
+ },
3591
+ "2": {
3592
+ "name": "invalid.illegal.newline.python"
3593
+ }
3594
+ },
3595
+ "patterns": [
3596
+ {
3597
+ "include": "#single-three-regexp-expression"
3598
+ },
3599
+ {
3600
+ "include": "#comments-string-single-three"
3601
+ }
3602
+ ]
3603
+ },
3604
+ "single-three-regexp-parentheses-non-capturing": {
3605
+ "begin": "\\(\\?:",
3606
+ "beginCaptures": {
3607
+ "0": {
3608
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp"
3609
+ }
3610
+ },
3611
+ "end": "(\\)|(?=\\'\\'\\'))",
3612
+ "endCaptures": {
3613
+ "1": {
3614
+ "name": "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp"
3615
+ },
3616
+ "2": {
3617
+ "name": "invalid.illegal.newline.python"
3618
+ }
3619
+ },
3620
+ "patterns": [
3621
+ {
3622
+ "include": "#single-three-regexp-expression"
3623
+ },
3624
+ {
3625
+ "include": "#comments-string-single-three"
3626
+ }
3627
+ ]
3628
+ },
3629
+ "special-names": {
3630
+ "match": "(?x)\n \\b\n # we want to see \"enough\", meaning 2 or more upper-case\n # letters in the beginning of the constant\n #\n # for more details refer to:\n # https://github.com/MagicStack/MagicPython/issues/42\n (\n _* [[:upper:]] [_\\d]* [[:upper:]]\n )\n [[:upper:]\\d]* (_\\w*)?\n \\b\n",
3631
+ "name": "constant.other.caps.python"
3632
+ },
3633
+ "special-variables": {
3634
+ "captures": {
3635
+ "1": {
3636
+ "name": "variable.language.special.self.python"
3637
+ },
3638
+ "2": {
3639
+ "name": "variable.language.special.cls.python"
3640
+ }
3641
+ },
3642
+ "match": "(?x)\n \\b (?<!\\.) (?:\n (self) | (cls)\n )\\b\n"
3643
+ },
3644
+ "statement": {
3645
+ "patterns": [
3646
+ {
3647
+ "include": "#import"
3648
+ },
3649
+ {
3650
+ "include": "#class-declaration"
3651
+ },
3652
+ {
3653
+ "include": "#function-declaration"
3654
+ },
3655
+ {
3656
+ "include": "#generator"
3657
+ },
3658
+ {
3659
+ "include": "#statement-keyword"
3660
+ },
3661
+ {
3662
+ "include": "#assignment-operator"
3663
+ },
3664
+ {
3665
+ "include": "#decorator"
3666
+ },
3667
+ {
3668
+ "include": "#docstring-statement"
3669
+ },
3670
+ {
3671
+ "include": "#semicolon"
3672
+ }
3673
+ ]
3674
+ },
3675
+ "statement-keyword": {
3676
+ "patterns": [
3677
+ {
3678
+ "match": "\\b((async\\s+)?\\s*def)\\b",
3679
+ "name": "storage.type.function.python"
3680
+ },
3681
+ {
3682
+ "comment": "if `as` is eventually followed by `:` or line continuation\nit's probably control flow like:\n with foo as bar, \\\n Foo as Bar:\n try:\n do_stuff()\n except Exception as e:\n pass\n",
3683
+ "match": "\\b(?<!\\.)as\\b(?=.*[:\\\\])",
3684
+ "name": "keyword.control.flow.python"
3685
+ },
3686
+ {
3687
+ "comment": "other legal use of `as` is in an import",
3688
+ "match": "\\b(?<!\\.)as\\b",
3689
+ "name": "keyword.control.import.python"
3690
+ },
3691
+ {
3692
+ "match": "(?x)\n \\b(?<!\\.)(\n async | continue | del | assert | break | finally | for\n | from | elif | else | if | except | pass | raise\n | return | try | while | with\n )\\b\n",
3693
+ "name": "keyword.control.flow.python"
3694
+ },
3695
+ {
3696
+ "match": "(?x)\n \\b(?<!\\.)(\n global | nonlocal\n )\\b\n",
3697
+ "name": "storage.modifier.declaration.python"
3698
+ },
3699
+ {
3700
+ "match": "\\b(?<!\\.)(class)\\b",
3701
+ "name": "storage.type.class.python"
3702
+ },
3703
+ {
3704
+ "captures": {
3705
+ "1": {
3706
+ "name": "keyword.control.flow.python"
3707
+ }
3708
+ },
3709
+ "match": "(?x)\n ^\\s*(\n case | match\n )(?=\\s*([-+\\w\\d(\\[{'\":#]|$))\\b\n"
3710
+ }
3711
+ ]
3712
+ },
3713
+ "string": {
3714
+ "patterns": [
3715
+ {
3716
+ "include": "#string-quoted-multi-line"
3717
+ },
3718
+ {
3719
+ "include": "#string-quoted-single-line"
3720
+ },
3721
+ {
3722
+ "include": "#string-bin-quoted-multi-line"
3723
+ },
3724
+ {
3725
+ "include": "#string-bin-quoted-single-line"
3726
+ },
3727
+ {
3728
+ "include": "#string-raw-quoted-multi-line"
3729
+ },
3730
+ {
3731
+ "include": "#string-raw-quoted-single-line"
3732
+ },
3733
+ {
3734
+ "include": "#string-raw-bin-quoted-multi-line"
3735
+ },
3736
+ {
3737
+ "include": "#string-raw-bin-quoted-single-line"
3738
+ },
3739
+ {
3740
+ "include": "#fstring-fnorm-quoted-multi-line"
3741
+ },
3742
+ {
3743
+ "include": "#fstring-fnorm-quoted-single-line"
3744
+ },
3745
+ {
3746
+ "include": "#fstring-normf-quoted-multi-line"
3747
+ },
3748
+ {
3749
+ "include": "#fstring-normf-quoted-single-line"
3750
+ },
3751
+ {
3752
+ "include": "#fstring-raw-quoted-multi-line"
3753
+ },
3754
+ {
3755
+ "include": "#fstring-raw-quoted-single-line"
3756
+ }
3757
+ ]
3758
+ },
3759
+ "string-bin-quoted-multi-line": {
3760
+ "begin": "(\\b[bB])('''|\"\"\")",
3761
+ "beginCaptures": {
3762
+ "1": {
3763
+ "name": "storage.type.string.python"
3764
+ },
3765
+ "2": {
3766
+ "name": "punctuation.definition.string.begin.python"
3767
+ }
3768
+ },
3769
+ "end": "(\\2)",
3770
+ "endCaptures": {
3771
+ "1": {
3772
+ "name": "punctuation.definition.string.end.python"
3773
+ },
3774
+ "2": {
3775
+ "name": "invalid.illegal.newline.python"
3776
+ }
3777
+ },
3778
+ "name": "string.quoted.binary.multi.python",
3779
+ "patterns": [
3780
+ {
3781
+ "include": "#string-entity"
3782
+ }
3783
+ ]
3784
+ },
3785
+ "string-bin-quoted-single-line": {
3786
+ "begin": "(\\b[bB])((['\"]))",
3787
+ "beginCaptures": {
3788
+ "1": {
3789
+ "name": "storage.type.string.python"
3790
+ },
3791
+ "2": {
3792
+ "name": "punctuation.definition.string.begin.python"
3793
+ }
3794
+ },
3795
+ "end": "(\\2)|((?<!\\\\)\\n)",
3796
+ "endCaptures": {
3797
+ "1": {
3798
+ "name": "punctuation.definition.string.end.python"
3799
+ },
3800
+ "2": {
3801
+ "name": "invalid.illegal.newline.python"
3802
+ }
3803
+ },
3804
+ "name": "string.quoted.binary.single.python",
3805
+ "patterns": [
3806
+ {
3807
+ "include": "#string-entity"
3808
+ }
3809
+ ]
3810
+ },
3811
+ "string-brace-formatting": {
3812
+ "patterns": [
3813
+ {
3814
+ "captures": {
3815
+ "1": {
3816
+ "name": "constant.character.format.placeholder.other.python"
3817
+ },
3818
+ "3": {
3819
+ "name": "storage.type.format.python"
3820
+ },
3821
+ "4": {
3822
+ "name": "storage.type.format.python"
3823
+ }
3824
+ },
3825
+ "match": "(?x)\n (\n {{ | }}\n | (?:\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n ( : \\w? [<>=^]? [-+ ]? \\#?\n \\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?\n })\n )\n",
3826
+ "name": "meta.format.brace.python"
3827
+ },
3828
+ {
3829
+ "captures": {
3830
+ "1": {
3831
+ "name": "constant.character.format.placeholder.other.python"
3832
+ },
3833
+ "3": {
3834
+ "name": "storage.type.format.python"
3835
+ },
3836
+ "4": {
3837
+ "name": "storage.type.format.python"
3838
+ }
3839
+ },
3840
+ "match": "(?x)\n (\n {\n \\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'\"]+\\])*\n (![rsa])?\n (:)\n [^'\"{}\\n]* (?:\n \\{ [^'\"}\\n]*? \\} [^'\"{}\\n]*\n )*\n }\n )\n",
3841
+ "name": "meta.format.brace.python"
3842
+ }
3843
+ ]
3844
+ },
3845
+ "string-consume-escape": {
3846
+ "match": "\\\\['\"\\n\\\\]"
3847
+ },
3848
+ "string-entity": {
3849
+ "patterns": [
3850
+ {
3851
+ "include": "#escape-sequence"
3852
+ },
3853
+ {
3854
+ "include": "#string-line-continuation"
3855
+ },
3856
+ {
3857
+ "include": "#string-formatting"
3858
+ }
3859
+ ]
3860
+ },
3861
+ "string-formatting": {
3862
+ "captures": {
3863
+ "1": {
3864
+ "name": "constant.character.format.placeholder.other.python"
3865
+ }
3866
+ },
3867
+ "match": "(?x)\n (\n % (\\([\\w\\s]*\\))?\n [-+#0 ]*\n (\\d+|\\*)? (\\.(\\d+|\\*))?\n ([hlL])?\n [diouxXeEfFgGcrsab%]\n )\n",
3868
+ "name": "meta.format.percent.python"
3869
+ },
3870
+ "string-line-continuation": {
3871
+ "match": "\\\\$",
3872
+ "name": "constant.language.python"
3873
+ },
3874
+ "string-multi-bad-brace1-formatting-raw": {
3875
+ "begin": "(?x)\n (?= \\{%\n ( .*? (?!'''|\"\"\") )\n %\\}\n )\n",
3876
+ "comment": "template using {% ... %}",
3877
+ "end": "(?='''|\"\"\")",
3878
+ "patterns": [
3879
+ {
3880
+ "include": "#string-consume-escape"
3881
+ }
3882
+ ]
3883
+ },
3884
+ "string-multi-bad-brace1-formatting-unicode": {
3885
+ "begin": "(?x)\n (?= \\{%\n ( .*? (?!'''|\"\"\") )\n %\\}\n )\n",
3886
+ "comment": "template using {% ... %}",
3887
+ "end": "(?='''|\"\"\")",
3888
+ "patterns": [
3889
+ {
3890
+ "include": "#escape-sequence-unicode"
3891
+ },
3892
+ {
3893
+ "include": "#escape-sequence"
3894
+ },
3895
+ {
3896
+ "include": "#string-line-continuation"
3897
+ }
3898
+ ]
3899
+ },
3900
+ "string-multi-bad-brace2-formatting-raw": {
3901
+ "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!'''|\"\"\") [^!:\\.\\[}\\w]\n )\n .*?(?!'''|\"\"\")\n \\}\n )\n",
3902
+ "comment": "odd format or format-like syntax",
3903
+ "end": "(?='''|\"\"\")",
3904
+ "patterns": [
3905
+ {
3906
+ "include": "#string-consume-escape"
3907
+ },
3908
+ {
3909
+ "include": "#string-formatting"
3910
+ }
3911
+ ]
3912
+ },
3913
+ "string-multi-bad-brace2-formatting-unicode": {
3914
+ "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!'''|\"\"\") [^!:\\.\\[}\\w]\n )\n .*?(?!'''|\"\"\")\n \\}\n )\n",
3915
+ "comment": "odd format or format-like syntax",
3916
+ "end": "(?='''|\"\"\")",
3917
+ "patterns": [
3918
+ {
3919
+ "include": "#escape-sequence-unicode"
3920
+ },
3921
+ {
3922
+ "include": "#string-entity"
3923
+ }
3924
+ ]
3925
+ },
3926
+ "string-quoted-multi-line": {
3927
+ "begin": "(?:\\b([rR])(?=[uU]))?([uU])?('''|\"\"\")",
3928
+ "beginCaptures": {
3929
+ "1": {
3930
+ "name": "invalid.illegal.prefix.python"
3931
+ },
3932
+ "2": {
3933
+ "name": "storage.type.string.python"
3934
+ },
3935
+ "3": {
3936
+ "name": "punctuation.definition.string.begin.python"
3937
+ }
3938
+ },
3939
+ "end": "(\\3)",
3940
+ "endCaptures": {
3941
+ "1": {
3942
+ "name": "punctuation.definition.string.end.python"
3943
+ },
3944
+ "2": {
3945
+ "name": "invalid.illegal.newline.python"
3946
+ }
3947
+ },
3948
+ "name": "string.quoted.multi.python",
3949
+ "patterns": [
3950
+ {
3951
+ "include": "#string-multi-bad-brace1-formatting-unicode"
3952
+ },
3953
+ {
3954
+ "include": "#string-multi-bad-brace2-formatting-unicode"
3955
+ },
3956
+ {
3957
+ "include": "#string-unicode-guts"
3958
+ }
3959
+ ]
3960
+ },
3961
+ "string-quoted-single-line": {
3962
+ "begin": "(?:\\b([rR])(?=[uU]))?([uU])?((['\"]))",
3963
+ "beginCaptures": {
3964
+ "1": {
3965
+ "name": "invalid.illegal.prefix.python"
3966
+ },
3967
+ "2": {
3968
+ "name": "storage.type.string.python"
3969
+ },
3970
+ "3": {
3971
+ "name": "punctuation.definition.string.begin.python"
3972
+ }
3973
+ },
3974
+ "end": "(\\3)|((?<!\\\\)\\n)",
3975
+ "endCaptures": {
3976
+ "1": {
3977
+ "name": "punctuation.definition.string.end.python"
3978
+ },
3979
+ "2": {
3980
+ "name": "invalid.illegal.newline.python"
3981
+ }
3982
+ },
3983
+ "name": "string.quoted.single.python",
3984
+ "patterns": [
3985
+ {
3986
+ "include": "#string-single-bad-brace1-formatting-unicode"
3987
+ },
3988
+ {
3989
+ "include": "#string-single-bad-brace2-formatting-unicode"
3990
+ },
3991
+ {
3992
+ "include": "#string-unicode-guts"
3993
+ }
3994
+ ]
3995
+ },
3996
+ "string-raw-bin-guts": {
3997
+ "patterns": [
3998
+ {
3999
+ "include": "#string-consume-escape"
4000
+ },
4001
+ {
4002
+ "include": "#string-formatting"
4003
+ }
4004
+ ]
4005
+ },
4006
+ "string-raw-bin-quoted-multi-line": {
4007
+ "begin": "(\\b(?:R[bB]|[bB]R))('''|\"\"\")",
4008
+ "beginCaptures": {
4009
+ "1": {
4010
+ "name": "storage.type.string.python"
4011
+ },
4012
+ "2": {
4013
+ "name": "punctuation.definition.string.begin.python"
4014
+ }
4015
+ },
4016
+ "end": "(\\2)",
4017
+ "endCaptures": {
4018
+ "1": {
4019
+ "name": "punctuation.definition.string.end.python"
4020
+ },
4021
+ "2": {
4022
+ "name": "invalid.illegal.newline.python"
4023
+ }
4024
+ },
4025
+ "name": "string.quoted.raw.binary.multi.python",
4026
+ "patterns": [
4027
+ {
4028
+ "include": "#string-raw-bin-guts"
4029
+ }
4030
+ ]
4031
+ },
4032
+ "string-raw-bin-quoted-single-line": {
4033
+ "begin": "(\\b(?:R[bB]|[bB]R))((['\"]))",
4034
+ "beginCaptures": {
4035
+ "1": {
4036
+ "name": "storage.type.string.python"
4037
+ },
4038
+ "2": {
4039
+ "name": "punctuation.definition.string.begin.python"
4040
+ }
4041
+ },
4042
+ "end": "(\\2)|((?<!\\\\)\\n)",
4043
+ "endCaptures": {
4044
+ "1": {
4045
+ "name": "punctuation.definition.string.end.python"
4046
+ },
4047
+ "2": {
4048
+ "name": "invalid.illegal.newline.python"
4049
+ }
4050
+ },
4051
+ "name": "string.quoted.raw.binary.single.python",
4052
+ "patterns": [
4053
+ {
4054
+ "include": "#string-raw-bin-guts"
4055
+ }
4056
+ ]
4057
+ },
4058
+ "string-raw-guts": {
4059
+ "patterns": [
4060
+ {
4061
+ "include": "#string-consume-escape"
4062
+ },
4063
+ {
4064
+ "include": "#string-formatting"
4065
+ },
4066
+ {
4067
+ "include": "#string-brace-formatting"
4068
+ }
4069
+ ]
4070
+ },
4071
+ "string-raw-quoted-multi-line": {
4072
+ "begin": "\\b(([uU]R)|(R))('''|\"\"\")",
4073
+ "beginCaptures": {
4074
+ "2": {
4075
+ "name": "invalid.deprecated.prefix.python"
4076
+ },
4077
+ "3": {
4078
+ "name": "storage.type.string.python"
4079
+ },
4080
+ "4": {
4081
+ "name": "punctuation.definition.string.begin.python"
4082
+ }
4083
+ },
4084
+ "end": "(\\4)",
4085
+ "endCaptures": {
4086
+ "1": {
4087
+ "name": "punctuation.definition.string.end.python"
4088
+ },
4089
+ "2": {
4090
+ "name": "invalid.illegal.newline.python"
4091
+ }
4092
+ },
4093
+ "name": "string.quoted.raw.multi.python",
4094
+ "patterns": [
4095
+ {
4096
+ "include": "#string-multi-bad-brace1-formatting-raw"
4097
+ },
4098
+ {
4099
+ "include": "#string-multi-bad-brace2-formatting-raw"
4100
+ },
4101
+ {
4102
+ "include": "#string-raw-guts"
4103
+ }
4104
+ ]
4105
+ },
4106
+ "string-raw-quoted-single-line": {
4107
+ "begin": "\\b(([uU]R)|(R))((['\"]))",
4108
+ "beginCaptures": {
4109
+ "2": {
4110
+ "name": "invalid.deprecated.prefix.python"
4111
+ },
4112
+ "3": {
4113
+ "name": "storage.type.string.python"
4114
+ },
4115
+ "4": {
4116
+ "name": "punctuation.definition.string.begin.python"
4117
+ }
4118
+ },
4119
+ "end": "(\\4)|((?<!\\\\)\\n)",
4120
+ "endCaptures": {
4121
+ "1": {
4122
+ "name": "punctuation.definition.string.end.python"
4123
+ },
4124
+ "2": {
4125
+ "name": "invalid.illegal.newline.python"
4126
+ }
4127
+ },
4128
+ "name": "string.quoted.raw.single.python",
4129
+ "patterns": [
4130
+ {
4131
+ "include": "#string-single-bad-brace1-formatting-raw"
4132
+ },
4133
+ {
4134
+ "include": "#string-single-bad-brace2-formatting-raw"
4135
+ },
4136
+ {
4137
+ "include": "#string-raw-guts"
4138
+ }
4139
+ ]
4140
+ },
4141
+ "string-single-bad-brace1-formatting-raw": {
4142
+ "begin": "(?x)\n (?= \\{%\n ( .*? (?!(['\"])|((?<!\\\\)\\n)) )\n %\\}\n )\n",
4143
+ "comment": "template using {% ... %}",
4144
+ "end": "(?=(['\"])|((?<!\\\\)\\n))",
4145
+ "patterns": [
4146
+ {
4147
+ "include": "#string-consume-escape"
4148
+ }
4149
+ ]
4150
+ },
4151
+ "string-single-bad-brace1-formatting-unicode": {
4152
+ "begin": "(?x)\n (?= \\{%\n ( .*? (?!(['\"])|((?<!\\\\)\\n)) )\n %\\}\n )\n",
4153
+ "comment": "template using {% ... %}",
4154
+ "end": "(?=(['\"])|((?<!\\\\)\\n))",
4155
+ "patterns": [
4156
+ {
4157
+ "include": "#escape-sequence-unicode"
4158
+ },
4159
+ {
4160
+ "include": "#escape-sequence"
4161
+ },
4162
+ {
4163
+ "include": "#string-line-continuation"
4164
+ }
4165
+ ]
4166
+ },
4167
+ "string-single-bad-brace2-formatting-raw": {
4168
+ "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!(['\"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]\n )\n .*?(?!(['\"])|((?<!\\\\)\\n))\n \\}\n )\n",
4169
+ "comment": "odd format or format-like syntax",
4170
+ "end": "(?=(['\"])|((?<!\\\\)\\n))",
4171
+ "patterns": [
4172
+ {
4173
+ "include": "#string-consume-escape"
4174
+ },
4175
+ {
4176
+ "include": "#string-formatting"
4177
+ }
4178
+ ]
4179
+ },
4180
+ "string-single-bad-brace2-formatting-unicode": {
4181
+ "begin": "(?x)\n (?!\\{\\{)\n (?= \\{ (\n \\w*? (?!(['\"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]\n )\n .*?(?!(['\"])|((?<!\\\\)\\n))\n \\}\n )\n",
4182
+ "comment": "odd format or format-like syntax",
4183
+ "end": "(?=(['\"])|((?<!\\\\)\\n))",
4184
+ "patterns": [
4185
+ {
4186
+ "include": "#escape-sequence-unicode"
4187
+ },
4188
+ {
4189
+ "include": "#string-entity"
4190
+ }
4191
+ ]
4192
+ },
4193
+ "string-unicode-guts": {
4194
+ "patterns": [
4195
+ {
4196
+ "include": "#escape-sequence-unicode"
4197
+ },
4198
+ {
4199
+ "include": "#string-entity"
4200
+ },
4201
+ {
4202
+ "include": "#string-brace-formatting"
4203
+ }
4204
+ ]
4205
+ }
4206
+ },
4207
+ "scopeName": "source.python"
4208
+ }