@willbooster/tree-sitter-zig 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,75 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-zig",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Zig grammar for tree-sitter",
5
+ "keywords": [
6
+ "incremental",
7
+ "parsing",
8
+ "tree-sitter",
9
+ "zig"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/WillBooster/tree-sitter-zig.git"
14
+ },
15
+ "license": "MIT",
16
+ "author": "WillBooster Inc.",
17
+ "files": [
18
+ "grammar.js",
19
+ "queries/*.scm",
20
+ "src/node-types.json",
21
+ "tree-sitter.json",
22
+ "*.wasm"
23
+ ],
24
+ "scripts": {
25
+ "build-wasm": "script/generate --build-wasm",
26
+ "build/ci": "bun run build-wasm",
27
+ "cleanup": "bun wb lint --fix --format",
28
+ "format": "bun wb lint --format",
29
+ "generate": "script/generate",
30
+ "lint": "bun wb lint",
31
+ "lint-fix": "bun wb lint --fix",
32
+ "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
33
+ "release": "wb release",
34
+ "prestart": "bun run build-wasm",
35
+ "start": "script/tree-sitter playground",
36
+ "test": "bun wb test",
37
+ "test/ci": "bun wb test-on-ci",
38
+ "test/ci-setup": "playwright install --with-deps chromium",
39
+ "typecheck": "bun wb typecheck",
40
+ "verify": "bun wb verify",
41
+ "verify-full": "bun wb verify --full"
42
+ },
43
+ "devDependencies": {
44
+ "@tsconfig/bun": "1.0.11",
45
+ "@types/bun": "1.4.2",
46
+ "@vitest/browser-playwright": "5.0.3",
47
+ "@willbooster/oxfmt-config": "1.2.2",
48
+ "@willbooster/oxlint-config": "1.4.8",
49
+ "@willbooster/wb": "22.24.0",
50
+ "@willbooster/web-tree-sitter": "2.0.1",
51
+ "conventional-changelog-conventionalcommits": "10.4.0",
52
+ "lefthook": "2.1.16",
53
+ "oxfmt": "0.71.0",
54
+ "oxlint": "1.86.0",
55
+ "oxlint-tsgolint": "7.0.2003",
56
+ "playwright": "1.63.0",
57
+ "semantic-release": "25.0.9",
58
+ "sort-package-json": "4.0.0",
59
+ "typescript": "7.0.2",
60
+ "vitest": "5.0.3",
61
+ "wrangler": "4.147.0"
62
+ },
63
+ "peerDependencies": {
64
+ "@willbooster/web-tree-sitter": "^2.0.0"
65
+ },
66
+ "peerDependenciesMeta": {
67
+ "@willbooster/web-tree-sitter": {
68
+ "optional": true
69
+ }
70
+ },
71
+ "publishConfig": {
72
+ "access": "public",
73
+ "registry": "https://registry.npmjs.org/"
74
+ }
75
+ }
@@ -0,0 +1,23 @@
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
+ ] @fold
23
+
@@ -0,0 +1,291 @@
1
+ ; Variables
2
+
3
+ (identifier) @variable
4
+
5
+ ; Parameters
6
+
7
+ (parameter
8
+ name: (identifier) @variable.parameter)
9
+
10
+ ; Types
11
+
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
+
35
+ ((identifier) @constant
36
+ (#lua-match? @constant "^[A-Z][A-Z_0-9]+$"))
37
+
38
+ [
39
+ "null"
40
+ "unreachable"
41
+ "undefined"
42
+ ] @constant.builtin
43
+
44
+ (field_expression
45
+ .
46
+ member: (identifier) @constant)
47
+
48
+ (enum_declaration
49
+ (container_field
50
+ type: (identifier) @constant))
51
+
52
+ ; Labels
53
+
54
+ (block_label (identifier) @label)
55
+
56
+ (break_label (identifier) @label)
57
+
58
+ ; Fields
59
+
60
+ (field_initializer
61
+ .
62
+ (identifier) @variable.member)
63
+
64
+ (field_expression
65
+ (_)
66
+ member: (identifier) @variable.member)
67
+
68
+ (container_field
69
+ name: (identifier) @variable.member)
70
+
71
+ (initializer_list
72
+ (assignment_expression
73
+ left: (field_expression
74
+ .
75
+ member: (identifier) @variable.member)))
76
+
77
+ ; Functions
78
+
79
+ (builtin_identifier) @function.builtin
80
+
81
+ (call_expression
82
+ function: (identifier) @function.call)
83
+
84
+ (call_expression
85
+ function: (field_expression
86
+ member: (identifier) @function.call))
87
+
88
+ (function_declaration
89
+ name: (identifier) @function)
90
+
91
+ ; Modules
92
+
93
+ (variable_declaration
94
+ (identifier) @module
95
+ (builtin_function
96
+ (builtin_identifier) @keyword.import
97
+ (#any-of? @keyword.import "@import" "@cImport")))
98
+
99
+ ; Builtins
100
+
101
+ [
102
+ "c"
103
+ "..."
104
+ ] @variable.builtin
105
+
106
+ ((identifier) @variable.builtin
107
+ (#eq? @variable.builtin "_"))
108
+
109
+ (calling_convention
110
+ (identifier) @variable.builtin)
111
+
112
+ ; Keywords
113
+
114
+ [
115
+ "asm"
116
+ "defer"
117
+ "errdefer"
118
+ "test"
119
+ "error"
120
+ "const"
121
+ "var"
122
+ ] @keyword
123
+
124
+ [
125
+ "struct"
126
+ "union"
127
+ "enum"
128
+ "opaque"
129
+ ] @keyword.type
130
+
131
+ [
132
+ "async"
133
+ "await"
134
+ "suspend"
135
+ "nosuspend"
136
+ "resume"
137
+ ] @keyword.coroutine
138
+
139
+ "fn" @keyword.function
140
+
141
+ [
142
+ "and"
143
+ "or"
144
+ "orelse"
145
+ ] @keyword.operator
146
+
147
+ "return" @keyword.return
148
+
149
+ [
150
+ "if"
151
+ "else"
152
+ "switch"
153
+ ] @keyword.conditional
154
+
155
+ [
156
+ "for"
157
+ "while"
158
+ "break"
159
+ "continue"
160
+ ] @keyword.repeat
161
+
162
+ [
163
+ "usingnamespace"
164
+ "export"
165
+ ] @keyword.import
166
+
167
+ [
168
+ "try"
169
+ "catch"
170
+ ] @keyword.exception
171
+
172
+ [
173
+ "volatile"
174
+ "allowzero"
175
+ "noalias"
176
+ "addrspace"
177
+ "align"
178
+ "callconv"
179
+ "linksection"
180
+ "pub"
181
+ "inline"
182
+ "noinline"
183
+ "extern"
184
+ "comptime"
185
+ "packed"
186
+ "threadlocal"
187
+ ] @keyword.modifier
188
+
189
+ ; Operator
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
+ "*|"
239
+ "||"
240
+ ".*"
241
+ ".?"
242
+ "?"
243
+ ".."
244
+ ] @operator
245
+
246
+ ; Literals
247
+
248
+ (character) @character
249
+
250
+ ([
251
+ (string)
252
+ (multiline_string)
253
+ ] @string
254
+ (#set! "priority" 95))
255
+
256
+ (integer) @number
257
+
258
+ (float) @number.float
259
+
260
+ (boolean) @boolean
261
+
262
+ (escape_sequence) @string.escape
263
+
264
+ ; Punctuation
265
+
266
+ [
267
+ "["
268
+ "]"
269
+ "("
270
+ ")"
271
+ "{"
272
+ "}"
273
+ ] @punctuation.bracket
274
+
275
+ [
276
+ ";"
277
+ "."
278
+ ","
279
+ ":"
280
+ "=>"
281
+ "->"
282
+ ] @punctuation.delimiter
283
+
284
+ (payload "|" @punctuation.bracket)
285
+
286
+ ; Comments
287
+
288
+ (comment) @comment @spell
289
+
290
+ ((comment) @comment.documentation
291
+ (#lua-match? @comment.documentation "^//!"))
@@ -0,0 +1,22 @@
1
+ [
2
+ (block)
3
+ (switch_expression)
4
+ (initializer_list)
5
+ ] @indent.begin
6
+
7
+ (block
8
+ "}" @indent.end)
9
+
10
+ [
11
+ "("
12
+ ")"
13
+ "["
14
+ "]"
15
+ "{"
16
+ "}"
17
+ ] @indent.branch
18
+
19
+ [
20
+ (comment)
21
+ (multiline_string)
22
+ ] @indent.ignore
@@ -0,0 +1,10 @@
1
+ ((comment) @injection.content
2
+ (#set! injection.language "comment"))
3
+
4
+ ; TODO: add when asm is added
5
+ ; (asm_output_item (string) @injection.content
6
+ ; (#set! injection.language "asm"))
7
+ ; (asm_input_item (string) @injection.content
8
+ ; (#set! injection.language "asm"))
9
+ ; (asm_clobbers (string) @injection.content
10
+ ; (#set! injection.language "asm"))