blob: f64e6738e320265f6a616a7f5f64f685280c14ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
; Python highlights, from tree-sitter/tree-sitter-python v0.25.0
; queries/highlights.scm (MIT). Reordered for later-patterns-win, capture names
; mapped onto zed syntax keys, and the builtin-function #match? turned into
; #any-of?. The two casing heuristics stay regexes: nothing else can express
; "CONST_CASE" and "ClassName" over bare identifiers.
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
[";" "," "." ":"] @punctuation.delimiter
["-" "-=" "!=" "*" "**" "**=" "*=" "/" "//" "//=" "/=" "&" "&=" "%" "%="
"^" "^=" "+" "->" "+=" "<" "<<" "<<=" "<=" "<>" "=" ":=" "==" ">" ">="
">>" ">>=" "|" "|=" "~" "@=" "and" "in" "is" "not" "or" "is not"
"not in"] @operator
["as" "assert" "async" "await" "break" "class" "continue" "def" "del" "elif"
"else" "except" "exec" "finally" "for" "from" "global" "if" "import" "lambda"
"nonlocal" "pass" "print" "raise" "return" "try" "while" "with" "yield"
"match" "case"] @keyword
((identifier) @constructor
(#match? @constructor "^[A-Z]"))
((identifier) @constant
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
((identifier) @variable.special
(#any-of? @variable.special "self" "cls"))
(type (identifier) @type)
(attribute attribute: (identifier) @property)
(function_definition name: (identifier) @function)
(call function: (identifier) @function)
(call function: (attribute attribute: (identifier) @function.method))
((call function: (identifier) @function.builtin)
(#any-of? @function.builtin "abs" "all" "any" "ascii" "bin" "bool"
"breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod" "compile"
"complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter"
"float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help"
"hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list"
"locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord"
"pow" "print" "property" "range" "repr" "reversed" "round" "set" "setattr"
"slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars"
"zip" "__import__"))
[(integer) (float)] @number
[(none) (true) (false)] @constant
(string) @string
(escape_sequence) @string.escape
(interpolation "{" @punctuation.special "}" @punctuation.special)
(decorator "@" @attribute)
(decorator [(identifier) (attribute)] @attribute)
(comment) @comment
|