Debian Codegraph @

runtime/queries/php/highlights.scm

raw symbols SCIP
1 (php_tag) @tag
2 (php_end_tag) @tag
3
4 ; Variables
5
6 (relative_scope) @variable.builtin
7
8 (variable_name) @variable
9
10 ((name) @constant
11 (#match? @constant "^_?[A-Z][A-Z\\d_]+$"))
12
13 ((name) @constructor
14 (#match? @constructor "^[A-Z]"))
15
16 ((name) @variable.builtin
17 (#eq? @variable.builtin "this"))
18
19 ; Types
20 [
21 (primitive_type)
22 (cast_type)
23 ] @type.builtin
24
25 (named_type
26 [ (name) @type
27 (qualified_name (name) @type)])
28
29 (base_clause
30 [ (name) @type
31 (qualified_name (name) @type)])
32
33 (enum_declaration
34 name: (name) @type.enum)
35
36 (interface_declaration
37 name: (name) @constructor)
38
39 (class_declaration
40 name: (name) @constructor)
41
42 (trait_declaration
43 name:(name) @constructor)
44
45 (namespace_definition
46 name: (namespace_name (name) @namespace))
47
48 (qualified_name
49 prefix: (namespace_name (name) @namespace))
50
51 (namespace_use_clause
52 [ (name) @namespace
53 (qualified_name (name) @type) ])
54
55 (namespace_use_clause
56 alias: (name) @namespace)
57
58 (class_interface_clause
59 [(name) @type
60 (qualified_name (name) @type)])
61
62 (scoped_call_expression
63 scope: [(name) @type
64 (qualified_name (name) @type)])
65
66 (class_constant_access_expression
67 . [(name) @constructor
68 (qualified_name (name) @constructor)]
69 (name) @constant)
70
71 (use_declaration (name) @type)
72
73 (binary_expression
74 operator: "instanceof"
75 right: [(name) @type
76 (qualified_name (name) @type)])
77
78 ; Superglobals
79 (subscript_expression
80 (variable_name(name) @constant.builtin
81 (#match? @constant.builtin "^_?[A-Z][A-Z\\d_]+$")))
82
83 ; Functions
84
85 (array_creation_expression "array" @function.builtin)
86 (list_literal "list" @function.builtin)
87
88 (method_declaration
89 name: (name) @function.method)
90
91 (function_call_expression
92 function: (_) @function)
93
94 (scoped_call_expression
95 name: (name) @function)
96
97 (member_call_expression
98 name: (name) @function.method)
99
100 (function_definition
101 name: (name) @function)
102
103 (nullsafe_member_call_expression
104 name: (name) @function.method)
105
106 (object_creation_expression
107 [(name) @constructor
108 (qualified_name (name) @constructor)])
109
110 ; Parameters
111 [
112 (simple_parameter)
113 (variadic_parameter)
114 ] @variable.parameter
115
116 (argument
117 (name) @variable.parameter)
118
119 ; Property hooks (PHP 8.4): the `get`/`set` accessor name parses as a plain
120 ; `name`; anchor to the first child so names inside the hook body aren't caught.
121 (property_hook . (name) @keyword)
122
123 ; Member
124
125 (property_element
126 (variable_name) @variable.other.member)
127
128 (member_access_expression
129 name: (variable_name (name)) @variable.other.member)
130 (member_access_expression
131 name: (name) @variable.other.member)
132
133 ; Attributes
134 (attribute_list) @attribute
135
136 ; Basic tokens
137
138 [
139 (string)
140 (encapsed_string)
141 (heredoc_body)
142 (nowdoc_body)
143 (shell_command_expression)
144 ] @string
145 (escape_sequence) @constant.character.escape
146
147 (boolean) @constant.builtin.boolean
148 (null) @constant.builtin
149 (integer) @constant.numeric.integer
150 (float) @constant.numeric.float
151 (comment) @comment
152
153 (goto_statement (name) @label)
154 (named_label_statement (name) @label)
155
156 ; Keywords
157
158 [
159 "default"
160 "echo"
161 "enum"
162 "extends"
163 "final"
164 "goto"
165 "global"
166 "implements"
167 "insteadof"
168 "new"
169 "print"
170 "private"
171 "protected"
172 "public"
173 "clone"
174 "unset"
175 ] @keyword
176
177 [
178 "if"
179 "else"
180 "elseif"
181 "endif"
182 "switch"
183 "endswitch"
184 "case"
185 "match"
186 "declare"
187 "enddeclare"
188 "??"
189 ] @keyword.control.conditional
190
191 [
192 "for"
193 "endfor"
194 "foreach"
195 "endforeach"
196 "while"
197 "endwhile"
198 "do"
199 ] @keyword.control.repeat
200
201 [
202
203 "include_once"
204 "include"
205 "require_once"
206 "require"
207 "use"
208 ] @keyword.control.import
209
210 [
211 "return"
212 "break"
213 "continue"
214 "yield"
215 "yield from"
216 ] @keyword.control.return
217
218 [
219 "throw"
220 "try"
221 "catch"
222 "finally"
223 ] @keyword.control.exception
224
225 [
226 "as"
227 "or"
228 "xor"
229 "and"
230 "instanceof"
231 ] @keyword.operator
232
233 [
234 "fn"
235 "function"
236 ] @keyword.function
237
238 [
239 "namespace"
240 "class"
241 "interface"
242 "trait"
243 "abstract"
244 ] @keyword.storage.type
245
246 [
247 "static"
248 "const"
249 "readonly"
250 ] @keyword.storage.modifier
251
252 [
253 ","
254 ";"
255 ":"
256 "\\"
257 ] @punctuation.delimiter
258
259 [
260 (php_tag)
261 (php_end_tag)
262 "("
263 ")"
264 "["
265 "]"
266 "{"
267 "}"
268 "#["
269 ] @punctuation.bracket
270
271 [
272 "="
273
274 "."
275 "-"
276 "*"
277 "/"
278 "+"
279 "%"
280 "**"
281
282 "~"
283 "|"
284 "^"
285 "&"
286 "<<"
287 ">>"
288
289 "->"
290 "?->"
291
292 "=>"
293
294 "<"
295 "<="
296 ">="
297 ">"
298 "<>"
299 "=="
300 "!="
301 "==="
302 "!=="
303
304 "!"
305 "&&"
306 "||"
307
308 ".="
309 "-="
310 "+="
311 "*="
312 "/="
313 "%="
314 "**="
315 "&="
316 "|="
317 "^="
318 "<<="
319 ">>="
320 "??="
321 "--"
322 "++"
323
324 "@"
325 "::"
326 ] @operator