| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
["," "." ":" ";" (ellipsis)] @punctuation.delimiter |
| 6 |
["(" ")" "[" "]" "{" "}"] @punctuation.bracket |
| 7 |
(interpolation |
| 8 |
"{" @punctuation.special |
| 9 |
"}" @punctuation.special) |
| 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 |
"~" |
| 51 |
"@=" |
| 52 |
] @operator |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
(identifier) @variable |
| 59 |
|
| 60 |
|
| 61 |
(attribute attribute: (identifier) @variable.other.member) |
| 62 |
|
| 63 |
|
| 64 |
(parameters (identifier) @variable.parameter) |
| 65 |
(parameters (typed_parameter (identifier) @variable.parameter)) |
| 66 |
(parameters (default_parameter name: (identifier) @variable.parameter)) |
| 67 |
(parameters (typed_default_parameter name: (identifier) @variable.parameter)) |
| 68 |
(parameters |
| 69 |
(list_splat_pattern |
| 70 |
(identifier) @variable.parameter)) |
| 71 |
(parameters |
| 72 |
(dictionary_splat_pattern |
| 73 |
(identifier) @variable.parameter)) |
| 74 |
|
| 75 |
(lambda_parameters |
| 76 |
(identifier) @variable.parameter) |
| 77 |
|
| 78 |
(keyword_argument |
| 79 |
name: (identifier) @variable.parameter) |
| 80 |
|
| 81 |
|
| 82 |
((identifier) @variable.builtin |
| 83 |
(#any-of? @variable.builtin "self" "cls")) |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
[ |
| 90 |
"async" |
| 91 |
"class" |
| 92 |
"exec" |
| 93 |
"global" |
| 94 |
"nonlocal" |
| 95 |
"print" |
| 96 |
"type" |
| 97 |
] @keyword |
| 98 |
|
| 99 |
|
| 100 |
[ |
| 101 |
"and" |
| 102 |
"or" |
| 103 |
"not in" |
| 104 |
"in" |
| 105 |
"not" |
| 106 |
"del" |
| 107 |
"is not" |
| 108 |
"is" |
| 109 |
] @keyword.operator |
| 110 |
|
| 111 |
|
| 112 |
[ |
| 113 |
"as" |
| 114 |
"assert" |
| 115 |
"await" |
| 116 |
"from" |
| 117 |
"pass" |
| 118 |
|
| 119 |
"with" |
| 120 |
] @keyword.control |
| 121 |
|
| 122 |
|
| 123 |
[ |
| 124 |
"if" |
| 125 |
"elif" |
| 126 |
"else" |
| 127 |
"match" |
| 128 |
"case" |
| 129 |
] @keyword.control.conditional |
| 130 |
|
| 131 |
|
| 132 |
[ |
| 133 |
"raise" |
| 134 |
"try" |
| 135 |
"except" |
| 136 |
"finally" |
| 137 |
] @keyword.control.exception |
| 138 |
(raise_statement "from" @keyword.control.exception) |
| 139 |
|
| 140 |
|
| 141 |
[ |
| 142 |
"def" |
| 143 |
"lambda" |
| 144 |
] @keyword.function |
| 145 |
|
| 146 |
|
| 147 |
"import" @keyword.control.import |
| 148 |
|
| 149 |
|
| 150 |
[ |
| 151 |
"while" |
| 152 |
"for" |
| 153 |
"break" |
| 154 |
"continue" |
| 155 |
] @keyword.control.repeat |
| 156 |
|
| 157 |
(for_statement "in" @keyword.control.repeat) |
| 158 |
(for_in_clause "in" @keyword.control.repeat) |
| 159 |
|
| 160 |
|
| 161 |
[ |
| 162 |
"return" |
| 163 |
"yield" |
| 164 |
] @keyword.control.return |
| 165 |
(yield "from" @keyword.control.return) |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
(dotted_name |
| 172 |
(identifier)* @namespace) |
| 173 |
|
| 174 |
(aliased_import |
| 175 |
alias: (identifier) @namespace) |
| 176 |
|
| 177 |
|
| 178 |
(none) @constant.builtin |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
((identifier) @type |
| 185 |
(#match? @type "^[A-Z]")) |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
(type [(identifier) (none)] @type) |
| 190 |
|
| 191 |
(type |
| 192 |
(_ [(identifier) (none)]? @type |
| 193 |
(_ [(identifier) (none)]? @type |
| 194 |
(_ [(identifier) (none)]? @type |
| 195 |
(_ [(identifier) (none)]? @type))))) |
| 196 |
|
| 197 |
|
| 198 |
(class_definition name: (identifier) @type) |
| 199 |
(class_definition superclasses: (argument_list (identifier) @type)) |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
(function_definition |
| 206 |
name: (identifier) @function) |
| 207 |
|
| 208 |
(call |
| 209 |
function: (identifier) @function) |
| 210 |
|
| 211 |
|
| 212 |
(decorator) @function |
| 213 |
(decorator (identifier) @function) |
| 214 |
(decorator (attribute attribute: (identifier) @function)) |
| 215 |
(decorator (call |
| 216 |
function: (attribute attribute: (identifier) @function))) |
| 217 |
|
| 218 |
|
| 219 |
(call |
| 220 |
function: (attribute attribute: (identifier) @function.method)) |
| 221 |
|
| 222 |
|
| 223 |
((call |
| 224 |
function: (identifier) @function.builtin) |
| 225 |
(#any-of? |
| 226 |
@function.builtin |
| 227 |
"abs" "all" "any" "ascii" "bin" "breakpoint" "bytearray" "callable" "chr" |
| 228 |
"classmethod" "compile" "complex" "delattr" "dir" "divmod" "enumerate" |
| 229 |
"eval" "exec" "filter" "format" "getattr" "globals" "hasattr" "hash" "help" |
| 230 |
"hex" "id" "input" "isinstance" "issubclass" "iter" "len" "locals" "map" |
| 231 |
"max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" |
| 232 |
"property" "range" "repr" "reversed" "round" "setattr" "slice" "sorted" |
| 233 |
"staticmethod" "sum" "super" "type" "vars" "zip" "__import__")) |
| 234 |
|
| 235 |
|
| 236 |
(call |
| 237 |
function: (attribute attribute: (identifier) @constructor) |
| 238 |
(#any-of? |
| 239 |
@constructor |
| 240 |
"__new__" "__init__")) |
| 241 |
|
| 242 |
((call |
| 243 |
function: (identifier) @constructor) |
| 244 |
(#any-of? |
| 245 |
@constructor |
| 246 |
"__new__" "__init__")) |
| 247 |
|
| 248 |
(function_definition |
| 249 |
name: (identifier) @constructor |
| 250 |
(#any-of? @constructor "__new__" "__init__")) |
| 251 |
|
| 252 |
(call |
| 253 |
function: (attribute attribute: (identifier) @constructor) |
| 254 |
(#match? @constructor "^[A-Z]")) |
| 255 |
(call |
| 256 |
function: (identifier) @constructor |
| 257 |
(#match? @constructor "^[A-Z]")) |
| 258 |
|
| 259 |
|
| 260 |
((identifier) @type.builtin |
| 261 |
(#any-of? |
| 262 |
@type.builtin |
| 263 |
"bool" "bytes" "dict" "float" "frozenset" "int" "list" "set" "str" "tuple")) |
| 264 |
|
| 265 |
|
| 266 |
((identifier) @type.builtin |
| 267 |
(#any-of? @type.builtin |
| 268 |
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" |
| 269 |
"AssertionError" "AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" |
| 270 |
"ImportError" "ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" |
| 271 |
"MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" |
| 272 |
"RecursionError" "ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" |
| 273 |
"SyntaxError" "IndentationError" "TabError" "SystemError" "SystemExit" "TypeError" |
| 274 |
"UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError" |
| 275 |
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" |
| 276 |
"IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError" |
| 277 |
"BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" |
| 278 |
"ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError" |
| 279 |
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" |
| 280 |
"TimeoutError" "Warning" "UserWarning" "DeprecationWarning" "PendingDeprecationWarning" |
| 281 |
"SyntaxWarning" "RuntimeWarning" "FutureWarning" "ImportWarning" "UnicodeWarning" |
| 282 |
"BytesWarning" "ResourceWarning")) |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
((identifier) @constant |
| 289 |
(#match? @constant "^_*[A-Z][A-Z\\d_]*$")) |
| 290 |
|
| 291 |
(escape_sequence) @constant.character.escape |
| 292 |
(escape_interpolation) @constant.character.escape |
| 293 |
|
| 294 |
[ |
| 295 |
(true) |
| 296 |
(false) |
| 297 |
] @constant.builtin.boolean |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
(integer) @constant.numeric.integer |
| 302 |
(float) @constant.numeric.float |
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
(comment) @comment |
| 309 |
(string) @string |
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
(type_alias_statement |
| 317 |
. (type (identifier) @type.definition)) |
| 318 |
|
| 319 |
|
| 320 |
((assignment |
| 321 |
left: (identifier) @type.definition |
| 322 |
right: (call |
| 323 |
function: (identifier) @_func)) |
| 324 |
(#any-of? @_func "TypeVar" "NewType" "ParamSpec" "TypeVarTuple")) |
| 325 |
|
| 326 |
|
| 327 |
((assignment |
| 328 |
left: (identifier) @type.definition |
| 329 |
type: (type (identifier) @_ann)) |
| 330 |
(#eq? @_ann "TypeAlias")) |