PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.6
Code Block Pro – Beautiful Syntax Highlighting v1.27.6
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / python.tmLanguage.json

python.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.27.6, at build/shiki/languages/python.tmLanguage.json

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