site/node_modules/shiki/dist/langs/python.mjs

162 lines
80 KiB
JavaScript
Raw Permalink Normal View History

2024-10-14 06:09:33 +00:00
const lang = Object.freeze({ "displayName": "Python", "name": "python", "patterns": [{ "include": "#statement" }, { "include": "#expression" }], "repository": { "annotated-parameter": { "begin": "(?x)\n\\b\n([[:alpha:]_]\\w*) \\s* (:)\n", "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)\n<<= | >>= | //= | \\*\\*=\n| \\+= | -= | /= | @=\n| \\*= | %= | ~= | \\^= | &= | \\|=\n| =(?!=)\n", "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(\n(\nArithmetic | 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|\nSystemExit | Stop(Async)?Iteration\n| KeyboardInterrupt\n| GeneratorExit | (Base)?Exception\n)\\b\n", "name": "support.type.exception.python" }, "builtin-functions": { "patterns": [{ "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", "name": "support.function.builtin.python" }, { "match": "(?x)\n(?<!\\.) \\b(\nfile | reduce | intern | raw_input | unicode | cmp | basestring\n| execfile | long | xrange\n)\\b\n", "name": "variable.legacy.builtin.python" }] }, "builtin-possible-callables": { "patterns": [{ "include": "#builtin-callables" }, { "include": "#magic-names" }] }, "builtin-types": { "match": "(?x)\n(?<!\\.) \\b(\nbool | 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,\nand is special enough to be highlighted differently from\nother built-ins)\n| super\n)\\b\n", "name": "support.type.python" }, "call-wrapper-inheritance": { "begin": "(?x)\n\\b(?=\n([[:alpha:]_]\\w*) \\s* (\\()\n)\n", "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)\n\\s*(class)\\s+\n(?=\n[[:alpha:]_]\\w* \\s* (:|\\()\n)\n", "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": "#c
\\\\ (
x[0-9A-Fa-f]{2}
| [0-7]{1,3}
| [\\\\"'abfnrtv]
)
`, "name": "constant.character.escape.python" }, "escape-sequence-unicode": { "patterns": [{ "match": "(?x)\n\\\\ (\nu[0-9A-Fa-f]{4}\n| U[0-9A-Fa-f]{8}\n| N\\{[\\w\\s]+?\\}\n)\n", "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)\n\\{\\{(\n\\d+ | \\d+,(\\d+)? | ,\\d+\n)\\}\\}\n", "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.c
(.+?)
(
(?# .* and .*? in multi-line match need special handling of
newlines otherwise SublimeText and Atom will match slightly
differently.
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\\n?)
|
(?=[\\\\\\}\\{]|'''|""")
)
(?# due to how multiline regexps are matched we need a special case
for matching a newline character)
| \\n
`, "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)
(.+?)
(
(?# .* and .*? in multi-line match need special handling of
newlines otherwise SublimeText and Atom will match slightly
differently.
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\\n?)
|
(?=[\\\\\\}\\{]|'''|""")
)
(?# due to how multiline regexps are matched we need a special case
for matching a newline character)
| \\n
`, "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)
(.+?)
(
(?# .* and .*? in multi-line match need special handling of
newlines otherwise SublimeText and Atom will match slightly
differently.
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\\n?)
|
(?=[\\\\\\}\\{]|(['"])|((?<!\\\\)\\n))
)
(?# due to how multiline regexps are matched we need a special case
for matching a newline character)
| \\n
`, "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)\n(\\})|(?=\\n)\n", "endCaptures": { "1": { "name": "constant.character.format.placeholder.other.python" } }, "patterns": [{ "include": "#fstring-terminator-single" }, { "include": "#f-expression" }] }, "fstring-single-core": { "match": `(?x)
(.+?)
(
(?# .* and .*? in multi-line match need special handling of
newlines otherwise SublimeText and Atom will match slightly
differently.
The guard for newlines has to be separate from the
lookahead because of special $ matching rule.)
($\\n?)
|
(?=[\\\\\\}\\{]|(['"])|((?<!\\\\)\\n))
)
(?# due to how multiline regexps are matched we need a special case
for matching a newline character)
| \\n
`, "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)\n( (?: =?) (?: ![rsa])? )\n( : \\w? [<>=^]? [-+ ]? \\#?\n\\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n" }, { "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)\n( (?: =?) (?: ![rsa])? )\n( : \\w? [<>=^]? [-+ ]? \\#?\n\\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )(?=})\n" }, { "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)\n(?:(?<=[,(])|^) \\s* (\\*{1,2})\n" }, { "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)\n\\b(?=\n([[:alpha:]_]\\w*) \\s* (\\()\n)\n", "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)\n\\s*\n(?:\\b(async)
(?=^\\s*$)
|
(?! (\\s* [rR]? (\\'\\'\\'|\\"\\"\\"|\\'|\\"))
|
(\\G $) (?# '\\G' is necessary for ST)
)
`, "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\nindirectly through syntactic constructs\n", "match": "(?x)\n\\b(\n__(?:\nabs | 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" }, "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)\n\\b(\n__(?:\nall | 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" }, "member-access": { "begin": "(\\.)\\s*(?!\\.)", "beginCaptures": { "1": { "name": "punctuation.separator.period.python" } }, "end": "(?x)\n\n\n(?<=\\S)(?=\\W) |\n\n\n(^|(?<=\\s))(?=[^\\\\\\w\\s]) |\n$\n", "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)\n\\b ([[:alpha:]_]\\w*) \\b\n", "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
^\\s*(
case | match
)(?=\\s*([-+\\w\\d(\\[{'":#]|$))\\b
` }] }, "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)
(
{{ | }}
| (?:
{
\\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])*
(![rsa])?
( : \\w? [<>=^]? [-+ ]? \\#?
\\d* ,? (\\.\\d+)? [bcdeEfFgGnosxX%]? )?
})
)
`, "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)
(
{
\\w* (\\.[[:alpha:]_]\\w* | \\[[^\\]'"]+\\])*
(![rsa])?
(:)
[^'"{}\\n]* (?:
\\{ [^'"}\\n]*? \\} [^'"{}\\n]*
)*
}
)
`, "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)\n(\n% (\\([\\w\\s]*\\))?\n[-+#0 ]*\n(\\d+|\\*)? (\\.(\\d+|\\*))?\n([hlL])?\n[diouxXeEfFgGcrsab%]\n)\n", "name": "meta.format.percent.python" }, "string-line-continuation": { "match": "\\\\$", "name": "constant.language.python" }, "string-multi-bad-brace1-formatting-raw": { "begin": `(?x)
(?= \\{%
( .*? (?!'''|""") )
%\\}
)
`, "comment": "template using {% ... %}", "end": `(?='''|""")`, "patterns": [{ "include": "#string-consume-escape" }] }, "string-multi-bad-brace1-formatting-unicode": { "begin": `(?x)
(?= \\{%
( .*? (?!'''|""") )
%\\}
)
`, "comment": "template using {% ... %}", "end": `(?='''|""")`, "patterns": [{ "include": "#escape-sequence-unicode" }, { "include": "#escape-sequence" }, { "include": "#string-line-continuation" }] }, "string-multi-bad-brace2-formatting-raw": { "begin": `(?x)
(?!\\{\\{)
(?= \\{ (
\\w*? (?!'''|""") [^!:\\.\\[}\\w]
)
.*?(?!'''|""")
\\}
)
`, "comment": "odd format or format-like syntax", "end": `(?='''|""")`, "patterns": [{ "include": "#string-consume-escape" }, { "include": "#string-formatting" }] }, "string-multi-bad-brace2-formatting-unicode": { "begin": `(?x)
(?!\\{\\{)
(?= \\{ (
\\w*? (?!'''|""") [^!:\\.\\[}\\w]
)
.*?(?!'''|""")
\\}
)
`, "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)
(?= \\{%
( .*? (?!(['"])|((?<!\\\\)\\n)) )
%\\}
)
`, "comment": "template using {% ... %}", "end": `(?=(['"])|((?<!\\\\)\\n))`, "patterns": [{ "include": "#string-consume-escape" }] }, "string-single-bad-brace1-formatting-unicode": { "begin": `(?x)
(?= \\{%
( .*? (?!(['"])|((?<!\\\\)\\n)) )
%\\}
)
`, "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)
(?!\\{\\{)
(?= \\{ (
\\w*? (?!(['"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]
)
.*?(?!(['"])|((?<!\\\\)\\n))
\\}
)
`, "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)
(?!\\{\\{)
(?= \\{ (
\\w*? (?!(['"])|((?<!\\\\)\\n)) [^!:\\.\\[}\\w]
)
.*?(?!(['"])|((?<!\\\\)\\n))
\\}
)
`, "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"] });
var python = [
lang
];
export { python as default };