Debian Codegraph @

runtime/queries/sourcepawn/highlights.scm

raw symbols SCIP
1 (identifier) @variable
2
3 ; Assume all-caps names are constants
4 ((identifier) @constant
5 (#match? @constant "^[A-Z][A-Z\\d_]+$'"))
6
7 ; Function definitions/declarations
8 (function_definition
9 name: (identifier) @function)
10 (function_declaration
11 name: (identifier) @function)
12 (parameter_declaration
13 name: (identifier) @variable.parameter)
14
15 ; Methods / Properties
16 (field_access
17 field: (identifier) @variable.other.member)
18
19 ; Function calls
20 (call_expression
21 function: (identifier) @function)
22 (call_expression
23 function: (field_access
24 field: (identifier) @function))
25
26 ; Types
27 (builtin_type) @type.builtin
28 (type (identifier) @type)
29 (any_type) @type
30
31 ; Variables
32 (variable_storage_class) @keyword.storage
33 (variable_declaration
34 name: (identifier) @variable)
35 (old_variable_declaration
36 name: (identifier) @variable)
37
38 ; Preprocessor
39 (preproc_include) @keyword.control.import
40 (preproc_tryinclude) @keyword.control.import
41 (system_lib_string) @string
42 (string_literal) @string
43
44 (preproc_assert) @keyword.directive
45 (preproc_pragma) @keyword.directive
46 (preproc_arg) @constant
47 (preproc_macro) @function.macro
48 (macro_param) @variable.parameter
49 (preproc_if) @keyword.directive
50 (preproc_else) @keyword.directive
51 (preproc_elseif) @keyword.directive
52 (preproc_endif) @keyword.directive
53 (preproc_endinput) @keyword.directive
54 (preproc_define) @keyword.directive
55 (preproc_define
56 name: (identifier) @constant)
57 (preproc_undefine) @keyword.directive
58 (preproc_undefine
59 name: (identifier) @constant)
60 (preproc_error) @function.macro ; Wrong color?
61 (preproc_warning) @function.macro ; Wrong color?
62
63 ; Statements
64 (for_statement) @keyword.control.repeat
65 (condition_statement) @keyword.control.conditional
66 (while_statement) @keyword.control.repeat
67 (do_while_statement) @keyword.control.repeat
68 (switch_statement) @keyword.control.conditional
69 (switch_case) @keyword.control.conditional
70 (ternary_expression ["?" ":"] @operator)
71
72 ; Expressions
73 (view_as) @function.builtin
74 (sizeof_expression) @function.macro
75 (this) @variable.builtin
76
77 ; https://github.com/alliedmodders/sourcemod/blob/5c0ae11a4619e9cba93478683c7737253ea93ba6/plugins/include/handles.inc#L78
78 (hardcoded_symbol) @variable.builtin
79
80 ; Comments
81 (comment) @comment
82
83 ; General
84 (parameter_declaration
85 defaultValue: (identifier) @constant)
86 (fixed_dimension) @punctuation.bracket ; the [3] in var[3]
87 (dimension) @punctuation.bracket
88 (array_indexed_access) @punctuation.bracket
89 (escape_sequence) @constant.character.escape
90
91 ; Constructors
92 (new_expression
93 class: (identifier) @type
94 arguments: (call_arguments) @constructor)
95
96 ; Methodmaps
97 (methodmap) @type.definition
98 (methodmap
99 name: (identifier) @type)
100 (methodmap
101 inherits: (identifier) @type)
102 (methodmap_method_constructor
103 name: (identifier) @constructor)
104 (methodmap_method
105 name: (identifier) @function.method)
106 (methodmap_native
107 name: (identifier) @function.method)
108 (methodmap_property
109 name: (identifier) @variable.other.member)
110 (methodmap_property_getter) @function.method
111 (methodmap_property_setter) @function.method
112
113 ; Enum structs
114 (enum_struct) @type.enum.variant
115 (enum_struct
116 name: (identifier) @type)
117 (enum_struct_field
118 name: (identifier) @variable.other.member)
119 (enum_struct_method
120 name: (identifier) @function.method)
121
122 ; Non-type Keywords
123 (variable_storage_class) @keyword.storage
124 (visibility) @keyword.storage
125 (visibility) @keyword.storage
126 (assertion) @function.builtin
127 (function_declaration_kind) @keyword.function
128 [
129 "new"
130 "delete"
131 ] @keyword.operator
132 [
133 "."
134 ","
135 ] @punctuation.delimiter
136
137 ; Operators
138 [
139 "+"
140 "-"
141 "..."
142 "*"
143 "/"
144 "%"
145 "++"
146 "--"
147 "="
148 "+="
149 "-="
150 "*="
151 "/="
152 "=="
153 "!="
154 "<"
155 ">"
156 ">="
157 "<="
158 "!"
159 "&&"
160 "||"
161 "&"
162 "|"
163 "~"
164 "^"
165 "<<"
166 ">>"
167 ">>>"
168 "|="
169 "&="
170 "^="
171 "~="
172 "<<="
173 ">>="
174 ] @operator
175 (ignore_argument) @operator
176 (scope_access) @operator
177 (rest_operator) @operator
178
179 ; public Plugin myinfo
180 (struct_declaration
181 name: (identifier) @variable.builtin)
182
183 ; Typedef/Typedef
184 (typeset) @type.builtin
185 (typedef) @type.builtin
186 (functag) @type.builtin
187 (funcenum) @type.builtin
188 (typedef_expression) @keyword.function ; function void(int x)
189
190 ; Enums
191 (enum) @type.enum
192 (enum
193 name: (identifier) @type)
194 (enum_entry
195 name: (identifier) @constant)
196 (enum_entry
197 value: (_) @constant)
198
199 ; Literals
200 (int_literal) @constant.numeric.integer
201 (char_literal) @constant.character
202 (float_literal) @constant.numeric.float
203 (string_literal) @string
204 (array_literal) @punctuation.bracket
205 (null) @constant.builtin
206 (bool_literal) @constant.builtin.boolean
207 ((identifier) @constant
208 (#match? @constant "INVALID_HANDLE"))
209
210 ; Comment specialisations (must be after comment)
211 ; These might be unnecessary and/or used incorrectly, since they're intended
212 ; for markup languages
213 ((comment) @diff.plus
214 (#match? @diff.plus "^\/[\/\*][\t ]TODO"))
215 ((comment) @diff.plus
216 (#match? @diff.plus "^\/[\/\*][\t ]NOTE"))
217 ((comment) @diff.minus
218 (#match? @diff.minus "^\/[\/\*][\t ]WARNING"))
219
220 ; Keywords
221 [
222 "__nullable__"
223 "break"
224 "case"
225 "const"
226 "continue"
227 "default"
228 "delete"
229 "do"
230 "else"
231 "enum"
232 "for"
233 "forward"
234 "funcenum"
235 "functag"
236 "get"
237 "if"
238 "methodmap"
239 "native"
240 "new"
241 "property"
242 "public"
243 "return"
244 "set"
245 "static"
246 "stock"
247 "struct"
248 "switch"
249 "typedef"
250 "typeset"
251 "void"
252 "while"
253 ] @keyword
254