Debian Codegraph @

runtime/queries/c/highlights.scm

raw symbols SCIP
1 (identifier) @variable
2
3 ((identifier) @constant
4 (#match? @constant "^[A-Z][A-Z\\d_]*$"))
5
6 [
7 "sizeof"
8 "offsetof"
9 "alignof"
10 "_Alignof"
11 "asm"
12 "__asm__"
13 ] @keyword
14
15 [
16 "enum"
17 "struct"
18 "typedef"
19 "union"
20 ] @keyword.storage.type
21
22 [
23 (type_qualifier)
24 (storage_class_specifier)
25 ] @keyword.storage.modifier
26
27 [
28 "goto"
29 "break"
30 "continue"
31 ] @keyword.control
32
33 [
34 "do"
35 "for"
36 "while"
37 ] @keyword.control.repeat
38
39 [
40 "if"
41 "else"
42 "switch"
43 "case"
44 "default"
45 ] @keyword.control.conditional
46
47 "return" @keyword.control.return
48
49 [
50 "defined"
51 "#define"
52 "#elif"
53 "#else"
54 "#endif"
55 "#if"
56 "#ifdef"
57 "#ifndef"
58 "#elifdef"
59 "#elifndef"
60 "#include"
61 (preproc_directive)
62 ] @keyword.directive
63
64 "..." @punctuation
65
66 ["," "." ":" "::" ";" "->"] @punctuation.delimiter
67
68 ["(" ")" "[" "]" "{" "}" "[[" "]]"] @punctuation.bracket
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 "*="
97 "/="
98 "%="
99 "<<="
100 ">>="
101 "&="
102 "^="
103 "|="
104 "?"
105 ] @operator
106
107 (conditional_expression ":" @operator) ; After punctuation
108
109 (pointer_declarator "*" @type.builtin) ; After Operators
110 (abstract_pointer_declarator "*" @type.builtin)
111
112
113 [(true) (false)] @constant.builtin.boolean
114
115 ; C enumerators are integer constants; colour the definition the same as a use
116 ; site (a SCREAMING_SNAKE reference resolves to @constant above), not as a
117 ; distinct enum variant. C++ overrides this to keep @type.enum.variant.
118 (enumerator name: (identifier) @constant)
119
120 (string_literal) @string
121 (system_lib_string) @string
122
123 (null) @constant.builtin
124 (number_literal) @constant.numeric
125 (char_literal) @constant.character
126 (escape_sequence) @constant.character.escape
127
128 (field_identifier) @variable.other.member
129 (statement_identifier) @label
130 (type_identifier) @type
131 (primitive_type) @type.builtin
132 (sized_type_specifier) @type.builtin
133
134 ; `typedef ... Name;` — the introduced name
135 (type_definition
136 declarator: (type_identifier) @type.definition)
137
138 (call_expression
139 function: (identifier) @function)
140 (call_expression
141 function: (field_expression
142 field: (field_identifier) @function))
143 (call_expression (argument_list (identifier) @variable))
144 (function_declarator
145 declarator: [(identifier) (field_identifier)] @function)
146
147 ; GCC builtins, e.g. __builtin_expect
148 ((call_expression
149 function: (identifier) @function.builtin)
150 (#match? @function.builtin "^__builtin_"))
151
152 ; Up to 6 layers of declarators
153 (parameter_declaration
154 declarator: (identifier) @variable.parameter)
155 (parameter_declaration
156 (_
157 (identifier) @variable.parameter))
158 (parameter_declaration
159 (_
160 (_
161 (identifier) @variable.parameter)))
162 (parameter_declaration
163 (_
164 (_
165 (_
166 (identifier) @variable.parameter))))
167 (parameter_declaration
168 (_
169 (_
170 (_
171 (_
172 (identifier) @variable.parameter)))))
173 (parameter_declaration
174 (_
175 (_
176 (_
177 (_
178 (_
179 (identifier) @variable.parameter))))))
180
181 (preproc_function_def
182 name: (identifier) @function.special)
183
184 (attribute
185 name: (identifier) @attribute)
186
187 ; GNU / MSVC attributes and calling conventions
188 [
189 "__attribute__"
190 "__declspec"
191 "__based"
192 "__cdecl"
193 "__clrcall"
194 "__stdcall"
195 "__fastcall"
196 "__thiscall"
197 "__vectorcall"
198 ] @attribute
199
200 ; Builtin/predefined constants and macros.
201 ((identifier) @constant.builtin
202 (#any-of? @constant.builtin
203 "stderr" "stdin" "stdout"
204 "__FILE__" "__LINE__" "__DATE__" "__TIME__" "__func__"
205 "__FUNCTION__" "__PRETTY_FUNCTION__" "__BASE_FILE__"
206 "__STDC__" "__STDC_VERSION__" "__STDC_HOSTED__"
207 "__VA_ARGS__" "__VA_OPT__" "__cplusplus"))
208
209 (comment) @comment