| 1 |
|
| 2 |
|
| 3 |
(identifier) @variable |
| 4 |
|
| 5 |
(attribute attribute: (identifier) @variable.other.member) |
| 6 |
|
| 7 |
((identifier) @constant |
| 8 |
(#match? @constant "^_*[A-Z][A-Z\\d_]*$")) |
| 9 |
|
| 10 |
((identifier) @type |
| 11 |
(#match? @type "^[A-Z]")) |
| 12 |
|
| 13 |
|
| 14 |
(none) @constant.builtin |
| 15 |
[ |
| 16 |
(true) |
| 17 |
(false) |
| 18 |
] @constant.builtin.boolean |
| 19 |
|
| 20 |
(integer) @constant.numeric.integer |
| 21 |
(float) @constant.numeric.float |
| 22 |
(comment) @comment |
| 23 |
(string) @string |
| 24 |
(escape_sequence) @constant.character.escape |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
(expression_statement (string) @comment.block.documentation) |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
(dotted_name |
| 33 |
(identifier)* @namespace) |
| 34 |
|
| 35 |
(aliased_import |
| 36 |
alias: (identifier) @namespace) |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
((call |
| 41 |
function: (identifier) @function.builtin) |
| 42 |
(#match? |
| 43 |
@function.builtin |
| 44 |
"^(abs|all|always_inline|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|constrained|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|unroll|vars|zip|__mlir_attr|__mlir_op|__mlir_type|__import__)$")) |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
[ |
| 49 |
"def" |
| 50 |
"lambda" |
| 51 |
"fn" |
| 52 |
] @keyword.function |
| 53 |
|
| 54 |
(call |
| 55 |
function: (attribute attribute: (identifier) @constructor) |
| 56 |
(#match? @constructor "^[A-Z]")) |
| 57 |
|
| 58 |
(call |
| 59 |
function: (identifier) @constructor |
| 60 |
(#match? @constructor "^[A-Z]")) |
| 61 |
|
| 62 |
(call |
| 63 |
function: (attribute attribute: (identifier) @function.method)) |
| 64 |
|
| 65 |
(call |
| 66 |
function: (identifier) @function) |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
(function_definition |
| 71 |
name: (identifier) @constructor |
| 72 |
(#match? @constructor "^(__new__|__init__|__moveinit__|__copyinit__)$")) |
| 73 |
|
| 74 |
(function_definition |
| 75 |
name: (identifier) @function) |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
(decorator) @function |
| 80 |
(decorator (identifier) @function) |
| 81 |
(decorator (attribute attribute: (identifier) @function)) |
| 82 |
(decorator (call |
| 83 |
function: (attribute attribute: (identifier) @function))) |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
((identifier) @variable.builtin |
| 88 |
(#match? @variable.builtin "^(self|cls)$")) |
| 89 |
|
| 90 |
(parameters (identifier) @variable.parameter) |
| 91 |
(parameters (typed_parameter (identifier) @variable.parameter)) |
| 92 |
(parameters (default_parameter name: (identifier) @variable.parameter)) |
| 93 |
(parameters (typed_default_parameter name: (identifier) @variable.parameter)) |
| 94 |
|
| 95 |
(parameters |
| 96 |
(list_splat_pattern |
| 97 |
(identifier) @variable.parameter)) |
| 98 |
|
| 99 |
(parameters |
| 100 |
(dictionary_splat_pattern |
| 101 |
(identifier) @variable.parameter)) |
| 102 |
|
| 103 |
(lambda_parameters |
| 104 |
(identifier) @variable.parameter) |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
((identifier) @type.builtin |
| 109 |
(#match? |
| 110 |
@type.builtin |
| 111 |
"^(bool|bytes|dict|float|frozenset|int|list|set|str|tuple)$")) |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
(type [(identifier) (none)] @type) |
| 116 |
|
| 117 |
(type |
| 118 |
(_ [(identifier) (none)]? @type |
| 119 |
(_ [(identifier) (none)]? @type |
| 120 |
(_ [(identifier) (none)]? @type |
| 121 |
(_ [(identifier) (none)]? @type))))) |
| 122 |
|
| 123 |
(class_definition name: (identifier) @type) |
| 124 |
(class_definition superclasses: (argument_list (identifier) @type)) |
| 125 |
|
| 126 |
["," "." ":" ";" (ellipsis)] @punctuation.delimiter |
| 127 |
(interpolation |
| 128 |
"{" @punctuation.special |
| 129 |
"}" @punctuation.special) @embedded |
| 130 |
["(" ")" "[" "]" "{" "}"] @punctuation.bracket |
| 131 |
|
| 132 |
[ |
| 133 |
"-" |
| 134 |
"-=" |
| 135 |
"!=" |
| 136 |
"*" |
| 137 |
"**" |
| 138 |
"**=" |
| 139 |
"*=" |
| 140 |
"/" |
| 141 |
"//" |
| 142 |
"//=" |
| 143 |
"/=" |
| 144 |
"&" |
| 145 |
"&=" |
| 146 |
"%" |
| 147 |
"%=" |
| 148 |
"^" |
| 149 |
"^=" |
| 150 |
"+" |
| 151 |
"->" |
| 152 |
"+=" |
| 153 |
"<" |
| 154 |
"<<" |
| 155 |
"<<=" |
| 156 |
"<=" |
| 157 |
"<>" |
| 158 |
"=" |
| 159 |
":=" |
| 160 |
"==" |
| 161 |
">" |
| 162 |
">=" |
| 163 |
">>" |
| 164 |
">>=" |
| 165 |
"|" |
| 166 |
"|=" |
| 167 |
"~" |
| 168 |
"@=" |
| 169 |
] @operator |
| 170 |
|
| 171 |
[ |
| 172 |
"as" |
| 173 |
"assert" |
| 174 |
"await" |
| 175 |
"from" |
| 176 |
"pass" |
| 177 |
"with" |
| 178 |
] @keyword.control |
| 179 |
|
| 180 |
[ |
| 181 |
"if" |
| 182 |
"elif" |
| 183 |
"else" |
| 184 |
"match" |
| 185 |
"case" |
| 186 |
] @keyword.control.conditional |
| 187 |
|
| 188 |
[ |
| 189 |
"while" |
| 190 |
"for" |
| 191 |
"break" |
| 192 |
"continue" |
| 193 |
] @keyword.control.repeat |
| 194 |
|
| 195 |
[ |
| 196 |
"return" |
| 197 |
"yield" |
| 198 |
] @keyword.control.return |
| 199 |
|
| 200 |
(yield "from" @keyword.control.return) |
| 201 |
|
| 202 |
[ |
| 203 |
"raise" |
| 204 |
"raises" |
| 205 |
"try" |
| 206 |
"except" |
| 207 |
"finally" |
| 208 |
] @keyword.control.exception |
| 209 |
|
| 210 |
(raise_statement "from" @keyword.control.exception) |
| 211 |
"import" @keyword.control.import |
| 212 |
|
| 213 |
(for_statement "in" @keyword.control) |
| 214 |
(for_in_clause "in" @keyword.control) |
| 215 |
|
| 216 |
[ |
| 217 |
"alias" |
| 218 |
"async" |
| 219 |
"class" |
| 220 |
"exec" |
| 221 |
"global" |
| 222 |
"nonlocal" |
| 223 |
"print" |
| 224 |
"struct" |
| 225 |
|
| 226 |
] @keyword |
| 227 |
|
| 228 |
[ |
| 229 |
"and" |
| 230 |
"or" |
| 231 |
"not in" |
| 232 |
"in" |
| 233 |
"not" |
| 234 |
"del" |
| 235 |
"is not" |
| 236 |
"is" |
| 237 |
] @keyword.operator |
| 238 |
|
| 239 |
"var" @keyword.storage |
| 240 |
|
| 241 |
[ |
| 242 |
"borrowed" |
| 243 |
"inout" |
| 244 |
"owned" |
| 245 |
] @keyword.storage.modifier |
| 246 |
|
| 247 |
((identifier) @type.builtin |
| 248 |
(#match? @type.builtin |
| 249 |
"^(BaseException|Exception|ArithmeticError|BufferError|LookupError|AssertionError|AttributeError|EOFError|FloatingPointError|GeneratorExit|ImportError|ModuleNotFoundError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|RecursionError|ReferenceError|RuntimeError|StopIteration|StopAsyncIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|ZeroDivisionError|EnvironmentError|IOError|WindowsError|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|Warning|UserWarning|DeprecationWarning|PendingDeprecationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning|BytesWarning|ResourceWarning)$")) |