Debian Codegraph @

runtime/queries/cython/highlights.scm

raw symbols SCIP
1 ; Punctuation
2
3 ["," "." ":" ";" (ellipsis)] @punctuation.delimiter
4 ["(" ")" "[" "]" "{" "}"] @punctuation.bracket
5 (interpolation
6 "{" @punctuation.special
7 "}" @punctuation.special)
8
9 ; Identifier naming conventions
10
11 (identifier) @variable
12
13 ((identifier) @constructor
14 (#match? @constructor "^[A-Z]"))
15
16 ((identifier) @constant
17 (#match? @constant "^[A-Z][A-Z_]*$"))
18
19 ; Member access. Placed before the call rules below so a method call
20 ; `obj.m()` is reclaimed as @function.method, while a plain `obj.attr`
21 ; access stays a member.
22 (attribute attribute: (identifier) @variable.other.member)
23
24 ; Function calls
25
26 (decorator) @function
27
28 (call
29 function: (attribute attribute: (identifier) @function.method))
30 (call
31 function: (identifier) @function)
32
33 ; Builtin functions
34
35 ((call
36 function: (identifier) @function.builtin)
37 (#any-of?
38 @function.builtin
39 "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__"))
40
41 ; Types
42
43 (maybe_typed_name
44 type: ((_) @type))
45
46 (type
47 (identifier) @type)
48
49 (c_type
50 type: ((_) @type))
51 (c_type
52 ((identifier) @type))
53 (c_type
54 ((int_type) @type))
55
56 (maybe_typed_name
57 name: ((identifier) @variable))
58
59 ; Function definitions
60
61 (function_definition
62 name: (identifier) @function)
63
64 (cdef_statement
65 (cvar_def
66 (maybe_typed_name
67 name: ((identifier) @function))
68 (c_function_definition)))
69
70 (cvar_decl
71 (c_type
72 ([(identifier) (int_type)]))
73 (c_name
74 ((identifier) @function))
75 (c_function_definition))
76
77 ; Literals
78
79 [
80 (none)
81 ] @constant.builtin
82
83 [
84 (true)
85 (false)
86 ] @constant.builtin.boolean
87
88 (integer) @constant.numeric.integer
89 (float) @constant.numeric.float
90
91 (comment) @comment
92 (string) @string
93 (escape_sequence) @constant.character.escape
94
95 (interpolation
96 "{" @punctuation.special
97 "}" @punctuation.special) @embedded
98
99 [
100 "-"
101 "-="
102 "!="
103 "*"
104 "**"
105 "**="
106 "*="
107 "/"
108 "//"
109 "//="
110 "/="
111 "&"
112 "&="
113 "%"
114 "%="
115 "^"
116 "^="
117 "+"
118 "->"
119 "+="
120 "<"
121 "<<"
122 "<<="
123 "<="
124 "<>"
125 "="
126 ":="
127 "=="
128 ">"
129 ">="
130 ">>"
131 ">>="
132 "|"
133 "|="
134 "~"
135 "@="
136 "and"
137 "in"
138 "is"
139 "not"
140 "or"
141 "@"
142 ] @operator
143
144 [
145 "as"
146 "assert"
147 "async"
148 "await"
149 "break"
150 "class"
151 "continue"
152 "def"
153 "del"
154 "elif"
155 "else"
156 "except"
157 "exec"
158 "finally"
159 "for"
160 "from"
161 "global"
162 "if"
163 "import"
164 "lambda"
165 "nonlocal"
166 "pass"
167 "print"
168 "raise"
169 "return"
170 "try"
171 "while"
172 "with"
173 "yield"
174 "match"
175 "case"
176
177 ; cython-specific
178 "cdef"
179 "cpdef"
180 "ctypedef"
181 "cimport"
182 "nogil"
183 "gil"
184 "extern"
185 "inline"
186 "public"
187 "readonly"
188 "struct"
189 "union"
190 "enum"
191 "fused"
192 "property"
193 "namespace"
194 "cppclass"
195 "const"
196 ] @keyword.control
197
198 (dotted_name
199 (identifier)* @namespace)
200
201 (aliased_import
202 alias: (identifier) @namespace)