@kong-ui-public/documentation 0.3.42 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tableau10-GLA_9iAD-BMurskAd.js +9 -0
- package/dist/arc-BSRpyMf3-C5dasNo_.js +86 -0
- package/dist/array-CqVTtuYm-fKLgkG2b.js +6 -0
- package/dist/astro-mwoSwJnq-CNh-xuM0.js +27 -0
- package/dist/blockDiagram-6b2b5046-D02VCbQO-CPmGy0xX.js +1224 -0
- package/dist/c-eDnjw9rh-eDnjw9rh.js +87 -0
- package/dist/c4Diagram-b947cdbb-gYcL5VzP-DIDY83e1.js +1578 -0
- package/dist/channel-DHTQ8Ynn-7OPGex2S.js +5 -0
- package/dist/classDiagram-35230388-JdSKLSZv-D2crBRy-.js +217 -0
- package/dist/classDiagram-v2-412acd34-DFFRHXE_-B6aCxlD1.js +200 -0
- package/dist/clone-p6h9XXNm-3JQ-HRC6.js +8 -0
- package/dist/coffee-CRlSxcc3-CY091_1T.js +108 -0
- package/dist/cpp-DizfY48B-CA38N4Mn.js +208 -0
- package/dist/createText-423428c9-LivTKT7b-BXNfjcdp.js +2964 -0
- package/dist/csharp-uGDiXTZn-uGDiXTZn.js +762 -0
- package/dist/css-CAzixsid-CEpuX1HY.js +511 -0
- package/dist/csv-D4BoHddH-D4BoHddH.js +7 -0
- package/dist/diff-Bo5iyMQ2-Bo5iyMQ2.js +7 -0
- package/dist/docker-B10O2enb-B10O2enb.js +7 -0
- package/dist/documentation.es.js +5 -3130
- package/dist/documentation.umd.js +10152 -50
- package/dist/edges-d417c7a0-C1ggiwWz-Aj0OUf7e.js +1082 -0
- package/dist/erDiagram-0ea73325-mz0Z_-DA-Dr01LsTB.js +924 -0
- package/dist/flowDb-d35e309a-CPyxEMIt-lofeyUuw.js +1126 -0
- package/dist/flowDiagram-d949d7c1-DqCa0HNN-BK5wNO9Z.js +782 -0
- package/dist/flowDiagram-v2-49332944-UMosz1sZ-BG39AuNP.js +17 -0
- package/dist/flowchart-elk-definition-27cc417a-D2UKpS6N-r2p34307.js +48387 -0
- package/dist/ganttDiagram-5c869e3b-CVBHw4pG-CaG9QXQM.js +2490 -0
- package/dist/git-commit-CWf81VOF-DtOZSoIU.js +9 -0
- package/dist/git-rebase-sR-yVH_J-D5M2oE9O.js +9 -0
- package/dist/gitGraphDiagram-b9d81de9-BGm3fU0n-CbCpf-4j.js +1262 -0
- package/dist/go-BCCWZWY1-BCCWZWY1.js +7 -0
- package/dist/graph-4FyIWFHN-774TpNLL.js +870 -0
- package/dist/graphql-CT32SSoq-1pBWfpcR.js +18 -0
- package/dist/haml-8RvrfhLO-Bbc4xoLP.js +19 -0
- package/dist/handlebars-Cr5ro0bH-CLcCNLtV.js +15 -0
- package/dist/haskell-BfFu8DD8-BmkPJdLL.js +565 -0
- package/dist/html-BZB5lEhh-B74zAnWx.js +84 -0
- package/dist/html-derivative-0y7sV5Qc-D8-muTWn.js +9 -0
- package/dist/index-8fae9850-_CN7MNjP-Cq-s0PmS.js +373 -0
- package/dist/index-B-5DuDrq.js +29996 -0
- package/dist/infoDiagram-db7b18fc-V446j9uR-GSa8bniv.js +319 -0
- package/dist/ini-BsUFIxsI-BsUFIxsI.js +7 -0
- package/dist/init-DjUOC4st-C8Nwz6AJ.js +16 -0
- package/dist/java-Bk2JzfKB-Bk2JzfKB.js +74 -0
- package/dist/javascript-DqVBMyXe-DqVBMyXe.js +705 -0
- package/dist/journeyDiagram-d5636530-CFiu7dnV-DJMu6A22.js +803 -0
- package/dist/json-B12k4-6m-B12k4-6m.js +31 -0
- package/dist/json5-CvqQZK9I-CvqQZK9I.js +23 -0
- package/dist/jsonc-v2qGKRJY-v2qGKRJY.js +31 -0
- package/dist/jsonl-izxnMeZX-izxnMeZX.js +31 -0
- package/dist/jsx-aDp7j9_Z-aDp7j9_Z.js +705 -0
- package/dist/kotlin-NOMOielb-NOMOielb.js +7 -0
- package/dist/latex-Bw_ghldO-BlUAi6pB.js +339 -0
- package/dist/layout-2-aEcfuw-BqqWy5wB.js +1524 -0
- package/dist/less-CW2GmQHL-CW2GmQHL.js +165 -0
- package/dist/line-nVq5kEiy-DtZd3PHZ.js +34 -0
- package/dist/linear-Bz4oRFvQ-C869GXbm.js +447 -0
- package/dist/liquid-DJ2rh7oT-FwZwa67Y.js +28 -0
- package/dist/lua-5TZ-G8Be-CogscVHC.js +9 -0
- package/dist/make-whncTQWE-whncTQWE.js +7 -0
- package/dist/markdown-DYKdIx5--DYKdIx5-.js +135 -0
- package/dist/material-theme-lighter-BRE1Bis3-BRE1Bis3.js +769 -0
- package/dist/material-theme-palenight-Dhz61Tee-Dhz61Tee.js +769 -0
- package/dist/mdc-D0DPLwil-BfE3hy8_.js +88 -0
- package/dist/mdx-CKDMxEaL-CKDMxEaL.js +7 -0
- package/dist/mermaid-BxNM-z-u-BxNM-z-u.js +7 -0
- package/dist/mindmap-definition-377f8f1f-C2vFYDMs-B71SGbvx.js +19078 -0
- package/dist/nginx-C082G13W-vryM9k1W.js +9 -0
- package/dist/objective-c-BVtzkNiv-BVtzkNiv.js +115 -0
- package/dist/onig-BonMD2gC-BonMD2gC.js +4 -0
- package/dist/ordinal-MUacOSdK-B1MUT0BL.js +65 -0
- package/dist/pascal-CrvtytWS-CrvtytWS.js +7 -0
- package/dist/path-Crsf9Nsj-SiSjwXsf.js +91 -0
- package/dist/perl-D29UPKP6-Dez6-HRy.js +17 -0
- package/dist/php-D7Tl-iS7-BtPFrDEt.js +789 -0
- package/dist/pieDiagram-b0208e96-DhA_SoTh-CfDd9YdA.js +501 -0
- package/dist/plsql-8SPzZKaa-8SPzZKaa.js +7 -0
- package/dist/postcss-Cz2vjx_4-Cz2vjx_4.js +7 -0
- package/dist/powershell-B0buHCuS-B0buHCuS.js +7 -0
- package/dist/proto-6YaU_lta-6YaU_lta.js +7 -0
- package/dist/pug-DbFO7359-duYD8LVa.js +21 -0
- package/dist/python-BQXev0_W-BQXev0_W.js +524 -0
- package/dist/quadrantDiagram-0332be45-C8q96Ohm-DMblaqnx.js +903 -0
- package/dist/r-DU7Q70f1-DU7Q70f1.js +7 -0
- package/dist/reg-DoGLEyFr-DoGLEyFr.js +7 -0
- package/dist/requirementDiagram-bf7890df-D30zCZjB-B_JBC9RM.js +767 -0
- package/dist/rst-Bm1i8IkK-C9EaDq6g.js +26 -0
- package/dist/ruby-CZZKXaz8-BxaDEkRP.js +102 -0
- package/dist/rust-CIl6NRUt-CIl6NRUt.js +7 -0
- package/dist/sankeyDiagram-0acdec17-B4vNjMaS-Bauvtonp.js +816 -0
- package/dist/sass-LqXmC1Fh-LqXmC1Fh.js +8 -0
- package/dist/scss-DjxgF7f7-DGTzny6p.js +98 -0
- package/dist/sequenceDiagram-c18d009d-BniqGSPK-DuYYUmiZ.js +2201 -0
- package/dist/shellscript-CUUTQKn5-CUUTQKn5.js +7 -0
- package/dist/shellsession-BIPXtZci-D6avbCwN.js +9 -0
- package/dist/splunk-C0K00wNV-C0K00wNV.js +7 -0
- package/dist/sql-DkzN59UV-DkzN59UV.js +27 -0
- package/dist/ssh-config-BbWAW6SY-BbWAW6SY.js +7 -0
- package/dist/stateDiagram-43596fc0-F0V9suMd-L2Ywe-J_.js +266 -0
- package/dist/stateDiagram-v2-2ead4f9c-DUgJH8tF-BVo1q2i1.js +184 -0
- package/dist/style.css +1 -1
- package/dist/styles-6860f46c-Dflmq0ac-BRNSwis6.js +1089 -0
- package/dist/styles-7383a064-Dg7mXkpq-C4bItohl.js +430 -0
- package/dist/styles-b2c874b6-HpcOhE4Y-Bj0upXzO.js +960 -0
- package/dist/stylus-CAHdVuhm-CAHdVuhm.js +21 -0
- package/dist/svelte-DAxjO8Sh-D0e501jC.js +29 -0
- package/dist/svgDrawCommon-0ee1b4e9-CNkCfzsJ-Bz_doYLk.js +64 -0
- package/dist/swift-x2DVyVjN-Bz5PC9YM.js +550 -0
- package/dist/timeline-definition-d977decf-Cl38e_0g-D_Dlqa-R.js +794 -0
- package/dist/toml-Dbtbfmwk-Dbtbfmwk.js +75 -0
- package/dist/tsx-BmwsDeeh-BmwsDeeh.js +705 -0
- package/dist/twig-B_Gr-ODl-Cl9Q0GWo.js +58 -0
- package/dist/types/components/DocumentationContent.vue.d.ts +8 -1
- package/dist/types/components/DocumentationContent.vue.d.ts.map +1 -1
- package/dist/types/components/DocumentationDisplay.vue.d.ts +5 -1
- package/dist/types/components/DocumentationDisplay.vue.d.ts.map +1 -1
- package/dist/types/components/ProductDocumentModal.vue.d.ts +1 -1
- package/dist/types/components/ProductDocumentModal.vue.d.ts.map +1 -1
- package/dist/types/composables/useI18n.d.ts +4 -0
- package/dist/types/composables/useI18n.d.ts.map +1 -1
- package/dist/typescript-AEg-ehu7-AEg-ehu7.js +672 -0
- package/dist/v-BuvBsUKm-BuvBsUKm.js +7 -0
- package/dist/vb-cqjo5dul-cqjo5dul.js +7 -0
- package/dist/viml-h3ATW6He-h3ATW6He.js +7 -0
- package/dist/vue-Dz-azHaT-B9qBHMZi.js +71 -0
- package/dist/vue-html-DIGKAAs4-BeHSIJcx.js +11 -0
- package/dist/wasm-xOGcJ9Ts-xOGcJ9Ts.js +7 -0
- package/dist/wgsl-hGLOfCya-hGLOfCya.js +7 -0
- package/dist/xml-CfRpfi_B-BH3JRQfc.js +9 -0
- package/dist/xsl-BAqhSCYL-BTKPZRNQ.js +9 -0
- package/dist/xychartDiagram-e50adddc-JdLmRUgg-HmDalTeo.js +1282 -0
- package/dist/yaml-PGla5xPP-HJurM_FJ.js +206 -0
- package/package.json +13 -13
- package/dist/prism-bash.min-DDo5CyRs-DihCfXgx.js +0 -7
- package/dist/prism-css.min-BrrzZC7b-BrrzZC7b.js +0 -7
- package/dist/prism-docker.min-DnIEokC3-D0v8IWN_.js +0 -22
- package/dist/prism-go.min-C7UmK6TW-C7UmK6TW.js +0 -1
- package/dist/prism-http.min-CsU3-jB8-CQ8PCDXl.js +0 -23
- package/dist/prism-javascript.min-CEqHqgbm-CEqHqgbm.js +0 -8
- package/dist/prism-jq.min-Q555vXZm-Q555vXZm.js +0 -8
- package/dist/prism-json.min-B1GJqK1k-B1GJqK1k.js +0 -1
- package/dist/prism-log.min-SDopTpKN-SDopTpKN.js +0 -1
- package/dist/prism-lua.min-DwRnUVfS-DwRnUVfS.js +0 -1
- package/dist/prism-makefile.min-DyutknhE-DyutknhE.js +0 -1
- package/dist/prism-markdown.min-B7US-xc7-DB9aF_ZA.js +0 -63
- package/dist/prism-python.min-BIfpAh5K-BIfpAh5K.js +0 -1
- package/dist/prism-regex.min-f8DNqi8X-f8DNqi8X.js +0 -4
- package/dist/prism-rest.min-B6veHRJF-B6veHRJF.js +0 -1
- package/dist/prism-rust.min-Cb-Mi-h0-Cb-Mi-h0.js +0 -9
- package/dist/prism-scss.min-B0csyGJo-B0csyGJo.js +0 -1
- package/dist/prism-sql.min-BHXzX-c_-BHXzX-c_.js +0 -1
- package/dist/prism-typescript.min-oSVeWCAd-oSVeWCAd.js +0 -5
- package/dist/prism-xml-doc.min-yj0YzRGe-KgTQx-dc.js +0 -7
- package/dist/prism-yaml.min-CTetcdKA-C1YzP_OY.js +0 -28
|
@@ -0,0 +1,524 @@
|
|
|
1
|
+
const e = Object.freeze({ displayName: "Python", name: "python", patterns: [{ include: "#statement" }, { include: "#expression" }], repository: { "annotated-parameter": { begin: `(?x)
|
|
2
|
+
\\b
|
|
3
|
+
([[:alpha:]_]\\w*) \\s* (:)
|
|
4
|
+
`, beginCaptures: { 1: { name: "variable.parameter.function.language.python" }, 2: { name: "punctuation.separator.annotation.python" } }, end: "(,)|(?=\\))", endCaptures: { 1: { name: "punctuation.separator.parameters.python" } }, patterns: [{ include: "#expression" }, { match: "=(?!=)", name: "keyword.operator.assignment.python" }] }, "assignment-operator": { match: `(?x)
|
|
5
|
+
<<= | >>= | //= | \\*\\*=
|
|
6
|
+
| \\+= | -= | /= | @=
|
|
7
|
+
| \\*= | %= | ~= | \\^= | &= | \\|=
|
|
8
|
+
| =(?!=)
|
|
9
|
+
`, name: "keyword.operator.assignment.python" }, backticks: { begin: "\\`", end: "(?:\\`|(?<!\\\\)(\\n))", name: "invalid.deprecated.backtick.python", patterns: [{ include: "#expression" }] }, "builtin-callables": { patterns: [{ include: "#illegal-names" }, { include: "#illegal-object-name" }, { include: "#builtin-exceptions" }, { include: "#builtin-functions" }, { include: "#builtin-types" }] }, "builtin-exceptions": { match: `(?x) (?<!\\.) \\b(
|
|
10
|
+
(
|
|
11
|
+
Arithmetic | Assertion | Attribute | Buffer | BlockingIO
|
|
12
|
+
| BrokenPipe | ChildProcess
|
|
13
|
+
| (Connection (Aborted | Refused | Reset)?)
|
|
14
|
+
| EOF | Environment | FileExists | FileNotFound
|
|
15
|
+
| FloatingPoint | IO | Import | Indentation | Index | Interrupted
|
|
16
|
+
| IsADirectory | NotADirectory | Permission | ProcessLookup
|
|
17
|
+
| Timeout
|
|
18
|
+
| Key | Lookup | Memory | Name | NotImplemented | OS | Overflow
|
|
19
|
+
| Reference | Runtime | Recursion | Syntax | System
|
|
20
|
+
| Tab | Type | UnboundLocal | Unicode(Encode|Decode|Translate)?
|
|
21
|
+
| Value | Windows | ZeroDivision | ModuleNotFound
|
|
22
|
+
) Error
|
|
23
|
+
|
|
|
24
|
+
((Pending)?Deprecation | Runtime | Syntax | User | Future | Import
|
|
25
|
+
| Unicode | Bytes | Resource
|
|
26
|
+
)? Warning
|
|
27
|
+
|
|
|
28
|
+
SystemExit | Stop(Async)?Iteration
|
|
29
|
+
| KeyboardInterrupt
|
|
30
|
+
| GeneratorExit | (Base)?Exception
|
|
31
|
+
)\\b
|
|
32
|
+
`, name: "support.type.exception.python" }, "builtin-functions": { patterns: [{ match: `(?x)
|
|
33
|
+
(?<!\\.) \\b(
|
|
34
|
+
__import__ | abs | aiter | all | any | anext | ascii | bin
|
|
35
|
+
| breakpoint | callable | chr | compile | copyright | credits
|
|
36
|
+
| delattr | dir | divmod | enumerate | eval | exec | exit
|
|
37
|
+
| filter | format | getattr | globals | hasattr | hash | help
|
|
38
|
+
| hex | id | input | isinstance | issubclass | iter | len
|
|
39
|
+
| license | locals | map | max | memoryview | min | next
|
|
40
|
+
| oct | open | ord | pow | print | quit | range | reload | repr
|
|
41
|
+
| reversed | round | setattr | sorted | sum | vars | zip
|
|
42
|
+
)\\b
|
|
43
|
+
`, name: "support.function.builtin.python" }, { match: `(?x)
|
|
44
|
+
(?<!\\.) \\b(
|
|
45
|
+
file | reduce | intern | raw_input | unicode | cmp | basestring
|
|
46
|
+
| execfile | long | xrange
|
|
47
|
+
)\\b
|
|
48
|
+
`, name: "variable.legacy.builtin.python" }] }, "builtin-possible-callables": { patterns: [{ include: "#builtin-callables" }, { include: "#magic-names" }] }, "builtin-types": { match: `(?x)
|
|
49
|
+
(?<!\\.) \\b(
|
|
50
|
+
bool | bytearray | bytes | classmethod | complex | dict
|
|
51
|
+
| float | frozenset | int | list | object | property
|
|
52
|
+
| set | slice | staticmethod | str | tuple | type
|
|
53
|
+
|
|
54
|
+
(?# Although 'super' is not a type, it's related to types,
|
|
55
|
+
and is special enough to be highlighted differently from
|
|
56
|
+
other built-ins)
|
|
57
|
+
| super
|
|
58
|
+
)\\b
|
|
59
|
+
`, name: "support.type.python" }, "call-wrapper-inheritance": { begin: `(?x)
|
|
60
|
+
\\b(?=
|
|
61
|
+
([[:alpha:]_]\\w*) \\s* (\\()
|
|
62
|
+
)
|
|
63
|
+
`, comment: "same as a function call, but in inheritance context", end: "(\\))", endCaptures: { 1: { name: "punctuation.definition.arguments.end.python" } }, name: "meta.function-call.python", patterns: [{ include: "#inheritance-name" }, { include: "#function-arguments" }] }, "class-declaration": { patterns: [{ begin: `(?x)
|
|
64
|
+
\\s*(class)\\s+
|
|
65
|
+
(?=
|
|
66
|
+
[[:alpha:]_]\\w* \\s* (:|\\()
|
|
67
|
+
)
|
|
68
|
+
`, beginCaptures: { 1: { name: "storage.type.class.python" } }, end: "(:)", endCaptures: { 1: { name: "punctuation.section.class.begin.python" } }, name: "meta.class.python", patterns: [{ include: "#class-name" }, { include: "#class-inheritance" }] }] }, "class-inheritance": { begin: "(\\()", beginCaptures: { 1: { name: "punctuation.definition.inheritance.begin.python" } }, end: "(\\))", endCaptures: { 1: { name: "punctuation.definition.inheritance.end.python" } }, name: "meta.class.inheritance.python", patterns: [{ match: "(\\*\\*|\\*)", name: "keyword.operator.unpacking.arguments.python" }, { match: ",", name: "punctuation.separator.inheritance.python" }, { match: "=(?!=)", name: "keyword.operator.assignment.python" }, { match: "\\bmetaclass\\b", name: "support.type.metaclass.python" }, { include: "#illegal-names" }, { include: "#class-kwarg" }, { include: "#call-wrapper-inheritance" }, { include: "#expression-base" }, { include: "#member-access-class" }, { include: "#inheritance-identifier" }] }, "class-kwarg": { captures: { 1: { name: "entity.other.inherited-class.python variable.parameter.class.python" }, 2: { name: "keyword.operator.assignment.python" } }, match: `(?x)
|
|
69
|
+
\\b ([[:alpha:]_]\\w*) \\s*(=)(?!=)
|
|
70
|
+
` }, "class-name": { patterns: [{ include: "#illegal-object-name" }, { include: "#builtin-possible-callables" }, { match: `(?x)
|
|
71
|
+
\\b ([[:alpha:]_]\\w*) \\b
|
|
72
|
+
`, name: "entity.name.type.class.python" }] }, codetags: { captures: { 1: { name: "keyword.codetag.notation.python" } }, match: "(?:\\b(NOTE|XXX|HACK|FIXME|BUG|TODO)\\b)" }, comments: { patterns: [{ begin: `(?x)
|
|
73
|
+
(?:
|
|
74
|
+
\\# \\s* (type:)
|
|
75
|
+
\\s*+ (?# we want \`\\s*+\` which is possessive quantifier since
|
|
76
|
+
we do not actually want to backtrack when matching
|
|
77
|
+
whitespace here)
|
|
78
|
+
(?! $ | \\#)
|
|
79
|
+
)
|
|
80
|
+
`, beginCaptures: { 0: { name: "meta.typehint.comment.python" }, 1: { name: "comment.typehint.directive.notation.python" } }, contentName: "meta.typehint.comment.python", end: "(?:$|(?=\\#))", name: "comment.line.number-sign.python", patterns: [{ match: `(?x)
|
|
81
|
+
\\G ignore
|
|
82
|
+
(?= \\s* (?: $ | \\#))
|
|
83
|
+
`, name: "comment.typehint.ignore.notation.python" }, { match: `(?x)
|
|
84
|
+
(?<!\\.)\\b(
|
|
85
|
+
bool | bytes | float | int | object | str
|
|
86
|
+
| List | Dict | Iterable | Sequence | Set
|
|
87
|
+
| FrozenSet | Callable | Union | Tuple
|
|
88
|
+
| Any | None
|
|
89
|
+
)\\b
|
|
90
|
+
`, name: "comment.typehint.type.notation.python" }, { match: "([\\[\\]\\(\\),\\.\\=\\*]|(->))", name: "comment.typehint.punctuation.notation.python" }, { match: "([[:alpha:]_]\\w*)", name: "comment.typehint.variable.notation.python" }] }, { include: "#comments-base" }] }, "comments-base": { begin: "(\\#)", beginCaptures: { 1: { name: "punctuation.definition.comment.python" } }, end: "($)", name: "comment.line.number-sign.python", patterns: [{ include: "#codetags" }] }, "comments-string-double-three": { begin: "(\\#)", beginCaptures: { 1: { name: "punctuation.definition.comment.python" } }, end: '($|(?="""))', name: "comment.line.number-sign.python", patterns: [{ include: "#codetags" }] }, "comments-string-single-three": { begin: "(\\#)", beginCaptures: { 1: { name: "punctuation.definition.comment.python" } }, end: "($|(?='''))", name: "comment.line.number-sign.python", patterns: [{ include: "#codetags" }] }, "curly-braces": { begin: "\\{", beginCaptures: { 0: { name: "punctuation.definition.dict.begin.python" } }, end: "\\}", endCaptures: { 0: { name: "punctuation.definition.dict.end.python" } }, patterns: [{ match: ":", name: "punctuation.separator.dict.python" }, { include: "#expression" }] }, decorator: { begin: `(?x)
|
|
91
|
+
^\\s*
|
|
92
|
+
((@)) \\s* (?=[[:alpha:]_]\\w*)
|
|
93
|
+
`, beginCaptures: { 1: { name: "entity.name.function.decorator.python" }, 2: { name: "punctuation.definition.decorator.python" } }, end: `(?x)
|
|
94
|
+
( \\) )
|
|
95
|
+
|
|
96
|
+
(?: (.*?) (?=\\s*(?:\\#|$)) )
|
|
97
|
+
| (?=\\n|\\#)
|
|
98
|
+
`, endCaptures: { 1: { name: "punctuation.definition.arguments.end.python" }, 2: { name: "invalid.illegal.decorator.python" } }, name: "meta.function.decorator.python", patterns: [{ include: "#decorator-name" }, { include: "#function-arguments" }] }, "decorator-name": { patterns: [{ include: "#builtin-callables" }, { include: "#illegal-object-name" }, { captures: { 2: { name: "punctuation.separator.period.python" } }, match: `(?x)
|
|
99
|
+
([[:alpha:]_]\\w*) | (\\.)
|
|
100
|
+
`, name: "entity.name.function.decorator.python" }, { include: "#line-continuation" }, { captures: { 1: { name: "invalid.illegal.decorator.python" } }, match: `(?x)
|
|
101
|
+
\\s* ([^([:alpha:]\\s_\\.#\\\\] .*?) (?=\\#|$)
|
|
102
|
+
`, name: "invalid.illegal.decorator.python" }] }, docstring: { patterns: [{ begin: `(\\'\\'\\'|\\"\\"\\")`, beginCaptures: { 1: { name: "punctuation.definition.string.begin.python" } }, end: "(\\1)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" } }, name: "string.quoted.docstring.multi.python", patterns: [{ include: "#docstring-prompt" }, { include: "#codetags" }, { include: "#docstring-guts-unicode" }] }, { begin: `([rR])(\\'\\'\\'|\\"\\"\\")`, beginCaptures: { 1: { name: "storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python" } }, end: "(\\2)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" } }, name: "string.quoted.docstring.raw.multi.python", patterns: [{ include: "#string-consume-escape" }, { include: "#docstring-prompt" }, { include: "#codetags" }] }, { begin: `(\\'|\\")`, beginCaptures: { 1: { name: "punctuation.definition.string.begin.python" } }, end: "(\\1)|(\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.docstring.single.python", patterns: [{ include: "#codetags" }, { include: "#docstring-guts-unicode" }] }, { begin: `([rR])(\\'|\\")`, beginCaptures: { 1: { name: "storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python" } }, end: "(\\2)|(\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.docstring.raw.single.python", patterns: [{ include: "#string-consume-escape" }, { include: "#codetags" }] }] }, "docstring-guts-unicode": { patterns: [{ include: "#escape-sequence-unicode" }, { include: "#escape-sequence" }, { include: "#string-line-continuation" }] }, "docstring-prompt": { captures: { 1: { name: "keyword.control.flow.python" } }, match: `(?x)
|
|
103
|
+
(?:
|
|
104
|
+
(?:^|\\G) \\s* (?# '\\G' is necessary for ST)
|
|
105
|
+
((?:>>>|\\.\\.\\.) \\s) (?=\\s*\\S)
|
|
106
|
+
)
|
|
107
|
+
` }, "docstring-statement": { begin: `^(?=\\s*[rR]?(\\'\\'\\'|\\"\\"\\"|\\'|\\"))`, 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", end: `((?<=\\1)|^)(?!\\s*[rR]?(\\'\\'\\'|\\"\\"\\"|\\'|\\"))`, patterns: [{ include: "#docstring" }] }, "double-one-regexp-character-set": { patterns: [{ match: `(?x)
|
|
108
|
+
\\[ \\^? \\] (?! .*?\\])
|
|
109
|
+
` }, { begin: "(\\[)(\\^)?(\\])?", beginCaptures: { 1: { name: "punctuation.character.set.begin.regexp constant.other.set.regexp" }, 2: { name: "keyword.operator.negation.regexp" }, 3: { name: "constant.character.set.regexp" } }, end: '(\\]|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "punctuation.character.set.end.regexp constant.other.set.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.character.set.regexp", patterns: [{ include: "#regexp-charecter-set-escapes" }, { match: "[^\\n]", name: "constant.character.set.regexp" }] }] }, "double-one-regexp-comments": { begin: "\\(\\?#", beginCaptures: { 0: { name: "punctuation.comment.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "punctuation.comment.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "comment.regexp", patterns: [{ include: "#codetags" }] }, "double-one-regexp-conditional": { begin: "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)", beginCaptures: { 0: { name: "keyword.operator.conditional.regexp" }, 1: { name: "punctuation.parenthesis.conditional.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-one-regexp-expression" }] }, "double-one-regexp-expression": { patterns: [{ include: "#regexp-base-expression" }, { include: "#double-one-regexp-character-set" }, { include: "#double-one-regexp-comments" }, { include: "#regexp-flags" }, { include: "#double-one-regexp-named-group" }, { include: "#regexp-backreference" }, { include: "#double-one-regexp-lookahead" }, { include: "#double-one-regexp-lookahead-negative" }, { include: "#double-one-regexp-lookbehind" }, { include: "#double-one-regexp-lookbehind-negative" }, { include: "#double-one-regexp-conditional" }, { include: "#double-one-regexp-parentheses-non-capturing" }, { include: "#double-one-regexp-parentheses" }] }, "double-one-regexp-lookahead": { begin: "(\\()\\?=", beginCaptures: { 0: { name: "keyword.operator.lookahead.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-one-regexp-expression" }] }, "double-one-regexp-lookahead-negative": { begin: "(\\()\\?!", beginCaptures: { 0: { name: "keyword.operator.lookahead.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-one-regexp-expression" }] }, "double-one-regexp-lookbehind": { begin: "(\\()\\?<=", beginCaptures: { 0: { name: "keyword.operator.lookbehind.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-one-regexp-expression" }] }, "double-one-regexp-lookbehind-negative": { begin: "(\\()\\?<!", beginCaptures: { 0: { name: "keyword.operator.lookbehind.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-one-regexp-expression" }] }, "double-one-regexp-named-group": { begin: `(?x)
|
|
110
|
+
(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)
|
|
111
|
+
`, beginCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" }, 2: { name: "entity.name.tag.named.group.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.named.regexp", patterns: [{ include: "#double-one-regexp-expression" }] }, "double-one-regexp-parentheses": { begin: "\\(", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-one-regexp-expression" }] }, "double-one-regexp-parentheses-non-capturing": { begin: "\\(\\?:", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp" } }, end: '(\\)|(?="))|((?=(?<!\\\\)\\n))', endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-one-regexp-expression" }] }, "double-three-regexp-character-set": { patterns: [{ match: `(?x)
|
|
112
|
+
\\[ \\^? \\] (?! .*?\\])
|
|
113
|
+
` }, { begin: "(\\[)(\\^)?(\\])?", beginCaptures: { 1: { name: "punctuation.character.set.begin.regexp constant.other.set.regexp" }, 2: { name: "keyword.operator.negation.regexp" }, 3: { name: "constant.character.set.regexp" } }, end: '(\\]|(?="""))', endCaptures: { 1: { name: "punctuation.character.set.end.regexp constant.other.set.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.character.set.regexp", patterns: [{ include: "#regexp-charecter-set-escapes" }, { match: "[^\\n]", name: "constant.character.set.regexp" }] }] }, "double-three-regexp-comments": { begin: "\\(\\?#", beginCaptures: { 0: { name: "punctuation.comment.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "punctuation.comment.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "comment.regexp", patterns: [{ include: "#codetags" }] }, "double-three-regexp-conditional": { begin: "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)", beginCaptures: { 0: { name: "keyword.operator.conditional.regexp" }, 1: { name: "punctuation.parenthesis.conditional.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-expression": { patterns: [{ include: "#regexp-base-expression" }, { include: "#double-three-regexp-character-set" }, { include: "#double-three-regexp-comments" }, { include: "#regexp-flags" }, { include: "#double-three-regexp-named-group" }, { include: "#regexp-backreference" }, { include: "#double-three-regexp-lookahead" }, { include: "#double-three-regexp-lookahead-negative" }, { include: "#double-three-regexp-lookbehind" }, { include: "#double-three-regexp-lookbehind-negative" }, { include: "#double-three-regexp-conditional" }, { include: "#double-three-regexp-parentheses-non-capturing" }, { include: "#double-three-regexp-parentheses" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-lookahead": { begin: "(\\()\\?=", beginCaptures: { 0: { name: "keyword.operator.lookahead.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-lookahead-negative": { begin: "(\\()\\?!", beginCaptures: { 0: { name: "keyword.operator.lookahead.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-lookbehind": { begin: "(\\()\\?<=", beginCaptures: { 0: { name: "keyword.operator.lookbehind.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-lookbehind-negative": { begin: "(\\()\\?<!", beginCaptures: { 0: { name: "keyword.operator.lookbehind.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-named-group": { begin: `(?x)
|
|
114
|
+
(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)
|
|
115
|
+
`, beginCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" }, 2: { name: "entity.name.tag.named.group.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.named.regexp", patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-parentheses": { begin: "\\(", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, "double-three-regexp-parentheses-non-capturing": { begin: "\\(\\?:", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp" } }, end: '(\\)|(?="""))', endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#double-three-regexp-expression" }, { include: "#comments-string-double-three" }] }, ellipsis: { match: "\\.\\.\\.", name: "constant.other.ellipsis.python" }, "escape-sequence": { match: `(?x)
|
|
116
|
+
\\\\ (
|
|
117
|
+
x[0-9A-Fa-f]{2}
|
|
118
|
+
| [0-7]{1,3}
|
|
119
|
+
| [\\\\"'abfnrtv]
|
|
120
|
+
)
|
|
121
|
+
`, name: "constant.character.escape.python" }, "escape-sequence-unicode": { patterns: [{ match: `(?x)
|
|
122
|
+
\\\\ (
|
|
123
|
+
u[0-9A-Fa-f]{4}
|
|
124
|
+
| U[0-9A-Fa-f]{8}
|
|
125
|
+
| N\\{[\\w\\s]+?\\}
|
|
126
|
+
)
|
|
127
|
+
`, name: "constant.character.escape.python" }] }, expression: { comment: "All valid Python expressions", patterns: [{ include: "#expression-base" }, { include: "#member-access" }, { comment: "Tokenize identifiers to help linters", match: "(?x) \\b ([[:alpha:]_]\\w*) \\b" }] }, "expression-bare": { comment: "valid Python expressions w/o comments and line continuation", patterns: [{ include: "#backticks" }, { include: "#illegal-anno" }, { include: "#literal" }, { include: "#regexp" }, { include: "#string" }, { include: "#lambda" }, { include: "#generator" }, { include: "#illegal-operator" }, { include: "#operator" }, { include: "#curly-braces" }, { include: "#item-access" }, { include: "#list" }, { include: "#odd-function-call" }, { include: "#round-braces" }, { include: "#function-call" }, { include: "#builtin-functions" }, { include: "#builtin-types" }, { include: "#builtin-exceptions" }, { include: "#magic-names" }, { include: "#special-names" }, { include: "#illegal-names" }, { include: "#special-variables" }, { include: "#ellipsis" }, { include: "#punctuation" }, { include: "#line-continuation" }] }, "expression-base": { comment: "valid Python expressions with comments and line continuation", patterns: [{ include: "#comments" }, { include: "#expression-bare" }, { include: "#line-continuation" }] }, "f-expression": { comment: "All valid Python expressions, except comments and line continuation", patterns: [{ include: "#expression-bare" }, { include: "#member-access" }, { comment: "Tokenize identifiers to help linters", match: "(?x) \\b ([[:alpha:]_]\\w*) \\b" }] }, "fregexp-base-expression": { patterns: [{ include: "#fregexp-quantifier" }, { include: "#fstring-formatting-braces" }, { match: "\\{.*?\\}" }, { include: "#regexp-base-common" }] }, "fregexp-quantifier": { match: `(?x)
|
|
128
|
+
\\{\\{(
|
|
129
|
+
\\d+ | \\d+,(\\d+)? | ,\\d+
|
|
130
|
+
)\\}\\}
|
|
131
|
+
`, name: "keyword.operator.quantifier.regexp" }, "fstring-fnorm-quoted-multi-line": { begin: `(\\b[fF])([bBuU])?('''|""")`, beginCaptures: { 1: { name: "string.interpolated.python string.quoted.multi.python storage.type.string.python" }, 2: { name: "invalid.illegal.prefix.python" }, 3: { name: "punctuation.definition.string.begin.python string.interpolated.python string.quoted.multi.python" } }, end: "(\\3)", endCaptures: { 1: { name: "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.fstring.python", patterns: [{ include: "#fstring-guts" }, { include: "#fstring-illegal-multi-brace" }, { include: "#fstring-multi-brace" }, { include: "#fstring-multi-core" }] }, "fstring-fnorm-quoted-single-line": { begin: `(\\b[fF])([bBuU])?((['"]))`, beginCaptures: { 1: { name: "string.interpolated.python string.quoted.single.python storage.type.string.python" }, 2: { name: "invalid.illegal.prefix.python" }, 3: { name: "punctuation.definition.string.begin.python string.interpolated.python string.quoted.single.python" } }, end: "(\\3)|((?<!\\\\)\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.fstring.python", patterns: [{ include: "#fstring-guts" }, { include: "#fstring-illegal-single-brace" }, { include: "#fstring-single-brace" }, { include: "#fstring-single-core" }] }, "fstring-formatting": { patterns: [{ include: "#fstring-formatting-braces" }, { include: "#fstring-formatting-singe-brace" }] }, "fstring-formatting-braces": { patterns: [{ captures: { 1: { name: "constant.character.format.placeholder.other.python" }, 2: { name: "invalid.illegal.brace.python" }, 3: { name: "constant.character.format.placeholder.other.python" } }, comment: "empty braces are illegal", match: "({)(\\s*?)(})" }, { match: "({{|}})", name: "constant.character.escape.python" }] }, "fstring-formatting-singe-brace": { match: "(}(?!}))", name: "invalid.illegal.brace.python" }, "fstring-guts": { patterns: [{ include: "#escape-sequence-unicode" }, { include: "#escape-sequence" }, { include: "#string-line-continuation" }, { include: "#fstring-formatting" }] }, "fstring-illegal-multi-brace": { patterns: [{ include: "#impossible" }] }, "fstring-illegal-single-brace": { begin: "(\\{)(?=[^\\n}]*$\\n?)", beginCaptures: { 1: { name: "constant.character.format.placeholder.other.python" } }, comment: "it is illegal to have a multiline brace inside a single-line string", end: "(\\})|(?=\\n)", endCaptures: { 1: { name: "constant.character.format.placeholder.other.python" } }, patterns: [{ include: "#fstring-terminator-single" }, { include: "#f-expression" }] }, "fstring-multi-brace": { begin: "(\\{)", beginCaptures: { 1: { name: "constant.character.format.placeholder.other.python" } }, comment: "value interpolation using { ... }", end: `(?x)
|
|
132
|
+
(\\})
|
|
133
|
+
`, endCaptures: { 1: { name: "constant.character.format.placeholder.other.python" } }, patterns: [{ include: "#fstring-terminator-multi" }, { include: "#f-expression" }] }, "fstring-multi-core": { match: `(?x)
|
|
134
|
+
(.+?)
|
|
135
|
+
(
|
|
136
|
+
(?# .* and .*? in multi-line match need special handling of
|
|
137
|
+
newlines otherwise SublimeText and Atom will match slightly
|
|
138
|
+
differently.
|
|
139
|
+
|
|
140
|
+
The guard for newlines has to be separate from the
|
|
141
|
+
lookahead because of special $ matching rule.)
|
|
142
|
+
($\\n?)
|
|
143
|
+
|
|
|
144
|
+
(?=[\\\\\\}\\{]|'''|""")
|
|
145
|
+
)
|
|
146
|
+
(?# due to how multiline regexps are matched we need a special case
|
|
147
|
+
for matching a newline character)
|
|
148
|
+
| \\n
|
|
149
|
+
`, name: "string.interpolated.python string.quoted.multi.python" }, "fstring-normf-quoted-multi-line": { begin: `(\\b[bBuU])([fF])('''|""")`, beginCaptures: { 1: { name: "invalid.illegal.prefix.python" }, 2: { name: "string.interpolated.python string.quoted.multi.python storage.type.string.python" }, 3: { name: "punctuation.definition.string.begin.python string.quoted.multi.python" } }, end: "(\\3)", endCaptures: { 1: { name: "punctuation.definition.string.end.python string.interpolated.python string.quoted.multi.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.fstring.python", patterns: [{ include: "#fstring-guts" }, { include: "#fstring-illegal-multi-brace" }, { include: "#fstring-multi-brace" }, { include: "#fstring-multi-core" }] }, "fstring-normf-quoted-single-line": { begin: `(\\b[bBuU])([fF])((['"]))`, beginCaptures: { 1: { name: "invalid.illegal.prefix.python" }, 2: { name: "string.interpolated.python string.quoted.single.python storage.type.string.python" }, 3: { name: "punctuation.definition.string.begin.python string.quoted.single.python" } }, end: "(\\3)|((?<!\\\\)\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python string.interpolated.python string.quoted.single.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.fstring.python", patterns: [{ include: "#fstring-guts" }, { include: "#fstring-illegal-single-brace" }, { include: "#fstring-single-brace" }, { include: "#fstring-single-core" }] }, "fstring-raw-guts": { patterns: [{ include: "#string-consume-escape" }, { include: "#fstring-formatting" }] }, "fstring-raw-multi-core": { match: `(?x)
|
|
150
|
+
(.+?)
|
|
151
|
+
(
|
|
152
|
+
(?# .* and .*? in multi-line match need special handling of
|
|
153
|
+
newlines otherwise SublimeText and Atom will match slightly
|
|
154
|
+
differently.
|
|
155
|
+
|
|
156
|
+
The guard for newlines has to be separate from the
|
|
157
|
+
lookahead because of special $ matching rule.)
|
|
158
|
+
($\\n?)
|
|
159
|
+
|
|
|
160
|
+
(?=[\\\\\\}\\{]|'''|""")
|
|
161
|
+
)
|
|
162
|
+
(?# due to how multiline regexps are matched we need a special case
|
|
163
|
+
for matching a newline character)
|
|
164
|
+
| \\n
|
|
165
|
+
`, name: "string.interpolated.python string.quoted.raw.multi.python" }, "fstring-raw-quoted-multi-line": { begin: `(\\b(?:[rR][fF]|[fF][rR]))('''|""")`, beginCaptures: { 1: { name: "string.interpolated.python string.quoted.raw.multi.python storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python string.quoted.raw.multi.python" } }, end: "(\\2)", endCaptures: { 1: { name: "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.multi.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.fstring.python", patterns: [{ include: "#fstring-raw-guts" }, { include: "#fstring-illegal-multi-brace" }, { include: "#fstring-multi-brace" }, { include: "#fstring-raw-multi-core" }] }, "fstring-raw-quoted-single-line": { begin: `(\\b(?:[rR][fF]|[fF][rR]))((['"]))`, beginCaptures: { 1: { name: "string.interpolated.python string.quoted.raw.single.python storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python string.quoted.raw.single.python" } }, end: "(\\2)|((?<!\\\\)\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python string.interpolated.python string.quoted.raw.single.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.fstring.python", patterns: [{ include: "#fstring-raw-guts" }, { include: "#fstring-illegal-single-brace" }, { include: "#fstring-single-brace" }, { include: "#fstring-raw-single-core" }] }, "fstring-raw-single-core": { match: `(?x)
|
|
166
|
+
(.+?)
|
|
167
|
+
(
|
|
168
|
+
(?# .* and .*? in multi-line match need special handling of
|
|
169
|
+
newlines otherwise SublimeText and Atom will match slightly
|
|
170
|
+
differently.
|
|
171
|
+
|
|
172
|
+
The guard for newlines has to be separate from the
|
|
173
|
+
lookahead because of special $ matching rule.)
|
|
174
|
+
($\\n?)
|
|
175
|
+
|
|
|
176
|
+
(?=[\\\\\\}\\{]|(['"])|((?<!\\\\)\\n))
|
|
177
|
+
)
|
|
178
|
+
(?# due to how multiline regexps are matched we need a special case
|
|
179
|
+
for matching a newline character)
|
|
180
|
+
| \\n
|
|
181
|
+
`, name: "string.interpolated.python string.quoted.raw.single.python" }, "fstring-single-brace": { begin: "(\\{)", beginCaptures: { 1: { name: "constant.character.format.placeholder.other.python" } }, comment: "value interpolation using { ... }", end: `(?x)
|
|
182
|
+
(\\})|(?=\\n)
|
|
183
|
+
`, endCaptures: { 1: { name: "constant.character.format.placeholder.other.python" } }, patterns: [{ include: "#fstring-terminator-single" }, { include: "#f-expression" }] }, "fstring-single-core": { match: `(?x)
|
|
184
|
+
(.+?)
|
|
185
|
+
(
|
|
186
|
+
(?# .* and .*? in multi-line match need special handling of
|
|
187
|
+
newlines otherwise SublimeText and Atom will match slightly
|
|
188
|
+
differently.
|
|
189
|
+
|
|
190
|
+
The guard for newlines has to be separate from the
|
|
191
|
+
lookahead because of special $ matching rule.)
|
|
192
|
+
($\\n?)
|
|
193
|
+
|
|
|
194
|
+
(?=[\\\\\\}\\{]|(['"])|((?<!\\\\)\\n))
|
|
195
|
+
)
|
|
196
|
+
(?# due to how multiline regexps are matched we need a special case
|
|
197
|
+
for matching a newline character)
|
|
198
|
+
| \\n
|
|
199
|
+
`, name: "string.interpolated.python string.quoted.single.python" }, "fstring-terminator-multi": { patterns: [{ match: "(=(![rsa])?)(?=})", name: "storage.type.format.python" }, { match: "(=?![rsa])(?=})", name: "storage.type.format.python" }, { captures: { 1: { name: "storage.type.format.python" }, 2: { name: "storage.type.format.python" } }, match: `(?x)
|
|
200
|
+
( (?: =?) (?: ![rsa])? )
|
|
201
|
+
( : \\w? [<>=^]? [-+ ]? \\#?
|
|
202
|
+
\\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})
|
|
203
|
+
` }, { include: "#fstring-terminator-multi-tail" }] }, "fstring-terminator-multi-tail": { begin: "((?:=?)(?:![rsa])?)(:)(?=.*?{)", beginCaptures: { 1: { name: "storage.type.format.python" }, 2: { name: "storage.type.format.python" } }, end: "(?=})", patterns: [{ include: "#fstring-illegal-multi-brace" }, { include: "#fstring-multi-brace" }, { match: "([bcdeEfFgGnosxX%])(?=})", name: "storage.type.format.python" }, { match: "(\\.\\d+)", name: "storage.type.format.python" }, { match: "(,)", name: "storage.type.format.python" }, { match: "(\\d+)", name: "storage.type.format.python" }, { match: "(\\#)", name: "storage.type.format.python" }, { match: "([-+ ])", name: "storage.type.format.python" }, { match: "([<>=^])", name: "storage.type.format.python" }, { match: "(\\w)", name: "storage.type.format.python" }] }, "fstring-terminator-single": { patterns: [{ match: "(=(![rsa])?)(?=})", name: "storage.type.format.python" }, { match: "(=?![rsa])(?=})", name: "storage.type.format.python" }, { captures: { 1: { name: "storage.type.format.python" }, 2: { name: "storage.type.format.python" } }, match: `(?x)
|
|
204
|
+
( (?: =?) (?: ![rsa])? )
|
|
205
|
+
( : \\w? [<>=^]? [-+ ]? \\#?
|
|
206
|
+
\\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})
|
|
207
|
+
` }, { include: "#fstring-terminator-single-tail" }] }, "fstring-terminator-single-tail": { begin: "((?:=?)(?:![rsa])?)(:)(?=.*?{)", beginCaptures: { 1: { name: "storage.type.format.python" }, 2: { name: "storage.type.format.python" } }, end: "(?=})|(?=\\n)", patterns: [{ include: "#fstring-illegal-single-brace" }, { include: "#fstring-single-brace" }, { match: "([bcdeEfFgGnosxX%])(?=})", name: "storage.type.format.python" }, { match: "(\\.\\d+)", name: "storage.type.format.python" }, { match: "(,)", name: "storage.type.format.python" }, { match: "(\\d+)", name: "storage.type.format.python" }, { match: "(\\#)", name: "storage.type.format.python" }, { match: "([-+ ])", name: "storage.type.format.python" }, { match: "([<>=^])", name: "storage.type.format.python" }, { match: "(\\w)", name: "storage.type.format.python" }] }, "function-arguments": { begin: "(\\()", beginCaptures: { 1: { name: "punctuation.definition.arguments.begin.python" } }, contentName: "meta.function-call.arguments.python", end: "(?=\\))(?!\\)\\s*\\()", patterns: [{ match: "(,)", name: "punctuation.separator.arguments.python" }, { captures: { 1: { name: "keyword.operator.unpacking.arguments.python" } }, match: `(?x)
|
|
208
|
+
(?:(?<=[,(])|^) \\s* (\\*{1,2})
|
|
209
|
+
` }, { include: "#lambda-incomplete" }, { include: "#illegal-names" }, { captures: { 1: { name: "variable.parameter.function-call.python" }, 2: { name: "keyword.operator.assignment.python" } }, match: "\\b([[:alpha:]_]\\w*)\\s*(=)(?!=)" }, { match: "=(?!=)", name: "keyword.operator.assignment.python" }, { include: "#expression" }, { captures: { 1: { name: "punctuation.definition.arguments.end.python" }, 2: { name: "punctuation.definition.arguments.begin.python" } }, match: "\\s*(\\))\\s*(\\()" }] }, "function-call": { begin: `(?x)
|
|
210
|
+
\\b(?=
|
|
211
|
+
([[:alpha:]_]\\w*) \\s* (\\()
|
|
212
|
+
)
|
|
213
|
+
`, comment: 'Regular function call of the type "name(args)"', end: "(\\))", endCaptures: { 1: { name: "punctuation.definition.arguments.end.python" } }, name: "meta.function-call.python", patterns: [{ include: "#special-variables" }, { include: "#function-name" }, { include: "#function-arguments" }] }, "function-declaration": { begin: `(?x)
|
|
214
|
+
\\s*
|
|
215
|
+
(?:\\b(async) \\s+)? \\b(def)\\s+
|
|
216
|
+
(?=
|
|
217
|
+
[[:alpha:]_][[:word:]]* \\s* \\(
|
|
218
|
+
)
|
|
219
|
+
`, beginCaptures: { 1: { name: "storage.type.function.async.python" }, 2: { name: "storage.type.function.python" } }, end: `(:|(?=[#'"\\n]))`, endCaptures: { 1: { name: "punctuation.section.function.begin.python" } }, name: "meta.function.python", patterns: [{ include: "#function-def-name" }, { include: "#parameters" }, { include: "#line-continuation" }, { include: "#return-annotation" }] }, "function-def-name": { patterns: [{ include: "#illegal-object-name" }, { include: "#builtin-possible-callables" }, { match: `(?x)
|
|
220
|
+
\\b ([[:alpha:]_]\\w*) \\b
|
|
221
|
+
`, name: "entity.name.function.python" }] }, "function-name": { patterns: [{ include: "#builtin-possible-callables" }, { comment: "Some color schemas support meta.function-call.generic scope", match: `(?x)
|
|
222
|
+
\\b ([[:alpha:]_]\\w*) \\b
|
|
223
|
+
`, name: "meta.function-call.generic.python" }] }, generator: { begin: "\\bfor\\b", beginCaptures: { 0: { name: "keyword.control.flow.python" } }, comment: `Match "for ... in" construct used in generators and for loops to
|
|
224
|
+
correctly identify the "in" as a control flow keyword.
|
|
225
|
+
`, end: "\\bin\\b", endCaptures: { 0: { name: "keyword.control.flow.python" } }, patterns: [{ include: "#expression" }] }, "illegal-anno": { match: "->", name: "invalid.illegal.annotation.python" }, "illegal-names": { captures: { 1: { name: "keyword.control.flow.python" }, 2: { name: "keyword.control.import.python" } }, match: `(?x)
|
|
226
|
+
\\b(?:
|
|
227
|
+
(
|
|
228
|
+
and | assert | async | await | break | class | continue | def
|
|
229
|
+
| del | elif | else | except | finally | for | from | global
|
|
230
|
+
| if | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=])
|
|
231
|
+
| nonlocal | not | or | pass | raise | return | try | while | with
|
|
232
|
+
| yield
|
|
233
|
+
) | (
|
|
234
|
+
as | import
|
|
235
|
+
)
|
|
236
|
+
)\\b
|
|
237
|
+
` }, "illegal-object-name": { comment: `It's illegal to name class or function "True"`, match: "\\b(True|False|None)\\b", name: "keyword.illegal.name.python" }, "illegal-operator": { patterns: [{ match: "&&|\\|\\||--|\\+\\+", name: "invalid.illegal.operator.python" }, { match: "[?$]", name: "invalid.illegal.operator.python" }, { comment: "We don't want `!` to flash when we're typing `!=`", match: "!\\b", name: "invalid.illegal.operator.python" }] }, import: { comment: "Import statements used to correctly mark `from`, `import`, and `as`\n", patterns: [{ begin: "\\b(?<!\\.)(from)\\b(?=.+import)", beginCaptures: { 1: { name: "keyword.control.import.python" } }, end: "$|(?=import)", patterns: [{ match: "\\.+", name: "punctuation.separator.period.python" }, { include: "#expression" }] }, { begin: "\\b(?<!\\.)(import)\\b", beginCaptures: { 1: { name: "keyword.control.import.python" } }, end: "$", patterns: [{ match: "\\b(?<!\\.)as\\b", name: "keyword.control.import.python" }, { include: "#expression" }] }] }, impossible: { 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.", match: "$.^" }, "inheritance-identifier": { captures: { 1: { name: "entity.other.inherited-class.python" } }, match: `(?x)
|
|
238
|
+
\\b ([[:alpha:]_]\\w*) \\b
|
|
239
|
+
` }, "inheritance-name": { patterns: [{ include: "#lambda-incomplete" }, { include: "#builtin-possible-callables" }, { include: "#inheritance-identifier" }] }, "item-access": { patterns: [{ begin: `(?x)
|
|
240
|
+
\\b(?=
|
|
241
|
+
[[:alpha:]_]\\w* \\s* \\[
|
|
242
|
+
)
|
|
243
|
+
`, end: "(\\])", endCaptures: { 1: { name: "punctuation.definition.arguments.end.python" } }, name: "meta.item-access.python", patterns: [{ include: "#item-name" }, { include: "#item-index" }, { include: "#expression" }] }] }, "item-index": { begin: "(\\[)", beginCaptures: { 1: { name: "punctuation.definition.arguments.begin.python" } }, contentName: "meta.item-access.arguments.python", end: "(?=\\])", patterns: [{ match: ":", name: "punctuation.separator.slice.python" }, { include: "#expression" }] }, "item-name": { patterns: [{ include: "#special-variables" }, { include: "#builtin-functions" }, { include: "#special-names" }, { match: `(?x)
|
|
244
|
+
\\b ([[:alpha:]_]\\w*) \\b
|
|
245
|
+
`, name: "meta.indexed-name.python" }] }, lambda: { patterns: [{ captures: { 1: { name: "keyword.control.flow.python" } }, match: "((?<=\\.)lambda|lambda(?=\\s*[\\.=]))" }, { captures: { 1: { name: "storage.type.function.lambda.python" } }, match: "\\b(lambda)\\s*?(?=[,\\n]|$)" }, { begin: `(?x)
|
|
246
|
+
\\b (lambda) \\b
|
|
247
|
+
`, beginCaptures: { 1: { name: "storage.type.function.lambda.python" } }, contentName: "meta.function.lambda.parameters.python", end: "(:)|(\\n)", endCaptures: { 1: { name: "punctuation.section.function.lambda.begin.python" } }, name: "meta.lambda-function.python", patterns: [{ match: "/", name: "keyword.operator.positional.parameter.python" }, { match: "(\\*\\*|\\*)", name: "keyword.operator.unpacking.parameter.python" }, { include: "#lambda-nested-incomplete" }, { include: "#illegal-names" }, { captures: { 1: { name: "variable.parameter.function.language.python" }, 2: { name: "punctuation.separator.parameters.python" } }, match: "([[:alpha:]_]\\w*)\\s*(?:(,)|(?=:|$))" }, { include: "#comments" }, { include: "#backticks" }, { include: "#illegal-anno" }, { include: "#lambda-parameter-with-default" }, { include: "#line-continuation" }, { include: "#illegal-operator" }] }] }, "lambda-incomplete": { match: "\\blambda(?=\\s*[,)])", name: "storage.type.function.lambda.python" }, "lambda-nested-incomplete": { match: "\\blambda(?=\\s*[:,)])", name: "storage.type.function.lambda.python" }, "lambda-parameter-with-default": { begin: `(?x)
|
|
248
|
+
\\b
|
|
249
|
+
([[:alpha:]_]\\w*) \\s* (=)
|
|
250
|
+
`, beginCaptures: { 1: { name: "variable.parameter.function.language.python" }, 2: { name: "keyword.operator.python" } }, end: "(,)|(?=:|$)", endCaptures: { 1: { name: "punctuation.separator.parameters.python" } }, patterns: [{ include: "#expression" }] }, "line-continuation": { patterns: [{ captures: { 1: { name: "punctuation.separator.continuation.line.python" }, 2: { name: "invalid.illegal.line.continuation.python" } }, match: "(\\\\)\\s*(\\S.*$\\n?)" }, { begin: "(\\\\)\\s*$\\n?", beginCaptures: { 1: { name: "punctuation.separator.continuation.line.python" } }, end: `(?x)
|
|
251
|
+
(?=^\\s*$)
|
|
252
|
+
|
|
|
253
|
+
(?! (\\s* [rR]? (\\'\\'\\'|\\"\\"\\"|\\'|\\"))
|
|
254
|
+
|
|
|
255
|
+
(\\G $) (?# '\\G' is necessary for ST)
|
|
256
|
+
)
|
|
257
|
+
`, patterns: [{ include: "#regexp" }, { include: "#string" }] }] }, list: { begin: "\\[", beginCaptures: { 0: { name: "punctuation.definition.list.begin.python" } }, end: "\\]", endCaptures: { 0: { name: "punctuation.definition.list.end.python" } }, patterns: [{ include: "#expression" }] }, literal: { patterns: [{ match: "\\b(True|False|None|NotImplemented|Ellipsis)\\b", name: "constant.language.python" }, { include: "#number" }] }, "loose-default": { begin: "(=)", beginCaptures: { 1: { name: "keyword.operator.python" } }, end: "(,)|(?=\\))", endCaptures: { 1: { name: "punctuation.separator.parameters.python" } }, patterns: [{ include: "#expression" }] }, "magic-function-names": { captures: { 1: { name: "support.function.magic.python" } }, comment: `these methods have magic interpretation by python and are generally called
|
|
258
|
+
indirectly through syntactic constructs
|
|
259
|
+
`, match: `(?x)
|
|
260
|
+
\\b(
|
|
261
|
+
__(?:
|
|
262
|
+
abs | add | aenter | aexit | aiter | and | anext
|
|
263
|
+
| await | bool | call | ceil | class_getitem
|
|
264
|
+
| cmp | coerce | complex | contains | copy
|
|
265
|
+
| deepcopy | del | delattr | delete | delitem
|
|
266
|
+
| delslice | dir | div | divmod | enter | eq
|
|
267
|
+
| exit | float | floor | floordiv | format | ge
|
|
268
|
+
| get | getattr | getattribute | getinitargs
|
|
269
|
+
| getitem | getnewargs | getslice | getstate | gt
|
|
270
|
+
| hash | hex | iadd | iand | idiv | ifloordiv |
|
|
271
|
+
| ilshift | imod | imul | index | init
|
|
272
|
+
| instancecheck | int | invert | ior | ipow
|
|
273
|
+
| irshift | isub | iter | itruediv | ixor | le
|
|
274
|
+
| len | long | lshift | lt | missing | mod | mul
|
|
275
|
+
| ne | neg | new | next | nonzero | oct | or | pos
|
|
276
|
+
| pow | radd | rand | rdiv | rdivmod | reduce
|
|
277
|
+
| reduce_ex | repr | reversed | rfloordiv |
|
|
278
|
+
| rlshift | rmod | rmul | ror | round | rpow
|
|
279
|
+
| rrshift | rshift | rsub | rtruediv | rxor | set
|
|
280
|
+
| setattr | setitem | set_name | setslice
|
|
281
|
+
| setstate | sizeof | str | sub | subclasscheck
|
|
282
|
+
| truediv | trunc | unicode | xor | matmul
|
|
283
|
+
| rmatmul | imatmul | init_subclass | set_name
|
|
284
|
+
| fspath | bytes | prepare | length_hint
|
|
285
|
+
)__
|
|
286
|
+
)\\b
|
|
287
|
+
` }, "magic-names": { patterns: [{ include: "#magic-function-names" }, { include: "#magic-variable-names" }] }, "magic-variable-names": { captures: { 1: { name: "support.variable.magic.python" } }, comment: "magic variables which a class/module may have.", match: `(?x)
|
|
288
|
+
\\b(
|
|
289
|
+
__(?:
|
|
290
|
+
all | annotations | bases | builtins | class
|
|
291
|
+
| closure | code | debug | defaults | dict | doc | file | func
|
|
292
|
+
| globals | kwdefaults | match_args | members | metaclass | methods
|
|
293
|
+
| module | mro | mro_entries | name | qualname | post_init | self
|
|
294
|
+
| signature | slots | subclasses | version | weakref | wrapped
|
|
295
|
+
| classcell | spec | path | package | future | traceback
|
|
296
|
+
)__
|
|
297
|
+
)\\b
|
|
298
|
+
` }, "member-access": { begin: "(\\.)\\s*(?!\\.)", beginCaptures: { 1: { name: "punctuation.separator.period.python" } }, end: `(?x)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
(?<=\\S)(?=\\W) |
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
(^|(?<=\\s))(?=[^\\\\\\w\\s]) |
|
|
305
|
+
$
|
|
306
|
+
`, name: "meta.member.access.python", patterns: [{ include: "#function-call" }, { include: "#member-access-base" }, { include: "#member-access-attribute" }] }, "member-access-attribute": { comment: "Highlight attribute access in otherwise non-specialized cases.", match: `(?x)
|
|
307
|
+
\\b ([[:alpha:]_]\\w*) \\b
|
|
308
|
+
`, name: "meta.attribute.python" }, "member-access-base": { patterns: [{ include: "#magic-names" }, { include: "#illegal-names" }, { include: "#illegal-object-name" }, { include: "#special-names" }, { include: "#line-continuation" }, { include: "#item-access" }] }, "member-access-class": { begin: "(\\.)\\s*(?!\\.)", beginCaptures: { 1: { name: "punctuation.separator.period.python" } }, end: "(?<=\\S)(?=\\W)|$", name: "meta.member.access.python", patterns: [{ include: "#call-wrapper-inheritance" }, { include: "#member-access-base" }, { include: "#inheritance-identifier" }] }, number: { name: "constant.numeric.python", patterns: [{ include: "#number-float" }, { include: "#number-dec" }, { include: "#number-hex" }, { include: "#number-oct" }, { include: "#number-bin" }, { include: "#number-long" }, { match: "\\b[0-9]+\\w+", name: "invalid.illegal.name.python" }] }, "number-bin": { captures: { 1: { name: "storage.type.number.python" } }, match: `(?x)
|
|
309
|
+
(?<![\\w\\.])
|
|
310
|
+
(0[bB]) (_?[01])+
|
|
311
|
+
\\b
|
|
312
|
+
`, name: "constant.numeric.bin.python" }, "number-dec": { captures: { 1: { name: "storage.type.imaginary.number.python" }, 2: { name: "invalid.illegal.dec.python" } }, match: `(?x)
|
|
313
|
+
(?<![\\w\\.])(?:
|
|
314
|
+
[1-9](?: _?[0-9] )*
|
|
315
|
+
|
|
|
316
|
+
0+
|
|
317
|
+
|
|
|
318
|
+
[0-9](?: _?[0-9] )* ([jJ])
|
|
319
|
+
|
|
|
320
|
+
0 ([0-9]+)(?![eE\\.])
|
|
321
|
+
)\\b
|
|
322
|
+
`, name: "constant.numeric.dec.python" }, "number-float": { captures: { 1: { name: "storage.type.imaginary.number.python" } }, match: `(?x)
|
|
323
|
+
(?<! \\w)(?:
|
|
324
|
+
(?:
|
|
325
|
+
\\.[0-9](?: _?[0-9] )*
|
|
326
|
+
|
|
|
327
|
+
[0-9](?: _?[0-9] )* \\. [0-9](?: _?[0-9] )*
|
|
328
|
+
|
|
|
329
|
+
[0-9](?: _?[0-9] )* \\.
|
|
330
|
+
) (?: [eE][+-]?[0-9](?: _?[0-9] )* )?
|
|
331
|
+
|
|
|
332
|
+
[0-9](?: _?[0-9] )* (?: [eE][+-]?[0-9](?: _?[0-9] )* )
|
|
333
|
+
)([jJ])?\\b
|
|
334
|
+
`, name: "constant.numeric.float.python" }, "number-hex": { captures: { 1: { name: "storage.type.number.python" } }, match: `(?x)
|
|
335
|
+
(?<![\\w\\.])
|
|
336
|
+
(0[xX]) (_?[0-9a-fA-F])+
|
|
337
|
+
\\b
|
|
338
|
+
`, name: "constant.numeric.hex.python" }, "number-long": { captures: { 2: { name: "storage.type.number.python" } }, comment: "this is to support python2 syntax for long ints", match: `(?x)
|
|
339
|
+
(?<![\\w\\.])
|
|
340
|
+
([1-9][0-9]* | 0) ([lL])
|
|
341
|
+
\\b
|
|
342
|
+
`, name: "constant.numeric.bin.python" }, "number-oct": { captures: { 1: { name: "storage.type.number.python" } }, match: `(?x)
|
|
343
|
+
(?<![\\w\\.])
|
|
344
|
+
(0[oO]) (_?[0-7])+
|
|
345
|
+
\\b
|
|
346
|
+
`, name: "constant.numeric.oct.python" }, "odd-function-call": { begin: `(?x)
|
|
347
|
+
(?<= \\] | \\) ) \\s*
|
|
348
|
+
(?=\\()
|
|
349
|
+
`, comment: `A bit obscured function call where there may have been an
|
|
350
|
+
arbitrary number of other operations to get the function.
|
|
351
|
+
E.g. "arr[idx](args)"
|
|
352
|
+
`, end: "(\\))", endCaptures: { 1: { name: "punctuation.definition.arguments.end.python" } }, patterns: [{ include: "#function-arguments" }] }, operator: { captures: { 1: { name: "keyword.operator.logical.python" }, 2: { name: "keyword.control.flow.python" }, 3: { name: "keyword.operator.bitwise.python" }, 4: { name: "keyword.operator.arithmetic.python" }, 5: { name: "keyword.operator.comparison.python" }, 6: { name: "keyword.operator.assignment.python" } }, match: `(?x)
|
|
353
|
+
\\b(?<!\\.)
|
|
354
|
+
(?:
|
|
355
|
+
(and | or | not | in | is) (?# 1)
|
|
356
|
+
|
|
|
357
|
+
(for | if | else | await | (?:yield(?:\\s+from)?)) (?# 2)
|
|
358
|
+
)
|
|
359
|
+
(?!\\s*:)\\b
|
|
360
|
+
|
|
361
|
+
| (<< | >> | & | \\| | \\^ | ~) (?# 3)
|
|
362
|
+
|
|
363
|
+
| (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)
|
|
364
|
+
|
|
365
|
+
| (!= | == | >= | <= | < | >) (?# 5)
|
|
366
|
+
|
|
367
|
+
| (:=) (?# 6)
|
|
368
|
+
` }, "parameter-special": { captures: { 1: { name: "variable.parameter.function.language.python" }, 2: { name: "variable.parameter.function.language.special.self.python" }, 3: { name: "variable.parameter.function.language.special.cls.python" }, 4: { name: "punctuation.separator.parameters.python" } }, match: `(?x)
|
|
369
|
+
\\b ((self)|(cls)) \\b \\s*(?:(,)|(?=\\)))
|
|
370
|
+
` }, parameters: { begin: "(\\()", beginCaptures: { 1: { name: "punctuation.definition.parameters.begin.python" } }, end: "(\\))", endCaptures: { 1: { name: "punctuation.definition.parameters.end.python" } }, name: "meta.function.parameters.python", patterns: [{ match: "/", name: "keyword.operator.positional.parameter.python" }, { match: "(\\*\\*|\\*)", name: "keyword.operator.unpacking.parameter.python" }, { include: "#lambda-incomplete" }, { include: "#illegal-names" }, { include: "#illegal-object-name" }, { include: "#parameter-special" }, { captures: { 1: { name: "variable.parameter.function.language.python" }, 2: { name: "punctuation.separator.parameters.python" } }, match: `(?x)
|
|
371
|
+
([[:alpha:]_]\\w*)
|
|
372
|
+
\\s* (?: (,) | (?=[)#\\n=]))
|
|
373
|
+
` }, { include: "#comments" }, { include: "#loose-default" }, { include: "#annotated-parameter" }] }, punctuation: { patterns: [{ match: ":", name: "punctuation.separator.colon.python" }, { match: ",", name: "punctuation.separator.element.python" }] }, regexp: { patterns: [{ include: "#regexp-single-three-line" }, { include: "#regexp-double-three-line" }, { include: "#regexp-single-one-line" }, { include: "#regexp-double-one-line" }] }, "regexp-backreference": { captures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.begin.regexp" }, 2: { name: "entity.name.tag.named.backreference.regexp" }, 3: { name: "support.other.parenthesis.regexp punctuation.parenthesis.backreference.named.end.regexp" } }, match: `(?x)
|
|
374
|
+
(\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))
|
|
375
|
+
`, name: "meta.backreference.named.regexp" }, "regexp-backreference-number": { captures: { 1: { name: "entity.name.tag.backreference.regexp" } }, match: "(\\\\[1-9]\\d?)", name: "meta.backreference.regexp" }, "regexp-base-common": { patterns: [{ match: "\\.", name: "support.other.match.any.regexp" }, { match: "\\^", name: "support.other.match.begin.regexp" }, { match: "\\$", name: "support.other.match.end.regexp" }, { match: "[+*?]\\??", name: "keyword.operator.quantifier.regexp" }, { match: "\\|", name: "keyword.operator.disjunction.regexp" }, { include: "#regexp-escape-sequence" }] }, "regexp-base-expression": { patterns: [{ include: "#regexp-quantifier" }, { include: "#regexp-base-common" }] }, "regexp-charecter-set-escapes": { patterns: [{ match: "\\\\[abfnrtv\\\\]", name: "constant.character.escape.regexp" }, { include: "#regexp-escape-special" }, { match: "\\\\([0-7]{1,3})", name: "constant.character.escape.regexp" }, { include: "#regexp-escape-character" }, { include: "#regexp-escape-unicode" }, { include: "#regexp-escape-catchall" }] }, "regexp-double-one-line": { begin: '\\b(([uU]r)|([bB]r)|(r[bB]?))(")', beginCaptures: { 2: { name: "invalid.deprecated.prefix.python" }, 3: { name: "storage.type.string.python" }, 4: { name: "storage.type.string.python" }, 5: { name: "punctuation.definition.string.begin.python" } }, end: '(")|(?<!\\\\)(\\n)', endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.regexp.quoted.single.python", patterns: [{ include: "#double-one-regexp-expression" }] }, "regexp-double-three-line": { begin: '\\b(([uU]r)|([bB]r)|(r[bB]?))(""")', beginCaptures: { 2: { name: "invalid.deprecated.prefix.python" }, 3: { name: "storage.type.string.python" }, 4: { name: "storage.type.string.python" }, 5: { name: "punctuation.definition.string.begin.python" } }, end: '(""")', endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.regexp.quoted.multi.python", patterns: [{ include: "#double-three-regexp-expression" }] }, "regexp-escape-catchall": { match: "\\\\(.|\\n)", name: "constant.character.escape.regexp" }, "regexp-escape-character": { match: `(?x)
|
|
376
|
+
\\\\ (
|
|
377
|
+
x[0-9A-Fa-f]{2}
|
|
378
|
+
| 0[0-7]{1,2}
|
|
379
|
+
| [0-7]{3}
|
|
380
|
+
)
|
|
381
|
+
`, name: "constant.character.escape.regexp" }, "regexp-escape-sequence": { patterns: [{ include: "#regexp-escape-special" }, { include: "#regexp-escape-character" }, { include: "#regexp-escape-unicode" }, { include: "#regexp-backreference-number" }, { include: "#regexp-escape-catchall" }] }, "regexp-escape-special": { match: "\\\\([AbBdDsSwWZ])", name: "support.other.escape.special.regexp" }, "regexp-escape-unicode": { match: `(?x)
|
|
382
|
+
\\\\ (
|
|
383
|
+
u[0-9A-Fa-f]{4}
|
|
384
|
+
| U[0-9A-Fa-f]{8}
|
|
385
|
+
)
|
|
386
|
+
`, name: "constant.character.unicode.regexp" }, "regexp-flags": { match: "\\(\\?[aiLmsux]+\\)", name: "storage.modifier.flag.regexp" }, "regexp-quantifier": { match: `(?x)
|
|
387
|
+
\\{(
|
|
388
|
+
\\d+ | \\d+,(\\d+)? | ,\\d+
|
|
389
|
+
)\\}
|
|
390
|
+
`, name: "keyword.operator.quantifier.regexp" }, "regexp-single-one-line": { begin: "\\b(([uU]r)|([bB]r)|(r[bB]?))(\\')", beginCaptures: { 2: { name: "invalid.deprecated.prefix.python" }, 3: { name: "storage.type.string.python" }, 4: { name: "storage.type.string.python" }, 5: { name: "punctuation.definition.string.begin.python" } }, end: "(\\')|(?<!\\\\)(\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.regexp.quoted.single.python", patterns: [{ include: "#single-one-regexp-expression" }] }, "regexp-single-three-line": { begin: "\\b(([uU]r)|([bB]r)|(r[bB]?))(\\'\\'\\')", beginCaptures: { 2: { name: "invalid.deprecated.prefix.python" }, 3: { name: "storage.type.string.python" }, 4: { name: "storage.type.string.python" }, 5: { name: "punctuation.definition.string.begin.python" } }, end: "(\\'\\'\\')", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.regexp.quoted.multi.python", patterns: [{ include: "#single-three-regexp-expression" }] }, "return-annotation": { begin: "(->)", beginCaptures: { 1: { name: "punctuation.separator.annotation.result.python" } }, end: "(?=:)", patterns: [{ include: "#expression" }] }, "round-braces": { begin: "\\(", beginCaptures: { 0: { name: "punctuation.parenthesis.begin.python" } }, end: "\\)", endCaptures: { 0: { name: "punctuation.parenthesis.end.python" } }, patterns: [{ include: "#expression" }] }, semicolon: { patterns: [{ match: "\\;$", name: "invalid.deprecated.semicolon.python" }] }, "single-one-regexp-character-set": { patterns: [{ match: `(?x)
|
|
391
|
+
\\[ \\^? \\] (?! .*?\\])
|
|
392
|
+
` }, { begin: "(\\[)(\\^)?(\\])?", beginCaptures: { 1: { name: "punctuation.character.set.begin.regexp constant.other.set.regexp" }, 2: { name: "keyword.operator.negation.regexp" }, 3: { name: "constant.character.set.regexp" } }, end: "(\\]|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "punctuation.character.set.end.regexp constant.other.set.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.character.set.regexp", patterns: [{ include: "#regexp-charecter-set-escapes" }, { match: "[^\\n]", name: "constant.character.set.regexp" }] }] }, "single-one-regexp-comments": { begin: "\\(\\?#", beginCaptures: { 0: { name: "punctuation.comment.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "punctuation.comment.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "comment.regexp", patterns: [{ include: "#codetags" }] }, "single-one-regexp-conditional": { begin: "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)", beginCaptures: { 0: { name: "keyword.operator.conditional.regexp" }, 1: { name: "punctuation.parenthesis.conditional.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-one-regexp-expression" }] }, "single-one-regexp-expression": { patterns: [{ include: "#regexp-base-expression" }, { include: "#single-one-regexp-character-set" }, { include: "#single-one-regexp-comments" }, { include: "#regexp-flags" }, { include: "#single-one-regexp-named-group" }, { include: "#regexp-backreference" }, { include: "#single-one-regexp-lookahead" }, { include: "#single-one-regexp-lookahead-negative" }, { include: "#single-one-regexp-lookbehind" }, { include: "#single-one-regexp-lookbehind-negative" }, { include: "#single-one-regexp-conditional" }, { include: "#single-one-regexp-parentheses-non-capturing" }, { include: "#single-one-regexp-parentheses" }] }, "single-one-regexp-lookahead": { begin: "(\\()\\?=", beginCaptures: { 0: { name: "keyword.operator.lookahead.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-one-regexp-expression" }] }, "single-one-regexp-lookahead-negative": { begin: "(\\()\\?!", beginCaptures: { 0: { name: "keyword.operator.lookahead.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-one-regexp-expression" }] }, "single-one-regexp-lookbehind": { begin: "(\\()\\?<=", beginCaptures: { 0: { name: "keyword.operator.lookbehind.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-one-regexp-expression" }] }, "single-one-regexp-lookbehind-negative": { begin: "(\\()\\?<!", beginCaptures: { 0: { name: "keyword.operator.lookbehind.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-one-regexp-expression" }] }, "single-one-regexp-named-group": { begin: `(?x)
|
|
393
|
+
(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)
|
|
394
|
+
`, beginCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" }, 2: { name: "entity.name.tag.named.group.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.named.regexp", patterns: [{ include: "#single-one-regexp-expression" }] }, "single-one-regexp-parentheses": { begin: "\\(", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-one-regexp-expression" }] }, "single-one-regexp-parentheses-non-capturing": { begin: "\\(\\?:", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp" } }, end: "(\\)|(?=\\'))|((?=(?<!\\\\)\\n))", endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-one-regexp-expression" }] }, "single-three-regexp-character-set": { patterns: [{ match: `(?x)
|
|
395
|
+
\\[ \\^? \\] (?! .*?\\])
|
|
396
|
+
` }, { begin: "(\\[)(\\^)?(\\])?", beginCaptures: { 1: { name: "punctuation.character.set.begin.regexp constant.other.set.regexp" }, 2: { name: "keyword.operator.negation.regexp" }, 3: { name: "constant.character.set.regexp" } }, end: "(\\]|(?=\\'\\'\\'))", endCaptures: { 1: { name: "punctuation.character.set.end.regexp constant.other.set.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.character.set.regexp", patterns: [{ include: "#regexp-charecter-set-escapes" }, { match: "[^\\n]", name: "constant.character.set.regexp" }] }] }, "single-three-regexp-comments": { begin: "\\(\\?#", beginCaptures: { 0: { name: "punctuation.comment.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "punctuation.comment.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "comment.regexp", patterns: [{ include: "#codetags" }] }, "single-three-regexp-conditional": { begin: "(\\()\\?\\((\\w+(?:\\s+[[:alnum:]]+)?|\\d+)\\)", beginCaptures: { 0: { name: "keyword.operator.conditional.regexp" }, 1: { name: "punctuation.parenthesis.conditional.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "keyword.operator.conditional.negative.regexp punctuation.parenthesis.conditional.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-expression": { patterns: [{ include: "#regexp-base-expression" }, { include: "#single-three-regexp-character-set" }, { include: "#single-three-regexp-comments" }, { include: "#regexp-flags" }, { include: "#single-three-regexp-named-group" }, { include: "#regexp-backreference" }, { include: "#single-three-regexp-lookahead" }, { include: "#single-three-regexp-lookahead-negative" }, { include: "#single-three-regexp-lookbehind" }, { include: "#single-three-regexp-lookbehind-negative" }, { include: "#single-three-regexp-conditional" }, { include: "#single-three-regexp-parentheses-non-capturing" }, { include: "#single-three-regexp-parentheses" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-lookahead": { begin: "(\\()\\?=", beginCaptures: { 0: { name: "keyword.operator.lookahead.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "keyword.operator.lookahead.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-lookahead-negative": { begin: "(\\()\\?!", beginCaptures: { 0: { name: "keyword.operator.lookahead.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookahead.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "keyword.operator.lookahead.negative.regexp punctuation.parenthesis.lookahead.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-lookbehind": { begin: "(\\()\\?<=", beginCaptures: { 0: { name: "keyword.operator.lookbehind.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "keyword.operator.lookbehind.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-lookbehind-negative": { begin: "(\\()\\?<!", beginCaptures: { 0: { name: "keyword.operator.lookbehind.negative.regexp" }, 1: { name: "punctuation.parenthesis.lookbehind.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "keyword.operator.lookbehind.negative.regexp punctuation.parenthesis.lookbehind.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-named-group": { begin: `(?x)
|
|
397
|
+
(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)
|
|
398
|
+
`, beginCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.begin.regexp" }, 2: { name: "entity.name.tag.named.group.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.named.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, name: "meta.named.regexp", patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-parentheses": { begin: "\\(", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "single-three-regexp-parentheses-non-capturing": { begin: "\\(\\?:", beginCaptures: { 0: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.begin.regexp" } }, end: "(\\)|(?=\\'\\'\\'))", endCaptures: { 1: { name: "support.other.parenthesis.regexp punctuation.parenthesis.non-capturing.end.regexp" }, 2: { name: "invalid.illegal.newline.python" } }, patterns: [{ include: "#single-three-regexp-expression" }, { include: "#comments-string-single-three" }] }, "special-names": { match: `(?x)
|
|
399
|
+
\\b
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
(
|
|
406
|
+
_* [[:upper:]] [_\\d]* [[:upper:]]
|
|
407
|
+
)
|
|
408
|
+
[[:upper:]\\d]* (_\\w*)?
|
|
409
|
+
\\b
|
|
410
|
+
`, name: "constant.other.caps.python" }, "special-variables": { captures: { 1: { name: "variable.language.special.self.python" }, 2: { name: "variable.language.special.cls.python" } }, match: `(?x)
|
|
411
|
+
\\b (?<!\\.) (?:
|
|
412
|
+
(self) | (cls)
|
|
413
|
+
)\\b
|
|
414
|
+
` }, statement: { patterns: [{ include: "#import" }, { include: "#class-declaration" }, { include: "#function-declaration" }, { include: "#generator" }, { include: "#statement-keyword" }, { include: "#assignment-operator" }, { include: "#decorator" }, { include: "#docstring-statement" }, { include: "#semicolon" }] }, "statement-keyword": { patterns: [{ match: "\\b((async\\s+)?\\s*def)\\b", name: "storage.type.function.python" }, { comment: `if \`as\` is eventually followed by \`:\` or line continuation
|
|
415
|
+
it's probably control flow like:
|
|
416
|
+
with foo as bar, \\
|
|
417
|
+
Foo as Bar:
|
|
418
|
+
try:
|
|
419
|
+
do_stuff()
|
|
420
|
+
except Exception as e:
|
|
421
|
+
pass
|
|
422
|
+
`, match: "\\b(?<!\\.)as\\b(?=.*[:\\\\])", name: "keyword.control.flow.python" }, { comment: "other legal use of `as` is in an import", match: "\\b(?<!\\.)as\\b", name: "keyword.control.import.python" }, { match: `(?x)
|
|
423
|
+
\\b(?<!\\.)(
|
|
424
|
+
async | continue | del | assert | break | finally | for
|
|
425
|
+
| from | elif | else | if | except | pass | raise
|
|
426
|
+
| return | try | while | with
|
|
427
|
+
)\\b
|
|
428
|
+
`, name: "keyword.control.flow.python" }, { match: `(?x)
|
|
429
|
+
\\b(?<!\\.)(
|
|
430
|
+
global | nonlocal
|
|
431
|
+
)\\b
|
|
432
|
+
`, name: "storage.modifier.declaration.python" }, { match: "\\b(?<!\\.)(class)\\b", name: "storage.type.class.python" }, { captures: { 1: { name: "keyword.control.flow.python" } }, match: `(?x)
|
|
433
|
+
^\\s*(
|
|
434
|
+
case | match
|
|
435
|
+
)(?=\\s*([-+\\w\\d(\\[{'":#]|$))\\b
|
|
436
|
+
` }] }, string: { patterns: [{ include: "#string-quoted-multi-line" }, { include: "#string-quoted-single-line" }, { include: "#string-bin-quoted-multi-line" }, { include: "#string-bin-quoted-single-line" }, { include: "#string-raw-quoted-multi-line" }, { include: "#string-raw-quoted-single-line" }, { include: "#string-raw-bin-quoted-multi-line" }, { include: "#string-raw-bin-quoted-single-line" }, { include: "#fstring-fnorm-quoted-multi-line" }, { include: "#fstring-fnorm-quoted-single-line" }, { include: "#fstring-normf-quoted-multi-line" }, { include: "#fstring-normf-quoted-single-line" }, { include: "#fstring-raw-quoted-multi-line" }, { include: "#fstring-raw-quoted-single-line" }] }, "string-bin-quoted-multi-line": { begin: `(\\b[bB])('''|""")`, beginCaptures: { 1: { name: "storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python" } }, end: "(\\2)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.binary.multi.python", patterns: [{ include: "#string-entity" }] }, "string-bin-quoted-single-line": { begin: `(\\b[bB])((['"]))`, beginCaptures: { 1: { name: "storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python" } }, end: "(\\2)|((?<!\\\\)\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.binary.single.python", patterns: [{ include: "#string-entity" }] }, "string-brace-formatting": { patterns: [{ captures: { 1: { name: "constant.character.format.placeholder.other.python" }, 3: { name: "storage.type.format.python" }, 4: { name: "storage.type.format.python" } }, match: `(?x)
|
|
437
|
+
(
|
|
438
|
+
{{ | }}
|
|
439
|
+
| (?:
|
|
440
|
+
{
|
|
441
|
+
\\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])*
|
|
442
|
+
(![rsa])?
|
|
443
|
+
( : \\w? [<>=^]? [-+ ]? \\#?
|
|
444
|
+
\\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?
|
|
445
|
+
})
|
|
446
|
+
)
|
|
447
|
+
`, name: "meta.format.brace.python" }, { captures: { 1: { name: "constant.character.format.placeholder.other.python" }, 3: { name: "storage.type.format.python" }, 4: { name: "storage.type.format.python" } }, match: `(?x)
|
|
448
|
+
(
|
|
449
|
+
{
|
|
450
|
+
\\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])*
|
|
451
|
+
(![rsa])?
|
|
452
|
+
(:)
|
|
453
|
+
[^'"{}\\n]* (?:
|
|
454
|
+
\\{ [^'"}\\n]*? \\} [^'"{}\\n]*
|
|
455
|
+
)*
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
`, name: "meta.format.brace.python" }] }, "string-consume-escape": { match: `\\\\['"\\n\\\\]` }, "string-entity": { patterns: [{ include: "#escape-sequence" }, { include: "#string-line-continuation" }, { include: "#string-formatting" }] }, "string-formatting": { captures: { 1: { name: "constant.character.format.placeholder.other.python" } }, match: `(?x)
|
|
459
|
+
(
|
|
460
|
+
% (\\([\\w\\s]*\\))?
|
|
461
|
+
[-+#0 ]*
|
|
462
|
+
(\\d+|\\*)? (\\.(\\d+|\\*))?
|
|
463
|
+
([hlL])?
|
|
464
|
+
[diouxXeEfFgGcrsab%]
|
|
465
|
+
)
|
|
466
|
+
`, name: "meta.format.percent.python" }, "string-line-continuation": { match: "\\\\$", name: "constant.language.python" }, "string-multi-bad-brace1-formatting-raw": { begin: `(?x)
|
|
467
|
+
(?= \\{%
|
|
468
|
+
( .*? (?!'''|""") )
|
|
469
|
+
%\\}
|
|
470
|
+
)
|
|
471
|
+
`, comment: "template using {% ... %}", end: `(?='''|""")`, patterns: [{ include: "#string-consume-escape" }] }, "string-multi-bad-brace1-formatting-unicode": { begin: `(?x)
|
|
472
|
+
(?= \\{%
|
|
473
|
+
( .*? (?!'''|""") )
|
|
474
|
+
%\\}
|
|
475
|
+
)
|
|
476
|
+
`, comment: "template using {% ... %}", end: `(?='''|""")`, patterns: [{ include: "#escape-sequence-unicode" }, { include: "#escape-sequence" }, { include: "#string-line-continuation" }] }, "string-multi-bad-brace2-formatting-raw": { begin: `(?x)
|
|
477
|
+
(?!\\{\\{)
|
|
478
|
+
(?= \\{ (
|
|
479
|
+
\\w*? (?!'''|""") [^!:\\.\\[}\\w]
|
|
480
|
+
)
|
|
481
|
+
.*?(?!'''|""")
|
|
482
|
+
\\}
|
|
483
|
+
)
|
|
484
|
+
`, comment: "odd format or format-like syntax", end: `(?='''|""")`, patterns: [{ include: "#string-consume-escape" }, { include: "#string-formatting" }] }, "string-multi-bad-brace2-formatting-unicode": { begin: `(?x)
|
|
485
|
+
(?!\\{\\{)
|
|
486
|
+
(?= \\{ (
|
|
487
|
+
\\w*? (?!'''|""") [^!:\\.\\[}\\w]
|
|
488
|
+
)
|
|
489
|
+
.*?(?!'''|""")
|
|
490
|
+
\\}
|
|
491
|
+
)
|
|
492
|
+
`, comment: "odd format or format-like syntax", end: `(?='''|""")`, patterns: [{ include: "#escape-sequence-unicode" }, { include: "#string-entity" }] }, "string-quoted-multi-line": { begin: `(?:\\b([rR])(?=[uU]))?([uU])?('''|""")`, beginCaptures: { 1: { name: "invalid.illegal.prefix.python" }, 2: { name: "storage.type.string.python" }, 3: { name: "punctuation.definition.string.begin.python" } }, end: "(\\3)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.multi.python", patterns: [{ include: "#string-multi-bad-brace1-formatting-unicode" }, { include: "#string-multi-bad-brace2-formatting-unicode" }, { include: "#string-unicode-guts" }] }, "string-quoted-single-line": { begin: `(?:\\b([rR])(?=[uU]))?([uU])?((['"]))`, beginCaptures: { 1: { name: "invalid.illegal.prefix.python" }, 2: { name: "storage.type.string.python" }, 3: { name: "punctuation.definition.string.begin.python" } }, end: "(\\3)|((?<!\\\\)\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.single.python", patterns: [{ include: "#string-single-bad-brace1-formatting-unicode" }, { include: "#string-single-bad-brace2-formatting-unicode" }, { include: "#string-unicode-guts" }] }, "string-raw-bin-guts": { patterns: [{ include: "#string-consume-escape" }, { include: "#string-formatting" }] }, "string-raw-bin-quoted-multi-line": { begin: `(\\b(?:R[bB]|[bB]R))('''|""")`, beginCaptures: { 1: { name: "storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python" } }, end: "(\\2)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.raw.binary.multi.python", patterns: [{ include: "#string-raw-bin-guts" }] }, "string-raw-bin-quoted-single-line": { begin: `(\\b(?:R[bB]|[bB]R))((['"]))`, beginCaptures: { 1: { name: "storage.type.string.python" }, 2: { name: "punctuation.definition.string.begin.python" } }, end: "(\\2)|((?<!\\\\)\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.raw.binary.single.python", patterns: [{ include: "#string-raw-bin-guts" }] }, "string-raw-guts": { patterns: [{ include: "#string-consume-escape" }, { include: "#string-formatting" }, { include: "#string-brace-formatting" }] }, "string-raw-quoted-multi-line": { begin: `\\b(([uU]R)|(R))('''|""")`, beginCaptures: { 2: { name: "invalid.deprecated.prefix.python" }, 3: { name: "storage.type.string.python" }, 4: { name: "punctuation.definition.string.begin.python" } }, end: "(\\4)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.raw.multi.python", patterns: [{ include: "#string-multi-bad-brace1-formatting-raw" }, { include: "#string-multi-bad-brace2-formatting-raw" }, { include: "#string-raw-guts" }] }, "string-raw-quoted-single-line": { begin: `\\b(([uU]R)|(R))((['"]))`, beginCaptures: { 2: { name: "invalid.deprecated.prefix.python" }, 3: { name: "storage.type.string.python" }, 4: { name: "punctuation.definition.string.begin.python" } }, end: "(\\4)|((?<!\\\\)\\n)", endCaptures: { 1: { name: "punctuation.definition.string.end.python" }, 2: { name: "invalid.illegal.newline.python" } }, name: "string.quoted.raw.single.python", patterns: [{ include: "#string-single-bad-brace1-formatting-raw" }, { include: "#string-single-bad-brace2-formatting-raw" }, { include: "#string-raw-guts" }] }, "string-single-bad-brace1-formatting-raw": { begin: `(?x)
|
|
493
|
+
(?= \\{%
|
|
494
|
+
( .*? (?!(['"])|((?<!\\\\)\\n)) )
|
|
495
|
+
%\\}
|
|
496
|
+
)
|
|
497
|
+
`, comment: "template using {% ... %}", end: `(?=(['"])|((?<!\\\\)\\n))`, patterns: [{ include: "#string-consume-escape" }] }, "string-single-bad-brace1-formatting-unicode": { begin: `(?x)
|
|
498
|
+
(?= \\{%
|
|
499
|
+
( .*? (?!(['"])|((?<!\\\\)\\n)) )
|
|
500
|
+
%\\}
|
|
501
|
+
)
|
|
502
|
+
`, comment: "template using {% ... %}", end: `(?=(['"])|((?<!\\\\)\\n))`, patterns: [{ include: "#escape-sequence-unicode" }, { include: "#escape-sequence" }, { include: "#string-line-continuation" }] }, "string-single-bad-brace2-formatting-raw": { begin: `(?x)
|
|
503
|
+
(?!\\{\\{)
|
|
504
|
+
(?= \\{ (
|
|
505
|
+
\\w*? (?!(['"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]
|
|
506
|
+
)
|
|
507
|
+
.*?(?!(['"])|((?<!\\\\)\\n))
|
|
508
|
+
\\}
|
|
509
|
+
)
|
|
510
|
+
`, comment: "odd format or format-like syntax", end: `(?=(['"])|((?<!\\\\)\\n))`, patterns: [{ include: "#string-consume-escape" }, { include: "#string-formatting" }] }, "string-single-bad-brace2-formatting-unicode": { begin: `(?x)
|
|
511
|
+
(?!\\{\\{)
|
|
512
|
+
(?= \\{ (
|
|
513
|
+
\\w*? (?!(['"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]
|
|
514
|
+
)
|
|
515
|
+
.*?(?!(['"])|((?<!\\\\)\\n))
|
|
516
|
+
\\}
|
|
517
|
+
)
|
|
518
|
+
`, comment: "odd format or format-like syntax", end: `(?=(['"])|((?<!\\\\)\\n))`, patterns: [{ include: "#escape-sequence-unicode" }, { include: "#string-entity" }] }, "string-unicode-guts": { patterns: [{ include: "#escape-sequence-unicode" }, { include: "#string-entity" }, { include: "#string-brace-formatting" }] } }, scopeName: "source.python", aliases: ["py"] });
|
|
519
|
+
var n = [
|
|
520
|
+
e
|
|
521
|
+
];
|
|
522
|
+
export {
|
|
523
|
+
n as default
|
|
524
|
+
};
|