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 /Queries | |
Initial commitv0.1.7
Diffstat (limited to 'Queries')
| -rw-r--r-- | Queries/arguments.scm | 3 | ||||
| -rw-r--r-- | Queries/folds.scm | 22 | ||||
| -rw-r--r-- | Queries/highlights.scm | 123 | ||||
| -rw-r--r-- | Queries/symbols.scm | 74 |
4 files changed, 222 insertions, 0 deletions
diff --git a/Queries/arguments.scm b/Queries/arguments.scm new file mode 100644 index 0000000..7824dba --- /dev/null +++ b/Queries/arguments.scm | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | (parameter | ||
| 2 | name: (identifier) @name | ||
| 3 | type: (_) @type) | ||
diff --git a/Queries/folds.scm b/Queries/folds.scm new file mode 100644 index 0000000..2275e5f --- /dev/null +++ b/Queries/folds.scm | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | [ | ||
| 2 | (block) | ||
| 3 | (switch_expression) | ||
| 4 | (initializer_list) | ||
| 5 | (asm_expression) | ||
| 6 | (multiline_string) | ||
| 7 | (if_statement) | ||
| 8 | (while_statement) | ||
| 9 | (for_statement) | ||
| 10 | (if_expression) | ||
| 11 | (else_clause) | ||
| 12 | (for_expression) | ||
| 13 | (while_expression) | ||
| 14 | (if_type_expression) | ||
| 15 | (function_signature) | ||
| 16 | (parameters) | ||
| 17 | (struct_declaration) | ||
| 18 | (opaque_declaration) | ||
| 19 | (enum_declaration) | ||
| 20 | (union_declaration) | ||
| 21 | (error_set_declaration) | ||
| 22 | ] @subtree | ||
diff --git a/Queries/highlights.scm b/Queries/highlights.scm new file mode 100644 index 0000000..b366bc7 --- /dev/null +++ b/Queries/highlights.scm | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | (comment) @comment | ||
| 2 | |||
| 3 | [ | ||
| 4 | (string) | ||
| 5 | (multiline_string) | ||
| 6 | (character) | ||
| 7 | ] @string | ||
| 8 | |||
| 9 | [ | ||
| 10 | (integer) | ||
| 11 | (float) | ||
| 12 | ] @value.number | ||
| 13 | |||
| 14 | [ | ||
| 15 | "true" | ||
| 16 | "false" | ||
| 17 | ] @value.boolean | ||
| 18 | |||
| 19 | [ | ||
| 20 | "null" | ||
| 21 | "undefined" | ||
| 22 | "unreachable" | ||
| 23 | ] @value.null | ||
| 24 | |||
| 25 | (builtin_type) @identifier.type | ||
| 26 | (builtin_identifier) @identifier.core | ||
| 27 | |||
| 28 | ((builtin_identifier) @processing | ||
| 29 | (#match? @processing "^@(import|cImport)$")) | ||
| 30 | |||
| 31 | ((identifier) @identifier.core | ||
| 32 | (#eq? @identifier.core "_")) | ||
| 33 | |||
| 34 | (parameter | ||
| 35 | name: (identifier) @identifier.argument) | ||
| 36 | |||
| 37 | (payload | ||
| 38 | (identifier) @identifier.argument) | ||
| 39 | |||
| 40 | (field_expression | ||
| 41 | member: (identifier) @identifier.property) | ||
| 42 | |||
| 43 | (field_initializer | ||
| 44 | (identifier) @identifier.property) | ||
| 45 | |||
| 46 | (function_declaration | ||
| 47 | name: (identifier) @identifier.function) | ||
| 48 | |||
| 49 | (call_expression | ||
| 50 | function: (identifier) @identifier.function) | ||
| 51 | |||
| 52 | (call_expression | ||
| 53 | function: (field_expression | ||
| 54 | member: (identifier) @identifier.function)) | ||
| 55 | |||
| 56 | ((identifier) @identifier.type | ||
| 57 | (#match? @identifier.type "^[A-Z][A-Za-z0-9_]*$")) | ||
| 58 | |||
| 59 | ((identifier) @identifier.constant | ||
| 60 | (#match? @identifier.constant "^[A-Z][A-Z0-9_]+$")) | ||
| 61 | |||
| 62 | [ | ||
| 63 | "asm" | ||
| 64 | "const" | ||
| 65 | "defer" | ||
| 66 | "errdefer" | ||
| 67 | "error" | ||
| 68 | "return" | ||
| 69 | "test" | ||
| 70 | "var" | ||
| 71 | ] @keyword | ||
| 72 | |||
| 73 | [ | ||
| 74 | "struct" | ||
| 75 | "union" | ||
| 76 | "enum" | ||
| 77 | "opaque" | ||
| 78 | "fn" | ||
| 79 | ] @keyword.construct | ||
| 80 | |||
| 81 | [ | ||
| 82 | "if" | ||
| 83 | "else" | ||
| 84 | "switch" | ||
| 85 | "for" | ||
| 86 | "while" | ||
| 87 | "try" | ||
| 88 | "catch" | ||
| 89 | "break" | ||
| 90 | "continue" | ||
| 91 | ] @keyword.condition | ||
| 92 | |||
| 93 | [ | ||
| 94 | "usingnamespace" | ||
| 95 | "export" | ||
| 96 | "comptime" | ||
| 97 | "inline" | ||
| 98 | "noinline" | ||
| 99 | "extern" | ||
| 100 | "pub" | ||
| 101 | "packed" | ||
| 102 | "threadlocal" | ||
| 103 | "volatile" | ||
| 104 | "allowzero" | ||
| 105 | "noalias" | ||
| 106 | "addrspace" | ||
| 107 | "align" | ||
| 108 | "callconv" | ||
| 109 | "linksection" | ||
| 110 | "async" | ||
| 111 | "await" | ||
| 112 | "suspend" | ||
| 113 | "nosuspend" | ||
| 114 | "resume" | ||
| 115 | ] @keyword.modifier | ||
| 116 | |||
| 117 | [ | ||
| 118 | "and" | ||
| 119 | "or" | ||
| 120 | "orelse" | ||
| 121 | ] @keyword.operator | ||
| 122 | |||
| 123 | (ERROR) @invalid | ||
diff --git a/Queries/symbols.scm b/Queries/symbols.scm new file mode 100644 index 0000000..5f903cb --- /dev/null +++ b/Queries/symbols.scm | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | ( | ||
| 2 | (function_declaration | ||
| 3 | name: (identifier) @name | ||
| 4 | (parameters) @arguments.target) @subtree | ||
| 5 | (#set! role function-or-method) | ||
| 6 | (#set! arguments.query "arguments.scm") | ||
| 7 | ) | ||
| 8 | |||
| 9 | ( | ||
| 10 | (variable_declaration | ||
| 11 | (identifier) @name | ||
| 12 | (struct_declaration)) @subtree | ||
| 13 | (#set! role struct) | ||
| 14 | ) | ||
| 15 | |||
| 16 | ( | ||
| 17 | (variable_declaration | ||
| 18 | (identifier) @name | ||
| 19 | (enum_declaration)) @subtree | ||
| 20 | (#set! role enum) | ||
| 21 | ) | ||
| 22 | |||
| 23 | ( | ||
| 24 | (variable_declaration | ||
| 25 | (identifier) @name | ||
| 26 | (union_declaration)) @subtree | ||
| 27 | (#set! role struct) | ||
| 28 | ) | ||
| 29 | |||
| 30 | ( | ||
| 31 | (variable_declaration | ||
| 32 | (identifier) @name | ||
| 33 | (opaque_declaration)) @subtree | ||
| 34 | (#set! role struct) | ||
| 35 | ) | ||
| 36 | |||
| 37 | ( | ||
| 38 | (variable_declaration | ||
| 39 | (identifier) @name | ||
| 40 | (error_set_declaration)) @subtree | ||
| 41 | (#set! role enum) | ||
| 42 | ) | ||
| 43 | |||
| 44 | ( | ||
| 45 | (container_field | ||
| 46 | name: (identifier) @name) @subtree | ||
| 47 | (#set! role property) | ||
| 48 | ) | ||
| 49 | |||
| 50 | ( | ||
| 51 | (container_field | ||
| 52 | name: (primary_type_expression | ||
| 53 | (identifier) @name)) @subtree | ||
| 54 | (#set! role property) | ||
| 55 | ) | ||
| 56 | |||
| 57 | ( | ||
| 58 | (test_declaration | ||
| 59 | (string) @name @displayname) @subtree | ||
| 60 | (#set! role function) | ||
| 61 | ) | ||
| 62 | |||
| 63 | ( | ||
| 64 | (test_declaration | ||
| 65 | (identifier) @name @displayname) @subtree | ||
| 66 | (#set! role function) | ||
| 67 | ) | ||
| 68 | |||
| 69 | ( | ||
| 70 | (block | ||
| 71 | (variable_declaration | ||
| 72 | (identifier) @name) @subtree) | ||
| 73 | (#set! role variable) | ||
| 74 | ) | ||
