shiki 1.2.0 → 1.2.2

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.
@@ -4,7 +4,7 @@ x[0-9A-Fa-f]{2}
4
4
  | [0-7]{1,3}
5
5
  | [\\\\"'abfnrtv]
6
6
  )
7
- `, "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.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)\n(\\})\n", "endCaptures": { "1": { "name": "constant.character.format.placeholder.other.python" } }, "patterns": [{ "include": "#fstring-terminator-multi" }, { "include": "#f-expression" }] }, "fstring-multi-core": { "match": `(?x)
7
+ `, "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": "#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.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)\n(\\})\n", "endCaptures": { "1": { "name": "constant.character.format.placeholder.other.python" } }, "patterns": [{ "include": "#fstring-terminator-multi" }, { "include": "#f-expression" }] }, "fstring-multi-core": { "match": `(?x)
8
8
  (.+?)
9
9
  (
10
10
  (?# .* and .*? in multi-line match need special handling of
@@ -68,14 +68,14 @@ lookahead because of special $ matching rule.)
68
68
  (?# due to how multiline regexps are matched we need a special case
69
69
  for matching a newline character)
70
70
  | \\n
71
- `, "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+)? \\b(def|fn)\\s+\n(?=\n[[:alpha:]_][[:word:]]* \\s* [\\(\\[]\n)\n", "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": "#raises-modifier" }, { "include": "#function-def-name" }, { "include": "#parameters" }, { "include": "#meta_parameters" }, { "include": "#line-continuation" }, { "include": "#return-annotation" }] }, "function-def-name": { "patterns": [{ "include": "#illegal-object-name" }, { "include": "#builtin-possible-callables" }, { "match": "(?x)\n\\b ([[:alpha:]_]\\w*) \\b\n", "name": "entity.name.function.python" }] }, "function-name": { "patterns": [{ "include": "#builtin-possible-callables" }, { "comment": "Some color schemas support meta.function-call.generic scope", "match": "(?x)\n\\b ([[:alpha:]_]\\w*) \\b\n", "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\ncorrectly identify the "in" as a control flow keyword.\n', "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)\n\\b(?:\n(\nand | assert | async | await | break | class | struct | trait | continue | def\n| fn\n| del | elif | else | except | finally | for | from | global\n| if | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=])\n| nonlocal | not | or | pass | raise | return | try | while | with\n| yield\n) | (\nas | import\n)\n)\\b\n" }, "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)\n\\b ([[:alpha:]_]\\w*) \\b\n" }, "inheritance-name": { "patterns": [{ "include": "#lambda-incomplete" }, { "include": "#builtin-possible-callables" }, { "include": "#inheritance-identifier" }] }, "item-access": { "patterns": [{ "begin": "(?x)\n\\b(?=\n[[:alpha:]_]\\w* \\s* \\[\n)\n", "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)\n\\b ([[:alpha:]_]\\w*) \\b\n", "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)\n\\b (lambda) \\b\n", "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": "\\b(owned|borrowed|inout)\\b", "name": "storage.modifier" }, { "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)\n\\b\n([[:alpha:]_]\\w*) \\s* (=)\n", "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)
71
+ `, "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+)? \\b(def|fn)\\s+\n(?=\n[[:alpha:]_][[:word:]]* \\s* [\\(\\[]\n)\n", "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-modifier" }, { "include": "#function-def-name" }, { "include": "#parameters" }, { "include": "#meta_parameters" }, { "include": "#line-continuation" }, { "include": "#return-annotation" }] }, "function-def-name": { "patterns": [{ "include": "#illegal-object-name" }, { "include": "#builtin-possible-callables" }, { "match": "(?x)\n\\b ([[:alpha:]_]\\w*) \\b\n", "name": "entity.name.function.python" }] }, "function-modifier": { "match": "(raises|capturing)", "name": "storage.modifier" }, "function-name": { "patterns": [{ "include": "#builtin-possible-callables" }, { "comment": "Some color schemas support meta.function-call.generic scope", "match": "(?x)\n\\b ([[:alpha:]_]\\w*) \\b\n", "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\ncorrectly identify the "in" as a control flow keyword.\n', "end": "\\bin\\b", "endCaptures": { "0": { "name": "keyword.control.flow.python" } }, "patterns": [{ "include": "#expression" }] }, "illegal-names": { "captures": { "1": { "name": "keyword.control.flow.python" }, "2": { "name": "storage.type.function.python" }, "3": { "name": "keyword.control.import.python" } }, "match": "(?x)\n\\b(?:\n(\nand | assert | async | await | break | class | struct | trait | continue | del | elif | else | except | finally | for | from | global\n| if | in | is | (?<=\\.)lambda | lambda(?=\\s*[\\.=])\n| nonlocal | not | or | pass | raise | return | try | while | with\n| yield\n) | (def | fn | capturing | raises) | (\nas | import\n)\n)\\b\n" }, "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)\n\\b ([[:alpha:]_]\\w*) \\b\n" }, "inheritance-name": { "patterns": [{ "include": "#lambda-incomplete" }, { "include": "#builtin-possible-callables" }, { "include": "#inheritance-identifier" }] }, "item-access": { "patterns": [{ "begin": "(?x)\n\\b(?=\n[[:alpha:]_]\\w* \\s* \\[\n)\n", "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)\n\\b ([[:alpha:]_]\\w*) \\b\n", "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)\n\\b (lambda) \\b\n", "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": "\\b(owned|borrowed|inout)\\b", "name": "storage.modifier" }, { "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": "#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)\n\\b\n([[:alpha:]_]\\w*) \\s* (=)\n", "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)
72
72
  (?=^\\s*$)
73
73
  |
74
74
  (?! (\\s* [rR]? (\\'\\'\\'|\\"\\"\\"|\\'|\\"))
75
75
  |
76
76
  (\\G $) (?# '\\G' is necessary for ST)
77
77
  )
78
- `, "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| struct\n| trait\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" }] }, "meta_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": [{ "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" }] }, { "include": "#comments" }] }, "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)\n(?<![\\w\\.])\n(0[bB]) (_?[01])+\n\\b\n", "name": "constant.numeric.bin.python" }, "number-dec": { "captures": { "1": { "name": "storage.type.imaginary.number.python" }, "2": { "name": "invalid.illegal.dec.python" } }, "match": "(?x)\n(?<![\\w\\.])(?:\n[1-9](?: _?[0-9] )*\n|\n0+\n|\n[0-9](?: _?[0-9] )* ([jJ])\n|\n0 ([0-9]+)(?![eE\\.])\n)\\b\n", "name": "constant.numeric.dec.python" }, "number-float": { "captures": { "1": { "name": "storage.type.imaginary.number.python" } }, "match": "(?x)\n(?<! \\w)(?:\n(?:\n\\.[0-9](?: _?[0-9] )*\n|\n[0-9](?: _?[0-9] )* \\. [0-9](?: _?[0-9] )*\n|\n[0-9](?: _?[0-9] )* \\.\n) (?: [eE][+-]?[0-9](?: _?[0-9] )* )?\n|\n[0-9](?: _?[0-9] )* (?: [eE][+-]?[0-9](?: _?[0-9] )* )\n)([jJ])?\\b\n", "name": "constant.numeric.float.python" }, "number-hex": { "captures": { "1": { "name": "storage.type.number.python" } }, "match": "(?x)\n(?<![\\w\\.])\n(0[xX]) (_?[0-9a-fA-F])+\n\\b\n", "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)\n(?<![\\w\\.])\n([1-9][0-9]* | 0) ([lL])\n\\b\n", "name": "constant.numeric.bin.python" }, "number-oct": { "captures": { "1": { "name": "storage.type.number.python" } }, "match": "(?x)\n(?<![\\w\\.])\n(0[oO]) (_?[0-7])+\n\\b\n", "name": "constant.numeric.oct.python" }, "odd-function-call": { "begin": "(?x)\n(?<= \\] | \\) ) \\s*\n(?=\\()\n", "comment": 'A bit obscured function call where there may have been an\narbitrary number of other operations to get the function.\nE.g. "arr[idx](args)"\n', "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)\n\\b(?<!\\.)\n(?:\n(and | or | not | in | is) (?# 1)\n|\n(for | if | else | await | (?:yield(?:\\s+from)?)) (?# 2)\n)\n(?!\\s*:)\\b\n\n| (<< | >> | & | \\| | \\^ | ~) (?# 3)\n\n| (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)\n\n| (!= | == | >= | <= | < | >) (?# 5)\n\n| (:=) (?# 6)\n" }, "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)\n\\b ((self)|(cls)) \\b \\s*(?:(,)|(?=\\)))\n" }, "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": "\\b(owned|borrowed|inout)\\b", "name": "storage.modifier" }, { "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)\n([[:alpha:]_]\\w*)\n\\s* (?: (,) | (?=[)#\\n=]))\n" }, { "include": "#comments" }, { "include": "#loose-default" }, { "include": "#annotated-parameter" }] }, "punctuation": { "patterns": [{ "match": ":", "name": "punctuation.separator.colon.python" }, { "match": ",", "name": "punctuation.separator.element.python" }] }, "raises-modifier": { "match": "(raises)", "name": "storage.modifier" }, "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)\n(\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))\n", "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)\n\\\\ (\nx[0-9A-Fa-f]{2}\n| 0[0-7]{1,2}\n| [0-7]{3}\n)\n", "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)\n\\\\ (\nu[0-9A-Fa-f]{4}\n| U[0-9A-Fa-f]{8}\n)\n", "name": "constant.character.unicode.regexp" }, "regexp-flags": { "match": "\\(\\?[aiLmsux]+\\)", "name": "storage.modifier.flag.regexp" }, "regexp-quantifier": { "match": "(?x)\n\\{(\n\\d+ | \\d+,(\\d+)? | ,\\d+\n)\\}\n", "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)\n\\[ \\^? \\] (?! .*?\\])\n" }, { "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)\n(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n", "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)\n\\[ \\^? \\] (?! .*?\\])\n" }, { "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)\n(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n", "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)\n\\b\n\n\n\n\n\n(\n_* [[:upper:]] [_\\d]* [[:upper:]]\n)\n[[:upper:]\\d]* (_\\w*)?\n\\b\n", "name": "constant.other.caps.python" }, "special-variables": { "captures": { "1": { "name": "variable.language.special.self.python" }, "2": { "name": "variable.language.special.cls.python" } }, "match": "(?x)\n\\b (?<!\\.) (?:\n(self) | (cls)\n)\\b\n" }, "statement": { "patterns": [{ "include": "#import" }, { "include": "#class-declaration" }, { "include": "#function-declaration" }, { "include": "#generator" }, { "include": "#statement-keyword" }, { "include": "#assignment-operator" }, { "include": "#decorator" }, { "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\nit's probably control flow like:\n with foo as bar, \\\n Foo as Bar:\n try:\n do_stuff()\n except Exception as e:\n pass\n", "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)\n\\b(?<!\\.)(\nasync | continue | del | assert | break | finally | for\n| from | elif | else | if | except | pass | raise\n| return | try | while | with\n)\\b\n", "name": "keyword.control.flow.python" }, { "match": "(?x)\n\\b(?<!\\.)(\nglobal | nonlocal\n)\\b\n", "name": "storage.modifier.declaration.python" }, { "match": "\\b(?<!\\.)(class|struct|trait)\\b", "name": "storage.type.class.python" }, { "captures": { "1": { "name": "keyword.control.flow.python" } }, "match": `(?x)
78
+ `, "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| struct\n| trait\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" }] }, "meta_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": [{ "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" }] }, { "include": "#comments" }] }, "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)\n(?<![\\w\\.])\n(0[bB]) (_?[01])+\n\\b\n", "name": "constant.numeric.bin.python" }, "number-dec": { "captures": { "1": { "name": "storage.type.imaginary.number.python" }, "2": { "name": "invalid.illegal.dec.python" } }, "match": "(?x)\n(?<![\\w\\.])(?:\n[1-9](?: _?[0-9] )*\n|\n0+\n|\n[0-9](?: _?[0-9] )* ([jJ])\n|\n0 ([0-9]+)(?![eE\\.])\n)\\b\n", "name": "constant.numeric.dec.python" }, "number-float": { "captures": { "1": { "name": "storage.type.imaginary.number.python" } }, "match": "(?x)\n(?<! \\w)(?:\n(?:\n\\.[0-9](?: _?[0-9] )*\n|\n[0-9](?: _?[0-9] )* \\. [0-9](?: _?[0-9] )*\n|\n[0-9](?: _?[0-9] )* \\.\n) (?: [eE][+-]?[0-9](?: _?[0-9] )* )?\n|\n[0-9](?: _?[0-9] )* (?: [eE][+-]?[0-9](?: _?[0-9] )* )\n)([jJ])?\\b\n", "name": "constant.numeric.float.python" }, "number-hex": { "captures": { "1": { "name": "storage.type.number.python" } }, "match": "(?x)\n(?<![\\w\\.])\n(0[xX]) (_?[0-9a-fA-F])+\n\\b\n", "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)\n(?<![\\w\\.])\n([1-9][0-9]* | 0) ([lL])\n\\b\n", "name": "constant.numeric.bin.python" }, "number-oct": { "captures": { "1": { "name": "storage.type.number.python" } }, "match": "(?x)\n(?<![\\w\\.])\n(0[oO]) (_?[0-7])+\n\\b\n", "name": "constant.numeric.oct.python" }, "odd-function-call": { "begin": "(?x)\n(?<= \\] | \\) ) \\s*\n(?=\\()\n", "comment": 'A bit obscured function call where there may have been an\narbitrary number of other operations to get the function.\nE.g. "arr[idx](args)"\n', "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)\n\\b(?<!\\.)\n(?:\n(and | or | not | in | is) (?# 1)\n|\n(for | if | else | await | (?:yield(?:\\s+from)?)) (?# 2)\n)\n(?!\\s*:)\\b\n\n| (<< | >> | & | \\| | \\^ | ~) (?# 3)\n\n| (\\*\\* | \\* | \\+ | - | % | // | / | @) (?# 4)\n\n| (!= | == | >= | <= | < | >) (?# 5)\n\n| (:=) (?# 6)\n" }, "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)\n\\b ((self)|(cls)) \\b \\s*(?:(,)|(?=\\)))\n" }, "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": "\\b(owned|borrowed|inout)\\b", "name": "storage.modifier" }, { "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)\n([[:alpha:]_]\\w*)\n\\s* (?: (,) | (?=[)#\\n=]))\n" }, { "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)\n(\\() (\\?P= \\w+(?:\\s+[[:alnum:]]+)?) (\\))\n", "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)\n\\\\ (\nx[0-9A-Fa-f]{2}\n| 0[0-7]{1,2}\n| [0-7]{3}\n)\n", "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)\n\\\\ (\nu[0-9A-Fa-f]{4}\n| U[0-9A-Fa-f]{8}\n)\n", "name": "constant.character.unicode.regexp" }, "regexp-flags": { "match": "\\(\\?[aiLmsux]+\\)", "name": "storage.modifier.flag.regexp" }, "regexp-quantifier": { "match": "(?x)\n\\{(\n\\d+ | \\d+,(\\d+)? | ,\\d+\n)\\}\n", "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)\n\\[ \\^? \\] (?! .*?\\])\n" }, { "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)\n(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n", "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)\n\\[ \\^? \\] (?! .*?\\])\n" }, { "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)\n(\\() (\\?P <\\w+(?:\\s+[[:alnum:]]+)?>)\n", "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)\n\\b\n\n\n\n\n\n(\n_* [[:upper:]] [_\\d]* [[:upper:]]\n)\n[[:upper:]\\d]* (_\\w*)?\n\\b\n", "name": "constant.other.caps.python" }, "special-variables": { "captures": { "1": { "name": "variable.language.special.self.python" }, "2": { "name": "variable.language.special.cls.python" } }, "match": "(?x)\n\\b (?<!\\.) (?:\n(self) | (cls)\n)\\b\n" }, "statement": { "patterns": [{ "include": "#import" }, { "include": "#class-declaration" }, { "include": "#function-declaration" }, { "include": "#generator" }, { "include": "#statement-keyword" }, { "include": "#assignment-operator" }, { "include": "#decorator" }, { "include": "#semicolon" }] }, "statement-keyword": { "patterns": [{ "match": "\\b((async\\s+)?\\s*(def|fn))\\b", "name": "storage.type.function.python" }, { "comment": "if `as` is eventually followed by `:` or line continuation\nit's probably control flow like:\n with foo as bar, \\\n Foo as Bar:\n try:\n do_stuff()\n except Exception as e:\n pass\n", "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)\n\\b(?<!\\.)(\nasync | continue | del | assert | break | finally | for\n| from | elif | else | if | except | pass | raise\n| return | try | while | with\n)\\b\n", "name": "keyword.control.flow.python" }, { "match": "(?x)\n\\b(?<!\\.)(\nglobal | nonlocal\n)\\b\n", "name": "storage.modifier.declaration.python" }, { "match": "\\b(?<!\\.)(class|struct|trait)\\b", "name": "storage.type.class.python" }, { "captures": { "1": { "name": "keyword.control.flow.python" } }, "match": `(?x)
79
79
  ^\\s*(
80
80
  case | match
81
81
  )(?=\\s*([-+\\w\\d(\\[{'":#]|$))\\b
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "Move", "name": "move", "patterns": [{ "include": "#address" }, { "include": "#comments" }, { "include": "#module" }, { "include": "#script" }, { "include": "#attributes" }], "repository": { "=== DEPRECATED_BELOW ===": {}, "abilities": { "comment": "Ability", "match": "\\b(store|key|drop|copy)\\b", "name": "entity.name.type.ability.move" }, "address": { "begin": "\\b(address)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.address.keyword.move" } }, "comment": "Address block", "end": "(?<=})", "name": "meta.address_block.move", "patterns": [{ "include": "#comments" }, { "begin": "(?<=address)", "comment": "Address value/const", "end": "(?=[{])", "name": "meta.address.definition.move", "patterns": [{ "include": "#comments" }, { "include": "#address_literal" }, { "comment": "Named Address", "match": "\\b(\\w+)\\b", "name": "entity.name.type.move" }] }, { "include": "#module" }] }, "as": { "comment": "Keyword as (highlighted)", "match": "\\b(as)\\b", "name": "keyword.control.as.move" }, "as-import": { "comment": "Keyword as in import statement; not highlighted", "match": "\\b(as)\\b", "name": "meta.import.as.move" }, "attributes": { "match": '#\\[(?:[\\w0-9=,_\\(\\)\\s"\\:=]+)\\]', "name": "support.constant.attribute.move" }, "block": { "begin": "{", "comment": "Block expression or definition", "end": "}", "name": "meta.block.move", "patterns": [{ "include": "#expr" }] }, "block-comments": { "comment": "Supported since https://github.com/diem/diem/pull/3714", "patterns": [{ "begin": "/\\*[\\*!](?![\\*/])", "comment": "Block documentation comment", "end": "\\*/", "name": "comment.block.documentation.move" }, { "begin": "/\\*", "comment": "Block comment", "end": "\\*/", "name": "comment.block.move" }] }, "comments": { "name": "meta.comments.move", "patterns": [{ "include": "#line-comments" }, { "include": "#block-comments" }] }, "const": { "begin": "\\b(const)\\b", "beginCaptures": { "1": { "name": "storage.modifier.const.move" } }, "end": ";", "name": "meta.const.move", "patterns": [{ "include": "#comments" }, { "include": "#primitives" }, { "include": "#literals" }, { "match": "\\b([\\w_]+)\\b", "name": "constant.other.move" }] }, "control": { "comment": "Control flow", "match": "\\b(return|while|loop|if|else|break|continue|abort)\\b", "name": "keyword.control.move" }, "entry": { "comment": "entry", "match": "\\b(entry)\\b", "name": "storage.modifier.visibility.entry.move" }, "enum": { "begin": "\\b(enum)\\b", "beginCaptures": { "1": { "name": "keyword.control.enum.move" } }, "comment": "Enum syntax", "end": "(?<=})", "name": "meta.enum.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#type_param" }, { "comment": "Enum name (ident)", "match": "\\b[A-Z][a-zA-Z_0-9]*\\b", "name": "entity.name.type.enum.move" }, { "include": "#has" }, { "include": "#abilities" }, { "begin": "{", "end": "}", "name": "meta.enum.definition.move", "patterns": [{ "include": "#comments" }, { "begin": "\\(", "end": "\\)", "name": "meta.enum.tuple.move", "patterns": [{ "include": "#comments" }, { "include": "#types" }] }, { "begin": "{", "end": "}", "name": "meta.enum.struct.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#types" }] }] }] }, "error_const": { "match": "\\b(E[A-Z][A-Za-z_]*)\\b", "name": "variable.language.error.move" }, "escaped_identifier": { "begin": "`", "comment": "Escaped variable", "end": "`", "name": "variable.language.escaped.move" }, "expr": { "comment": "Aggregate Expression", "name": "meta.expression.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#expr_generic" }, { "include": "#error_const" }, { "include": "#packed_field" }, { "include": "#import" }, { "include": "#as" }, { "include": "#mut" }, { "include": "#let" }, { "include": "#literals" }, { "include": "#control" }, { "include": "#move_copy" }, { "include": "#resource_methods" }, { "include": "#self_access" }, { "include": "#module_access" }, { "include": "#label" }, { "include": "#macro_call" }, { "include": "#local_call" }, { "include": "#method_call" }, { "include": "#path_access" }, { "match": "\\$(?=[a-z])", "name": "keyword.operator.macro.dollar.move" }, { "match": "(?<=[$])[a-z][A-Z_0-9a-z]*", "name": "variable.other.meta.move" }, { "include": "#paren" }, { "include": "#block" }] }, "expr_generic": { "begin": "<(?=([\\sa-z_,0-9A-Z<>]+>))", "comment": "< angle brackets >", "end": ">", "name": "meta.expression.generic.type.move", "patterns": [{ "include": "#comments" }, { "include": "#types" }, { "include": "#expr_generic" }] }, "friend": { "begin": "\\b(friend)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "end": ";", "name": "meta.friend.move", "patterns": [{ "include": "#comments" }, { "include": "#address_literal" }, { "comment": "Name of the imported module", "match": "\\b([a-zA-Z][A-Za-z_0-9]*)\\b", "name": "entity.name.type.module.move" }] }, "fun": { "patterns": [{ "include": "#fun_signature" }, { "include": "#block" }] }, "fun_body": { "begin": "{", "comment": "Function body", "end": "(?<=})", "name": "meta.fun_body.move", "patterns": [{ "include": "#expr" }] }, "fun_call": { "begin": "\\b(\\w+)\\s*(?:<[\\w\\s,]+>)?\\s*[(]", "beginCaptures": { "1": { "name": "entity.name.function.call.move" } }, "comment": "Function call", "end": "[)]", "name": "meta.fun_call.move", "patterns": [{ "include": "#comments" }, { "include": "#resource_methods" }, { "include": "#self_access" }, { "include": "#module_access" }, { "include": "#move_copy" }, { "include": "#literals" }, { "include": "#fun_call" }, { "include": "#block" }, { "include": "#mut" }, { "include": "#as" }] }, "fun_signature": { "begin": "\\b(fun)\\b", "beginCaptures": { "1": { "name": "storage.modifier.fun.move" } }, "comment": "Function signature", "end": "(?=[;{])", "name": "meta.fun_signature.move", "patterns": [{ "include": "#comments" }, { "include": "#module_access" }, { "include": "#types" }, { "include": "#mut" }, { "begin": "(?<=fun)", "comment": "Function name", "end": "(?=[<(])", "name": "meta.function_name.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "match": "\\b(\\w+)\\b", "name": "entity.name.function.move" }] }, { "include": "#type_param" }, { "begin": "[(]", "comment": "Parentheses", "end": "[)]", "name": "meta.parentheses.move", "patterns": [{ "include": "#comments" }, { "include": "#self_access" }, { "include": "#module_access" }, { "include": "#types" }, { "include": "#mut" }] }, { "comment": "Keyword acquires", "match": "\\b(acquires)\\b", "name": "storage.modifier" }] }, "has": { "comment": "Has Abilities", "match": "\\b(has)\\b", "name": "keyword.control.ability.has.move" }, "ident": { "match": "\\b([a-zA-Z][A-Z_a-z0-9]*)\\b", "name": "meta.identifier.move" }, "import": { "begin": "\\b(use)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "end": ";", "name": "meta.import.move", "patterns": [{ "include": "#comments" }, { "include": "#use_fun" }, { "include": "#address_literal" }, { "include": "#as-import" }, { "comment": "Uppercase entities", "match": "\\b([A-Z]\\w*)\\b", "name": "entity.name.type.move" }, { "begin": "{", "comment": "Module members", "end": "}", "patterns": [{ "include": "#comments" }, { "include": "#as-import" }, { "comment": "Uppercase entities", "match": "\\b([A-Z]\\w*)\\b", "name": "entity.name.type.move" }] }, { "comment": "Name of the imported module", "match": "\\b(\\w+)\\b", "name": "meta.entity.name.type.module.move" }] }, "label": { "comment": "Label", "match": "'[a-z][a-z_0-9]*", "name": "string.quoted.single.label.move" }, "let": { "comment": "Keyword let", "match": "\\b(let)\\b", "name": "keyword.control.move" }, "line-comments": { "begin": "//", "comment": "Single-line comment", "end": "$", "name": "comment.line.double-slash.move" }, "literals": { "comment": "Literals supported in Move", "name": "meta.literal.move", "patterns": [{ "comment": "base16 address literal", "match": "@0x[A-F0-9a-f]+", "name": "support.constant.address.base16.move" }, { "comment": "named address literal @[ident]", "match": "@[a-zA-Z][a-zA-Z_0-9]*", "name": "support.constant.address.name.move" }, { "comment": "Hex literal", "match": "0x[_a-fA-F0-9]+(?:u(?:8|16|32|64|128|256))?", "name": "constant.numeric.hex.move" }, { "comment": "Numeric literal", "match": "(?<!(?:\\w|(?:(?<!\\.)\\.)))[0-9][_0-9]*(?:\\.(?!\\.)(?:[0-9][_0-9]*)?)?(?:[eE][+\\-]?[_0-9]+)?(?:[u](?:8|16|32|64|128|256))?", "name": "constant.numeric.move" }, { "begin": '\\bb"', "comment": "vector ascii bytestring literal", "end": '"', "name": "meta.vector.literal.ascii.move", "patterns": [{ "comment": "Special symbol escape", "match": '\\\\[nrt\\0"]', "name": "constant.character.escape.move" }, { "comment": "HEX Escape", "match": "\\\\x[a-fA-F0-9][A-Fa-f0-9]", "name": "constant.character.escape.hex.move" }, { "comment": "ASCII Character", "match": "[\\x00-\\x7F]", "name": "string.quoted.double.raw.move" }] }, { "begin": 'x"', "comment": "vector hex literal", "end": '"', "name": "meta.vector.literal.hex.move", "patterns": [{ "comment": "vector hex literal", "match": "[A-Fa-f0-9]+", "name": "constant.character.move" }] }, { "comment": "bool literal", "match": "\\b(?:true|false)\\b", "name": "constant.language.boolean.move" }, { "begin": "vector\\[", "comment": "vector literal (macro?)", "end": "\\]", "name": "meta.vector.literal.macro.move", "patterns": [{ "include": "#expr" }] }] }, "local_call": { "comment": "call to a local / imported fun", "match": "\\b([a-z][_a-z0-9]*)(?=[<\\(])", "name": "entity.name.function.call.local.move" }, "macro": { "begin": "\\b(macro)\\b", "beginCaptures": { "1": { "name": "keyword.control.macro.move" } }, "comment": "macro fun [ident] {}", "end": "(?<=})", "name": "meta.macro.move", "patterns": [{ "include": "#comments" }, { "include": "#fun" }] }, "macro_call": { "captures": { "2": { "name": "support.function.macro.move" } }, "comment": "Macro fun call", "match": "(\\b|\\.)([a-z][A-Za-z0-9_]*)!", "name": "meta.macro.call" }, "method_call": { "captures": { "1": { "name": "entity.name.function.call.path.move" } }, "comment": "<expr>.[ident]<>?() call", "match": "\\.([a-z][_a-z0-9]*)(?=[<\\(])", "name": "meta.path.call.move" }, "module": { "begin": "\\b(module|spec)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "comment": "Module definition", "end": "(?<=})", "name": "meta.module.move", "patterns": [{ "include": "#comments" }, { "begin": "(?<=(module|spec))", "comment": "Module name", "end": "(?={)", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "begin": "(?<=(module|spec))", "comment": "Module namespace / address", "end": "(?=[(::){])", "name": "constant.other.move" }, { "begin": "(?<=::)", "comment": "Module name", "end": "(?=[\\s{])", "name": "entity.name.type.move" }] }, { "begin": "{", "comment": "Module scope", "end": "}", "name": "meta.module_scope.move", "patterns": [{ "include": "#comments" }, { "include": "#attributes" }, { "include": "#entry" }, { "include": "#public-scope" }, { "include": "#public" }, { "include": "#native" }, { "include": "#import" }, { "include": "#friend" }, { "include": "#const" }, { "include": "#struct" }, { "include": "#enum" }, { "include": "#macro" }, { "include": "#fun" }, { "include": "#spec" }, { "include": "#block" }] }] }, "module_access": { "captures": { "1": { "name": "meta.entity.name.type.accessed.module.move" }, "2": { "name": "entity.name.function.call.move" } }, "comment": "Use of module type or method", "match": "\\b(\\w+)::(\\w+)\\b", "name": "meta.module_access.move" }, "move_copy": { "comment": "Keywords move and copy", "match": "\\b(move|copy)\\b", "name": "variable.language.move" }, "mut": { "comment": "Mutable reference and let mut", "match": "\\b(mut)\\b", "name": "storage.modifier.mut.move" }, "native": { "comment": "native", "match": "\\b(native)\\b", "name": "storage.modifier.visibility.native.move" }, "packed_field": { "comment": "[ident]: ", "match": "[a-z][a-z0-9_]+\\s*:\\s[^:]", "name": "meta.struct.field.move" }, "paren": { "begin": "\\(", "end": "\\)", "name": "meta.paren.move", "patterns": [{ "include": "#expr" }] }, "path_access": { "comment": "<expr>.[ident] access", "match": "\\.[a-z][_a-z0-9]*\\b", "name": "meta.path.access.move" }, "phantom": { "comment": "Keyword phantom inside type parameters", "match": "\\b(phantom)\\b", "name": "keyword.control.phantom.move" }, "primitives": { "comment": "Primitive types", "match": "\\b(u8|u16|u32|u64|u128|u256|address|bool|signer)\\b", "name": "support.type.primitives.move" }, "public": { "comment": "public", "match": "\\b(public)\\b", "name": "storage.modifier.visibility.public.move" }, "public-scope": { "begin": "(?<=(public))\\s*\\(", "comment": "public (friend/script/package)", "end": "\\)", "name": "meta.public.scoped.move", "patterns": [{ "include": "#comments" }, { "match": "\\b(friend|script|package)\\b", "name": "keyword.control.public.scope.move" }] }, "resource_methods": { "comment": "Methods to work with resource", "match": "\\b(borrow_global|borrow_global_mut|exists|move_from|move_to_sender|move_to)\\b", "name": "support.function.typed.move" }, "script": { "begin": "\\b(script)\\b", "beginCaptures": { "1": { "name": "storage.modifier.script.move" } }, "end": "(?<=})", "name": "meta.script.move", "patterns": [{ "include": "#comments" }, { "begin": "{", "comment": "Script scope", "end": "}", "name": "meta.script_scope.move", "patterns": [{ "include": "#const" }, { "include": "#comments" }, { "include": "#import" }, { "include": "#fun" }] }] }, "self_access": { "captures": { "1": { "name": "variable.language.self.move" }, "2": { "name": "entity.name.function.call.move" } }, "comment": "Use of Self", "match": "\\b(Self)::(\\w+)\\b", "name": "meta.self_access.move" }, "spec": { "begin": "\\b(spec)\\b", "beginCaptures": { "1": { "name": "storage.modifier.spec.move" } }, "end": "(?<=[;}])", "name": "meta.spec.move", "patterns": [{ "comment": "Spec target", "match": "\\b(module|schema|struct|fun)", "name": "storage.modifier.spec.target.move" }, { "comment": "Spec define inline", "match": "\\b(define)", "name": "storage.modifier.spec.define.move" }, { "comment": "Target name", "match": "\\b(\\w+)\\b", "name": "entity.name.function.move" }, { "begin": "{", "comment": "Spec block", "end": "}", "patterns": [{ "include": "#comments" }, { "include": "#spec_block" }, { "include": "#spec_types" }, { "include": "#spec_define" }, { "include": "#spec_keywords" }, { "include": "#control" }, { "include": "#fun_call" }, { "include": "#literals" }, { "include": "#types" }, { "include": "#let" }] }] }, "spec_block": { "begin": "{", "comment": "Spec block", "end": "}", "name": "meta.spec_block.move", "patterns": [{ "include": "#comments" }, { "include": "#spec_block" }, { "include": "#spec_types" }, { "include": "#fun_call" }, { "include": "#literals" }, { "include": "#control" }, { "include": "#types" }, { "include": "#let" }] }, "spec_define": { "begin": "\\b(define)\\b", "beginCaptures": { "1": { "name": "keyword.control.move.spec" } }, "comment": "Spec define keyword", "end": "(?=[;{])", "name": "meta.spec_define.move", "patterns": [{ "include": "#comments" }, { "include": "#spec_types" }, { "include": "#types" }, { "begin": "(?<=define)", "comment": "Function name", "end": "(?=[(])", "patterns": [{ "include": "#comments" }, { "match": "\\b(\\w+)\\b", "name": "entity.name.function.move" }] }] }, "spec_keywords": { "match": "\\b(global|pack|unpack|pragma|native|include|ensures|requires|invariant|apply|aborts_if|modifies)\\b", "name": "keyword.control.move.spec" }, "spec_types": { "comment": "Spec-only types", "match": "\\b(range|num|vector|bool|u8|u16|u32|u64|u128|u256|address)\\b", "name": "support.type.vector.move" }, "struct": { "begin": "\\b(struct)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "end": "(?<=[};])", "name": "meta.struct.move", "patterns": [{ "include": "#comments" }, { "begin": "(?<=struct)", "comment": "Struct definition", "end": "(?=[;{])", "name": "meta.struct.definition.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#has" }, { "include": "#abilities" }, { "comment": "Struct name (ident)", "match": "\\b[A-Z][a-zA-Z_0-9]*\\b", "name": "entity.name.type.struct.move" }, { "begin": "\\(", "comment": "Simple struct", "end": "\\)", "name": "meta.struct.paren.move", "patterns": [{ "include": "#comments" }, { "include": "#types" }] }, { "include": "#type_param" }] }, { "begin": "\\(", "comment": "Simple struct", "end": "\\)", "name": "meta.struct.paren.move", "patterns": [{ "include": "#comments" }, { "include": "#types" }] }, { "begin": "{", "comment": "Struct body", "end": "}", "name": "meta.struct.body.move", "patterns": [{ "include": "#comments" }, { "include": "#self_access" }, { "include": "#module_access" }, { "include": "#types" }] }] }, "struct_pack": { "begin": "(?<=[A-Za-z0-9_>])\\s*{", "comment": "Struct { field: value... }; identified as generic / ident followed by curly's", "end": "}", "name": "meta.struct.pack.move", "patterns": [{ "include": "#comments" }] }, "type_param": { "begin": "<", "comment": "Generic type param", "end": ">", "name": "meta.generic_param.move", "patterns": [{ "include": "#comments" }, { "include": "#phantom" }, { "include": "#module_access" }, { "include": "#abilities" }] }, "types": { "comment": "Built-in types + vector", "name": "meta.types.move", "patterns": [{ "include": "#primitives" }, { "include": "#vector" }, { "comment": "Capitalized type names", "match": "\\b([A-Z][A-Za-z_]*)\\b", "name": "entity.name.type" }, { "comment": "All-uppercase const literal", "match": "\\b([A-Z_]+)\\b", "name": "constant.other.move" }] }, "use_fun": { "begin": "\\b(fun)\\b", "beginCaptures": { "1": { "name": "storage.modifier.fun.move" } }, "comment": "use { fun } internals", "end": "(?=;)", "name": "meta.import.fun.move", "patterns": [{ "include": "#comments" }, { "include": "#as-import" }, { "comment": "Self keyword", "match": "\\b(Self)\\b", "name": "variable.language.self.use.fun.move" }, { "comment": "Function name", "match": "\\b([a-z][a-z_0-9]+)\\b", "name": "entity.name.function.use.move" }] }, "vector": { "comment": "vector type", "match": "\\b(vector)\\b", "name": "support.type.vector.move" } }, "scopeName": "source.move" });
1
+ const lang = Object.freeze({ "displayName": "Move", "name": "move", "patterns": [{ "include": "#address" }, { "include": "#comments" }, { "include": "#module" }, { "include": "#script" }, { "include": "#attributes" }], "repository": { "=== DEPRECATED_BELOW ===": {}, "abilities": { "comment": "Ability", "match": "\\b(store|key|drop|copy)\\b", "name": "support.type.ability.move" }, "address": { "begin": "\\b(address)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.address.keyword.move" } }, "comment": "Address block", "end": "(?<=})", "name": "meta.address_block.move", "patterns": [{ "include": "#comments" }, { "begin": "(?<=address)", "comment": "Address value/const", "end": "(?=[{])", "name": "meta.address.definition.move", "patterns": [{ "include": "#comments" }, { "include": "#address_literal" }, { "comment": "Named Address", "match": "\\b(\\w+)\\b", "name": "entity.name.type.move" }] }, { "include": "#module" }] }, "as": { "comment": "Keyword as (highlighted)", "match": "\\b(as)\\b", "name": "keyword.control.as.move" }, "as-import": { "comment": "Keyword as in import statement; not highlighted", "match": "\\b(as)\\b", "name": "meta.import.as.move" }, "attributes": { "match": '#\\[(?:[\\w0-9=,_\\(\\)\\s"\\:=]+)\\]', "name": "support.constant.attribute.move" }, "block": { "begin": "{", "comment": "Block expression or definition", "end": "}", "name": "meta.block.move", "patterns": [{ "include": "#expr" }] }, "block-comments": { "comment": "Supported since https://github.com/diem/diem/pull/3714", "patterns": [{ "begin": "/\\*[\\*!](?![\\*/])", "comment": "Block documentation comment", "end": "\\*/", "name": "comment.block.documentation.move" }, { "begin": "/\\*", "comment": "Block comment", "end": "\\*/", "name": "comment.block.move" }] }, "capitalized": { "comment": "MyType - capitalized type name", "match": "\\b([A-Z][a-zA-Z_0-9]*)\\b", "name": "entity.name.type.use.move" }, "comments": { "name": "meta.comments.move", "patterns": [{ "include": "#line-comments" }, { "include": "#block-comments" }] }, "const": { "begin": "\\b(const)\\b", "beginCaptures": { "1": { "name": "storage.modifier.const.move" } }, "end": ";", "name": "meta.const.move", "patterns": [{ "include": "#comments" }, { "include": "#primitives" }, { "include": "#literals" }, { "match": "\\b([\\w_]+)\\b", "name": "constant.other.move" }] }, "control": { "comment": "Control flow", "match": "\\b(return|while|loop|if|else|break|continue|abort)\\b", "name": "keyword.control.move" }, "entry": { "comment": "entry", "match": "\\b(entry)\\b", "name": "storage.modifier.visibility.entry.move" }, "enum": { "begin": "\\b(enum)\\b", "beginCaptures": { "1": { "name": "keyword.control.enum.move" } }, "comment": "Enum syntax", "end": "(?<=})", "name": "meta.enum.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#type_param" }, { "comment": "Enum name (ident)", "match": "\\b[A-Z][a-zA-Z_0-9]*\\b", "name": "entity.name.type.enum.move" }, { "include": "#has" }, { "include": "#abilities" }, { "begin": "{", "end": "}", "name": "meta.enum.definition.move", "patterns": [{ "include": "#comments" }, { "begin": "\\(", "end": "\\)", "name": "meta.enum.tuple.move", "patterns": [{ "include": "#comments" }, { "include": "#types" }] }, { "begin": "{", "end": "}", "name": "meta.enum.struct.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#types" }] }] }] }, "error_const": { "match": "\\b(E[A-Z][A-Za-z_]*)\\b", "name": "variable.language.error.move" }, "escaped_identifier": { "begin": "`", "comment": "Escaped variable", "end": "`", "name": "variable.language.escaped.move" }, "expr": { "comment": "Aggregate Expression", "name": "meta.expression.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#expr_generic" }, { "include": "#error_const" }, { "include": "#packed_field" }, { "include": "#import" }, { "include": "#as" }, { "include": "#mut" }, { "include": "#let" }, { "include": "#literals" }, { "include": "#control" }, { "include": "#move_copy" }, { "include": "#resource_methods" }, { "include": "#self_access" }, { "include": "#module_access" }, { "include": "#label" }, { "include": "#macro_call" }, { "include": "#local_call" }, { "include": "#method_call" }, { "include": "#path_access" }, { "match": "\\$(?=[a-z])", "name": "keyword.operator.macro.dollar.move" }, { "match": "(?<=[$])[a-z][A-Z_0-9a-z]*", "name": "variable.other.meta.move" }, { "comment": "ALL_CONST_CAPS", "match": "\\b([A-Z][A-Z_]+)\\b", "name": "constant.other.move" }, { "comment": "CustomType", "match": "\\b([A-Z][a-zA-Z_0-9]*)\\b", "name": "entity.name.type.move" }, { "include": "#paren" }, { "include": "#block" }] }, "expr_generic": { "begin": "<(?=([\\sa-z_,0-9A-Z<>]+>))", "comment": "< angle brackets >", "end": ">", "name": "meta.expression.generic.type.move", "patterns": [{ "include": "#comments" }, { "include": "#types" }, { "include": "#capitalized" }, { "include": "#expr_generic" }] }, "friend": { "begin": "\\b(friend)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "end": ";", "name": "meta.friend.move", "patterns": [{ "include": "#comments" }, { "include": "#address_literal" }, { "comment": "Name of the imported module", "match": "\\b([a-zA-Z][A-Za-z_0-9]*)\\b", "name": "entity.name.type.module.move" }] }, "fun": { "patterns": [{ "include": "#fun_signature" }, { "include": "#block" }] }, "fun_body": { "begin": "{", "comment": "Function body", "end": "(?<=})", "name": "meta.fun_body.move", "patterns": [{ "include": "#expr" }] }, "fun_call": { "begin": "\\b(\\w+)\\s*(?:<[\\w\\s,]+>)?\\s*[(]", "beginCaptures": { "1": { "name": "entity.name.function.call.move" } }, "comment": "Function call", "end": "[)]", "name": "meta.fun_call.move", "patterns": [{ "include": "#comments" }, { "include": "#resource_methods" }, { "include": "#self_access" }, { "include": "#module_access" }, { "include": "#move_copy" }, { "include": "#literals" }, { "include": "#fun_call" }, { "include": "#block" }, { "include": "#mut" }, { "include": "#as" }] }, "fun_signature": { "begin": "\\b(fun)\\b", "beginCaptures": { "1": { "name": "storage.modifier.fun.move" } }, "comment": "Function signature", "end": "(?=[;{])", "name": "meta.fun_signature.move", "patterns": [{ "include": "#comments" }, { "include": "#module_access" }, { "include": "#capitalized" }, { "include": "#types" }, { "include": "#mut" }, { "begin": "(?<=fun)", "comment": "Function name", "end": "(?=[<(])", "name": "meta.function_name.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "match": "\\b(\\w+)\\b", "name": "entity.name.function.move" }] }, { "include": "#type_param" }, { "begin": "[(]", "comment": "Parentheses", "end": "[)]", "name": "meta.parentheses.move", "patterns": [{ "include": "#comments" }, { "include": "#self_access" }, { "include": "#expr_generic" }, { "include": "#escaped_identifier" }, { "include": "#module_access" }, { "include": "#capitalized" }, { "include": "#types" }, { "include": "#mut" }] }, { "comment": "Keyword acquires", "match": "\\b(acquires)\\b", "name": "storage.modifier" }] }, "has": { "comment": "Has Abilities", "match": "\\b(has)\\b", "name": "keyword.control.ability.has.move" }, "ident": { "match": "\\b([a-zA-Z][A-Z_a-z0-9]*)\\b", "name": "meta.identifier.move" }, "import": { "begin": "\\b(use)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "end": ";", "name": "meta.import.move", "patterns": [{ "include": "#comments" }, { "include": "#use_fun" }, { "include": "#address_literal" }, { "include": "#as-import" }, { "comment": "Uppercase entities", "match": "\\b([A-Z]\\w*)\\b", "name": "entity.name.type.move" }, { "begin": "{", "comment": "Module members", "end": "}", "patterns": [{ "include": "#comments" }, { "include": "#as-import" }, { "comment": "Uppercase entities", "match": "\\b([A-Z]\\w*)\\b", "name": "entity.name.type.move" }] }, { "comment": "Name of the imported module", "match": "\\b(\\w+)\\b", "name": "meta.entity.name.type.module.move" }] }, "label": { "comment": "Label", "match": "'[a-z][a-z_0-9]*", "name": "string.quoted.single.label.move" }, "let": { "comment": "Keyword let", "match": "\\b(let)\\b", "name": "keyword.control.move" }, "line-comments": { "begin": "//", "comment": "Single-line comment", "end": "$", "name": "comment.line.double-slash.move" }, "literals": { "comment": "Literals supported in Move", "name": "meta.literal.move", "patterns": [{ "comment": "base16 address literal", "match": "@0x[A-F0-9a-f]+", "name": "support.constant.address.base16.move" }, { "comment": "named address literal @[ident]", "match": "@[a-zA-Z][a-zA-Z_0-9]*", "name": "support.constant.address.name.move" }, { "comment": "Hex literal", "match": "0x[_a-fA-F0-9]+(?:u(?:8|16|32|64|128|256))?", "name": "constant.numeric.hex.move" }, { "comment": "Numeric literal", "match": "(?<!(?:\\w|(?:(?<!\\.)\\.)))[0-9][_0-9]*(?:\\.(?!\\.)(?:[0-9][_0-9]*)?)?(?:[eE][+\\-]?[_0-9]+)?(?:[u](?:8|16|32|64|128|256))?", "name": "constant.numeric.move" }, { "begin": '\\bb"', "comment": "vector ascii bytestring literal", "end": '"', "name": "meta.vector.literal.ascii.move", "patterns": [{ "comment": "Special symbol escape", "match": '\\\\[nrt\\0"]', "name": "constant.character.escape.move" }, { "comment": "HEX Escape", "match": "\\\\x[a-fA-F0-9][A-Fa-f0-9]", "name": "constant.character.escape.hex.move" }, { "comment": "ASCII Character", "match": "[\\x00-\\x7F]", "name": "string.quoted.double.raw.move" }] }, { "begin": 'x"', "comment": "vector hex literal", "end": '"', "name": "meta.vector.literal.hex.move", "patterns": [{ "comment": "vector hex literal", "match": "[A-Fa-f0-9]+", "name": "constant.character.move" }] }, { "comment": "bool literal", "match": "\\b(?:true|false)\\b", "name": "constant.language.boolean.move" }, { "begin": "vector\\[", "comment": "vector literal (macro?)", "end": "\\]", "name": "meta.vector.literal.macro.move", "patterns": [{ "include": "#expr" }] }] }, "local_call": { "comment": "call to a local / imported fun", "match": "\\b([a-z][_a-z0-9]*)(?=[<\\(])", "name": "entity.name.function.call.local.move" }, "macro": { "begin": "\\b(macro)\\b", "beginCaptures": { "1": { "name": "keyword.control.macro.move" } }, "comment": "macro fun [ident] {}", "end": "(?<=})", "name": "meta.macro.move", "patterns": [{ "include": "#comments" }, { "include": "#fun" }] }, "macro_call": { "captures": { "2": { "name": "support.function.macro.move" } }, "comment": "Macro fun call", "match": "(\\b|\\.)([a-z][A-Za-z0-9_]*)!", "name": "meta.macro.call" }, "method_call": { "captures": { "1": { "name": "entity.name.function.call.path.move" } }, "comment": "<expr>.[ident]<>?() call", "match": "\\.([a-z][_a-z0-9]*)(?=[<\\(])", "name": "meta.path.call.move" }, "module": { "begin": "\\b(module|spec)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "comment": "Module definition", "end": "(?<=})", "name": "meta.module.move", "patterns": [{ "include": "#comments" }, { "begin": "(?<=(module|spec))", "comment": "Module name", "end": "(?={)", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "begin": "(?<=(module|spec))", "comment": "Module namespace / address", "end": "(?=[(::){])", "name": "constant.other.move" }, { "begin": "(?<=::)", "comment": "Module name", "end": "(?=[\\s{])", "name": "entity.name.type.move" }] }, { "begin": "{", "comment": "Module scope", "end": "}", "name": "meta.module_scope.move", "patterns": [{ "include": "#comments" }, { "include": "#attributes" }, { "include": "#entry" }, { "include": "#public-scope" }, { "include": "#public" }, { "include": "#native" }, { "include": "#import" }, { "include": "#friend" }, { "include": "#const" }, { "include": "#struct" }, { "include": "#enum" }, { "include": "#macro" }, { "include": "#fun" }, { "include": "#spec" }, { "include": "#block" }] }] }, "module_access": { "captures": { "1": { "name": "meta.entity.name.type.accessed.module.move" }, "2": { "name": "entity.name.function.call.move" } }, "comment": "Use of module type or method", "match": "\\b(\\w+)::(\\w+)\\b", "name": "meta.module_access.move" }, "move_copy": { "comment": "Keywords move and copy", "match": "\\b(move|copy)\\b", "name": "variable.language.move" }, "mut": { "comment": "Mutable reference and let mut", "match": "\\b(mut)\\b", "name": "storage.modifier.mut.move" }, "native": { "comment": "native", "match": "\\b(native)\\b", "name": "storage.modifier.visibility.native.move" }, "packed_field": { "comment": "[ident]: ", "match": "[a-z][a-z0-9_]+\\s*:\\s*(?=\\s)", "name": "meta.struct.field.move" }, "paren": { "begin": "\\(", "end": "\\)", "name": "meta.paren.move", "patterns": [{ "include": "#expr" }] }, "path_access": { "comment": "<expr>.[ident] access", "match": "\\.[a-z][_a-z0-9]*\\b", "name": "meta.path.access.move" }, "phantom": { "comment": "Keyword phantom inside type parameters", "match": "\\b(phantom)\\b", "name": "keyword.control.phantom.move" }, "primitives": { "comment": "Primitive types", "match": "\\b(u8|u16|u32|u64|u128|u256|address|bool|signer)\\b", "name": "support.type.primitives.move" }, "public": { "comment": "public", "match": "\\b(public)\\b", "name": "storage.modifier.visibility.public.move" }, "public-scope": { "begin": "(?<=(public))\\s*\\(", "comment": "public (friend/script/package)", "end": "\\)", "name": "meta.public.scoped.move", "patterns": [{ "include": "#comments" }, { "match": "\\b(friend|script|package)\\b", "name": "keyword.control.public.scope.move" }] }, "resource_methods": { "comment": "Methods to work with resource", "match": "\\b(borrow_global|borrow_global_mut|exists|move_from|move_to_sender|move_to)\\b", "name": "support.function.typed.move" }, "script": { "begin": "\\b(script)\\b", "beginCaptures": { "1": { "name": "storage.modifier.script.move" } }, "end": "(?<=})", "name": "meta.script.move", "patterns": [{ "include": "#comments" }, { "begin": "{", "comment": "Script scope", "end": "}", "name": "meta.script_scope.move", "patterns": [{ "include": "#const" }, { "include": "#comments" }, { "include": "#import" }, { "include": "#fun" }] }] }, "self_access": { "captures": { "1": { "name": "variable.language.self.move" }, "2": { "name": "entity.name.function.call.move" } }, "comment": "Use of Self", "match": "\\b(Self)::(\\w+)\\b", "name": "meta.self_access.move" }, "spec": { "begin": "\\b(spec)\\b", "beginCaptures": { "1": { "name": "storage.modifier.spec.move" } }, "end": "(?<=[;}])", "name": "meta.spec.move", "patterns": [{ "comment": "Spec target", "match": "\\b(module|schema|struct|fun)", "name": "storage.modifier.spec.target.move" }, { "comment": "Spec define inline", "match": "\\b(define)", "name": "storage.modifier.spec.define.move" }, { "comment": "Target name", "match": "\\b(\\w+)\\b", "name": "entity.name.function.move" }, { "begin": "{", "comment": "Spec block", "end": "}", "patterns": [{ "include": "#comments" }, { "include": "#spec_block" }, { "include": "#spec_types" }, { "include": "#spec_define" }, { "include": "#spec_keywords" }, { "include": "#control" }, { "include": "#fun_call" }, { "include": "#literals" }, { "include": "#types" }, { "include": "#let" }] }] }, "spec_block": { "begin": "{", "comment": "Spec block", "end": "}", "name": "meta.spec_block.move", "patterns": [{ "include": "#comments" }, { "include": "#spec_block" }, { "include": "#spec_types" }, { "include": "#fun_call" }, { "include": "#literals" }, { "include": "#control" }, { "include": "#types" }, { "include": "#let" }] }, "spec_define": { "begin": "\\b(define)\\b", "beginCaptures": { "1": { "name": "keyword.control.move.spec" } }, "comment": "Spec define keyword", "end": "(?=[;{])", "name": "meta.spec_define.move", "patterns": [{ "include": "#comments" }, { "include": "#spec_types" }, { "include": "#types" }, { "begin": "(?<=define)", "comment": "Function name", "end": "(?=[(])", "patterns": [{ "include": "#comments" }, { "match": "\\b(\\w+)\\b", "name": "entity.name.function.move" }] }] }, "spec_keywords": { "match": "\\b(global|pack|unpack|pragma|native|include|ensures|requires|invariant|apply|aborts_if|modifies)\\b", "name": "keyword.control.move.spec" }, "spec_types": { "comment": "Spec-only types", "match": "\\b(range|num|vector|bool|u8|u16|u32|u64|u128|u256|address)\\b", "name": "support.type.vector.move" }, "struct": { "begin": "\\b(struct)\\b", "beginCaptures": { "1": { "name": "storage.modifier.type.move" } }, "end": "(?<=[};])", "name": "meta.struct.move", "patterns": [{ "include": "#comments" }, { "begin": "(?<=struct)", "comment": "Struct definition", "end": "(?=[;{])", "name": "meta.struct.definition.move", "patterns": [{ "include": "#comments" }, { "include": "#escaped_identifier" }, { "include": "#has" }, { "include": "#abilities" }, { "comment": "Struct name (ident)", "match": "\\b[A-Z][a-zA-Z_0-9]*\\b", "name": "entity.name.type.struct.move" }, { "begin": "\\(", "comment": "Simple struct", "end": "\\)", "name": "meta.struct.paren.move", "patterns": [{ "include": "#comments" }, { "include": "#capitalized" }, { "include": "#types" }] }, { "include": "#type_param" }] }, { "begin": "\\(", "comment": "Simple struct", "end": "\\)", "name": "meta.struct.paren.move", "patterns": [{ "include": "#comments" }, { "include": "#types" }] }, { "begin": "{", "comment": "Struct body", "end": "}", "name": "meta.struct.body.move", "patterns": [{ "include": "#comments" }, { "include": "#self_access" }, { "include": "#escaped_identifier" }, { "include": "#module_access" }, { "include": "#expr_generic" }, { "include": "#capitalized" }, { "include": "#types" }] }] }, "struct_pack": { "begin": "(?<=[A-Za-z0-9_>])\\s*{", "comment": "Struct { field: value... }; identified as generic / ident followed by curly's", "end": "}", "name": "meta.struct.pack.move", "patterns": [{ "include": "#comments" }] }, "type_param": { "begin": "<", "comment": "Generic type param", "end": ">", "name": "meta.generic_param.move", "patterns": [{ "include": "#comments" }, { "include": "#phantom" }, { "include": "#capitalized" }, { "include": "#module_access" }, { "include": "#abilities" }] }, "types": { "comment": "Built-in types + vector", "name": "meta.types.move", "patterns": [{ "include": "#primitives" }, { "include": "#vector" }] }, "use_fun": { "begin": "\\b(fun)\\b", "beginCaptures": { "1": { "name": "storage.modifier.fun.move" } }, "comment": "use { fun } internals", "end": "(?=;)", "name": "meta.import.fun.move", "patterns": [{ "include": "#comments" }, { "comment": "as keyword", "match": "\\b(as)\\b", "name": "keyword.control.as.move" }, { "comment": "Self keyword", "match": "\\b(Self)\\b", "name": "variable.language.self.use.fun.move" }, { "comment": "Function name", "match": "\\b(_______[a-z][a-z_0-9]+)\\b", "name": "entity.name.function.use.move" }, { "include": "#types" }, { "include": "#escaped_identifier" }, { "include": "#capitalized" }] }, "vector": { "comment": "vector type", "match": "\\b(vector)\\b", "name": "support.type.vector.move" } }, "scopeName": "source.move" });
2
2
  var move = [
3
3
  lang
4
4
  ];