diff options
| author | David Czihak <git@dcz.at> | 2026-05-07 14:33:19 +0200 |
|---|---|---|
| committer | David Czihak <git@dcz.at> | 2026-05-07 14:33:19 +0200 |
| commit | ddf2de739068b5ff0866ccb1d067f3cb53a4fc55 (patch) | |
| tree | 1a77efe9d73a6172be3c37d29b321eadd4efe379 /vendor/tree-sitter-zig/queries/highlights.scm | |
Initial commitv0.1.7
Diffstat (limited to 'vendor/tree-sitter-zig/queries/highlights.scm')
| -rw-r--r-- | vendor/tree-sitter-zig/queries/highlights.scm | 283 |
1 files changed, 283 insertions, 0 deletions
diff --git a/vendor/tree-sitter-zig/queries/highlights.scm b/vendor/tree-sitter-zig/queries/highlights.scm new file mode 100644 index 0000000..1f90067 --- /dev/null +++ b/vendor/tree-sitter-zig/queries/highlights.scm | |||
| @@ -0,0 +1,283 @@ | |||
| 1 | ; Variables | ||
| 2 | (identifier) @variable | ||
| 3 | |||
| 4 | ; Parameters | ||
| 5 | (parameter | ||
| 6 | name: (identifier) @variable.parameter) | ||
| 7 | |||
| 8 | (payload | ||
| 9 | (identifier) @variable.parameter) | ||
| 10 | |||
| 11 | ; Types | ||
| 12 | (parameter | ||
| 13 | type: (identifier) @type) | ||
| 14 | |||
| 15 | ((identifier) @type | ||
| 16 | (#lua-match? @type "^[A-Z_][a-zA-Z0-9_]*")) | ||
| 17 | |||
| 18 | (variable_declaration | ||
| 19 | (identifier) @type | ||
| 20 | "=" | ||
| 21 | [ | ||
| 22 | (struct_declaration) | ||
| 23 | (enum_declaration) | ||
| 24 | (union_declaration) | ||
| 25 | (opaque_declaration) | ||
| 26 | ]) | ||
| 27 | |||
| 28 | [ | ||
| 29 | (builtin_type) | ||
| 30 | "anyframe" | ||
| 31 | ] @type.builtin | ||
| 32 | |||
| 33 | ; Constants | ||
| 34 | ((identifier) @constant | ||
| 35 | (#lua-match? @constant "^[A-Z][A-Z_0-9]+$")) | ||
| 36 | |||
| 37 | [ | ||
| 38 | "null" | ||
| 39 | "unreachable" | ||
| 40 | "undefined" | ||
| 41 | ] @constant.builtin | ||
| 42 | |||
| 43 | (field_expression | ||
| 44 | . | ||
| 45 | member: (identifier) @constant) | ||
| 46 | |||
| 47 | (enum_declaration | ||
| 48 | (container_field | ||
| 49 | type: (identifier) @constant)) | ||
| 50 | |||
| 51 | ; Labels | ||
| 52 | (block_label | ||
| 53 | (identifier) @label) | ||
| 54 | |||
| 55 | (break_label | ||
| 56 | (identifier) @label) | ||
| 57 | |||
| 58 | ; Fields | ||
| 59 | (field_initializer | ||
| 60 | . | ||
| 61 | (identifier) @variable.member) | ||
| 62 | |||
| 63 | (field_expression | ||
| 64 | (_) | ||
| 65 | member: (identifier) @variable.member) | ||
| 66 | |||
| 67 | (container_field | ||
| 68 | name: (identifier) @variable.member) | ||
| 69 | |||
| 70 | (initializer_list | ||
| 71 | (assignment_expression | ||
| 72 | left: (field_expression | ||
| 73 | . | ||
| 74 | member: (identifier) @variable.member))) | ||
| 75 | |||
| 76 | ; Functions | ||
| 77 | (builtin_identifier) @function.builtin | ||
| 78 | |||
| 79 | (call_expression | ||
| 80 | function: (identifier) @function.call) | ||
| 81 | |||
| 82 | (call_expression | ||
| 83 | function: (field_expression | ||
| 84 | member: (identifier) @function.call)) | ||
| 85 | |||
| 86 | (function_declaration | ||
| 87 | name: (identifier) @function) | ||
| 88 | |||
| 89 | ; Modules | ||
| 90 | (variable_declaration | ||
| 91 | (identifier) @module | ||
| 92 | (builtin_function | ||
| 93 | (builtin_identifier) @keyword.import | ||
| 94 | (#any-of? @keyword.import "@import" "@cImport"))) | ||
| 95 | |||
| 96 | ; Builtins | ||
| 97 | [ | ||
| 98 | "c" | ||
| 99 | "..." | ||
| 100 | ] @variable.builtin | ||
| 101 | |||
| 102 | ((identifier) @variable.builtin | ||
| 103 | (#eq? @variable.builtin "_")) | ||
| 104 | |||
| 105 | (calling_convention | ||
| 106 | (identifier) @variable.builtin) | ||
| 107 | |||
| 108 | ; Keywords | ||
| 109 | [ | ||
| 110 | "asm" | ||
| 111 | "defer" | ||
| 112 | "errdefer" | ||
| 113 | "test" | ||
| 114 | "error" | ||
| 115 | "const" | ||
| 116 | "var" | ||
| 117 | ] @keyword | ||
| 118 | |||
| 119 | [ | ||
| 120 | "struct" | ||
| 121 | "union" | ||
| 122 | "enum" | ||
| 123 | "opaque" | ||
| 124 | ] @keyword.type | ||
| 125 | |||
| 126 | [ | ||
| 127 | "async" | ||
| 128 | "await" | ||
| 129 | "suspend" | ||
| 130 | "nosuspend" | ||
| 131 | "resume" | ||
| 132 | ] @keyword.coroutine | ||
| 133 | |||
| 134 | "fn" @keyword.function | ||
| 135 | |||
| 136 | [ | ||
| 137 | "and" | ||
| 138 | "or" | ||
| 139 | "orelse" | ||
| 140 | ] @keyword.operator | ||
| 141 | |||
| 142 | "return" @keyword.return | ||
| 143 | |||
| 144 | [ | ||
| 145 | "if" | ||
| 146 | "else" | ||
| 147 | "switch" | ||
| 148 | ] @keyword.conditional | ||
| 149 | |||
| 150 | [ | ||
| 151 | "for" | ||
| 152 | "while" | ||
| 153 | "break" | ||
| 154 | "continue" | ||
| 155 | ] @keyword.repeat | ||
| 156 | |||
| 157 | [ | ||
| 158 | "usingnamespace" | ||
| 159 | "export" | ||
| 160 | ] @keyword.import | ||
| 161 | |||
| 162 | [ | ||
| 163 | "try" | ||
| 164 | "catch" | ||
| 165 | ] @keyword.exception | ||
| 166 | |||
| 167 | [ | ||
| 168 | "volatile" | ||
| 169 | "allowzero" | ||
| 170 | "noalias" | ||
| 171 | "addrspace" | ||
| 172 | "align" | ||
| 173 | "callconv" | ||
| 174 | "linksection" | ||
| 175 | "pub" | ||
| 176 | "inline" | ||
| 177 | "noinline" | ||
| 178 | "extern" | ||
| 179 | "comptime" | ||
| 180 | "packed" | ||
| 181 | "threadlocal" | ||
| 182 | ] @keyword.modifier | ||
| 183 | |||
| 184 | ; Operator | ||
| 185 | [ | ||
| 186 | "=" | ||
| 187 | "*=" | ||
| 188 | "*%=" | ||
| 189 | "*|=" | ||
| 190 | "/=" | ||
| 191 | "%=" | ||
| 192 | "+=" | ||
| 193 | "+%=" | ||
| 194 | "+|=" | ||
| 195 | "-=" | ||
| 196 | "-%=" | ||
| 197 | "-|=" | ||
| 198 | "<<=" | ||
| 199 | "<<|=" | ||
| 200 | ">>=" | ||
| 201 | "&=" | ||
| 202 | "^=" | ||
| 203 | "|=" | ||
| 204 | "!" | ||
| 205 | "~" | ||
| 206 | "-" | ||
| 207 | "-%" | ||
| 208 | "&" | ||
| 209 | "==" | ||
| 210 | "!=" | ||
| 211 | ">" | ||
| 212 | ">=" | ||
| 213 | "<=" | ||
| 214 | "<" | ||
| 215 | "&" | ||
| 216 | "^" | ||
| 217 | "|" | ||
| 218 | "<<" | ||
| 219 | ">>" | ||
| 220 | "<<|" | ||
| 221 | "+" | ||
| 222 | "++" | ||
| 223 | "+%" | ||
| 224 | "-%" | ||
| 225 | "+|" | ||
| 226 | "-|" | ||
| 227 | "*" | ||
| 228 | "/" | ||
| 229 | "%" | ||
| 230 | "**" | ||
| 231 | "*%" | ||
| 232 | "*|" | ||
| 233 | "||" | ||
| 234 | ".*" | ||
| 235 | ".?" | ||
| 236 | "?" | ||
| 237 | ".." | ||
| 238 | ] @operator | ||
| 239 | |||
| 240 | ; Literals | ||
| 241 | (character) @character | ||
| 242 | |||
| 243 | ([ | ||
| 244 | (string) | ||
| 245 | (multiline_string) | ||
| 246 | ] @string | ||
| 247 | (#set! "priority" 95)) | ||
| 248 | |||
| 249 | (integer) @number | ||
| 250 | |||
| 251 | (float) @number.float | ||
| 252 | |||
| 253 | (boolean) @boolean | ||
| 254 | |||
| 255 | (escape_sequence) @string.escape | ||
| 256 | |||
| 257 | ; Punctuation | ||
| 258 | [ | ||
| 259 | "[" | ||
| 260 | "]" | ||
| 261 | "(" | ||
| 262 | ")" | ||
| 263 | "{" | ||
| 264 | "}" | ||
| 265 | ] @punctuation.bracket | ||
| 266 | |||
| 267 | [ | ||
| 268 | ";" | ||
| 269 | "." | ||
| 270 | "," | ||
| 271 | ":" | ||
| 272 | "=>" | ||
| 273 | "->" | ||
| 274 | ] @punctuation.delimiter | ||
| 275 | |||
| 276 | (payload | ||
| 277 | "|" @punctuation.bracket) | ||
| 278 | |||
| 279 | ; Comments | ||
| 280 | (comment) @comment @spell | ||
| 281 | |||
| 282 | ((comment) @comment.documentation | ||
| 283 | (#lua-match? @comment.documentation "^//!")) | ||
