diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-01-21 20:22:09 +0100 |
| commit | 5a8dbc6347b3541e84fe669b22c17ad3b715e258 (patch) | |
| tree | b148c450939688caaaeb4adac6f2faa1eaffe649 /queries/python.scm | |
| download | qwe-editor-5a8dbc6347b3541e84fe669b22c17ad3b715e258.tar.gz | |
Engage!
Diffstat (limited to 'queries/python.scm')
| -rw-r--r-- | queries/python.scm | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/queries/python.scm b/queries/python.scm new file mode 100644 index 0000000..94f28c5 --- /dev/null +++ b/queries/python.scm | |||
| @@ -0,0 +1,137 @@ | |||
| 1 | ; Identifier naming conventions | ||
| 2 | |||
| 3 | (identifier) @variable | ||
| 4 | |||
| 5 | ((identifier) @constructor | ||
| 6 | (#match? @constructor "^[A-Z]")) | ||
| 7 | |||
| 8 | ((identifier) @constant | ||
| 9 | (#match? @constant "^[A-Z][A-Z_]*$")) | ||
| 10 | |||
| 11 | ; Function calls | ||
| 12 | |||
| 13 | (decorator) @function | ||
| 14 | (decorator | ||
| 15 | (identifier) @function) | ||
| 16 | |||
| 17 | (call | ||
| 18 | function: (attribute attribute: (identifier) @function.method)) | ||
| 19 | (call | ||
| 20 | function: (identifier) @function) | ||
| 21 | |||
| 22 | ; Builtin functions | ||
| 23 | |||
| 24 | ((call | ||
| 25 | function: (identifier) @function.builtin) | ||
| 26 | (#match? | ||
| 27 | @function.builtin | ||
| 28 | "^(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__)$")) | ||
| 29 | |||
| 30 | ; Function definitions | ||
| 31 | |||
| 32 | (function_definition | ||
| 33 | name: (identifier) @function) | ||
| 34 | |||
| 35 | (attribute attribute: (identifier) @property) | ||
| 36 | (type (identifier) @type) | ||
| 37 | |||
| 38 | ; Literals | ||
| 39 | |||
| 40 | [ | ||
| 41 | (none) | ||
| 42 | (true) | ||
| 43 | (false) | ||
| 44 | ] @constant.builtin | ||
| 45 | |||
| 46 | [ | ||
| 47 | (integer) | ||
| 48 | (float) | ||
| 49 | ] @number | ||
| 50 | |||
| 51 | (comment) @comment | ||
| 52 | (string) @string | ||
| 53 | (escape_sequence) @escape | ||
| 54 | |||
| 55 | (interpolation | ||
| 56 | "{" @punctuation.special | ||
| 57 | "}" @punctuation.special) @embedded | ||
| 58 | |||
| 59 | [ | ||
| 60 | "-" | ||
| 61 | "-=" | ||
| 62 | "!=" | ||
| 63 | "*" | ||
| 64 | "**" | ||
| 65 | "**=" | ||
| 66 | "*=" | ||
| 67 | "/" | ||
| 68 | "//" | ||
| 69 | "//=" | ||
| 70 | "/=" | ||
| 71 | "&" | ||
| 72 | "&=" | ||
| 73 | "%" | ||
| 74 | "%=" | ||
| 75 | "^" | ||
| 76 | "^=" | ||
| 77 | "+" | ||
| 78 | "->" | ||
| 79 | "+=" | ||
| 80 | "<" | ||
| 81 | "<<" | ||
| 82 | "<<=" | ||
| 83 | "<=" | ||
| 84 | "<>" | ||
| 85 | "=" | ||
| 86 | ":=" | ||
| 87 | "==" | ||
| 88 | ">" | ||
| 89 | ">=" | ||
| 90 | ">>" | ||
| 91 | ">>=" | ||
| 92 | "|" | ||
| 93 | "|=" | ||
| 94 | "~" | ||
| 95 | "@=" | ||
| 96 | "and" | ||
| 97 | "in" | ||
| 98 | "is" | ||
| 99 | "not" | ||
| 100 | "or" | ||
| 101 | "is not" | ||
| 102 | "not in" | ||
| 103 | ] @operator | ||
| 104 | |||
| 105 | [ | ||
| 106 | "as" | ||
| 107 | "assert" | ||
| 108 | "async" | ||
| 109 | "await" | ||
| 110 | "break" | ||
| 111 | "class" | ||
| 112 | "continue" | ||
| 113 | "def" | ||
| 114 | "del" | ||
| 115 | "elif" | ||
| 116 | "else" | ||
| 117 | "except" | ||
| 118 | "exec" | ||
| 119 | "finally" | ||
| 120 | "for" | ||
| 121 | "from" | ||
| 122 | "global" | ||
| 123 | "if" | ||
| 124 | "import" | ||
| 125 | "lambda" | ||
| 126 | "nonlocal" | ||
| 127 | "pass" | ||
| 128 | "print" | ||
| 129 | "raise" | ||
| 130 | "return" | ||
| 131 | "try" | ||
| 132 | "while" | ||
| 133 | "with" | ||
| 134 | "yield" | ||
| 135 | "match" | ||
| 136 | "case" | ||
| 137 | ] @keyword \ No newline at end of file | ||
