tree-sitter-sh 0.1.0 → 0.2.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,11 +1,12 @@
1
1
  {
2
2
  "name": "tree-sitter-sh",
3
- "version": "0.1.0",
4
- "description": "A Tree-sitter grammar for POSIX sh.",
3
+ "version": "0.2.0",
4
+ "description": "Tree-sitter grammar for POSIX sh.",
5
5
  "license": "MIT",
6
6
  "repository": "git+https://github.com/konomanoasa/tree-sitter-sh.git",
7
7
  "files": [
8
8
  "grammar.js",
9
+ "queries/*.scm",
9
10
  "src/*.c",
10
11
  "src/*.json",
11
12
  "src/tree_sitter/*.h",
@@ -15,7 +16,7 @@
15
16
  "check": "biome check . && node scripts/check-scanner.js && node scripts/check-generated.js && npm test",
16
17
  "format": "biome check --write . && node scripts/check-scanner.js --write",
17
18
  "generate": "npm run tree-sitter -- generate",
18
- "test": "npm run tree-sitter -- test --rebuild && node --test test/parser.test.js",
19
+ "test": "npm run tree-sitter -- test --rebuild && node --test",
19
20
  "test:fuzz": "npm run tree-sitter -- fuzz --rebuild --iterations 100 --edits 5",
20
21
  "tree-sitter": "node scripts/tree-sitter.js"
21
22
  },
@@ -0,0 +1,491 @@
1
+ [
2
+ (literal)
3
+ (single_quote_content)
4
+ (double_quote_text)
5
+ (dollar_single_quote_text)
6
+ (here_document_text)
7
+ (quoted_here_document_text)
8
+ ] @string
9
+
10
+ [
11
+ (escaped_character)
12
+ (double_quote_escape)
13
+ (dollar_single_quote_escape)
14
+ (here_document_escape)
15
+ ] @string.escape
16
+
17
+ (comment) @comment
18
+
19
+ (line_continuation) @punctuation.special
20
+
21
+ [
22
+ (arithmetic_number)
23
+ (io_number)
24
+ ] @number
25
+
26
+ [
27
+ (arithmetic_variable)
28
+ (variable_name)
29
+ (name)
30
+ (io_location)
31
+ ] @variable
32
+
33
+ (positional_parameter) @variable.parameter
34
+
35
+ (special_parameter) @variable.builtin
36
+
37
+ (fname) @function
38
+
39
+ [
40
+ (if_keyword)
41
+ (then_keyword)
42
+ (elif_keyword)
43
+ (else_keyword)
44
+ (fi_keyword)
45
+ (for_keyword)
46
+ (in_keyword)
47
+ (do_keyword)
48
+ (done_keyword)
49
+ (case_keyword)
50
+ (esac_keyword)
51
+ (while_keyword)
52
+ (until_keyword)
53
+ ] @keyword
54
+
55
+ [
56
+ (arithmetic_operator)
57
+ (parameter_length_operator)
58
+ (parameter_value_operator)
59
+ (parameter_pattern_operator)
60
+ (and_if)
61
+ (or_if)
62
+ (bang)
63
+ (dsemi)
64
+ (semi_and)
65
+ ] @operator
66
+
67
+ [
68
+ (lessand)
69
+ (greatand)
70
+ (dgreat)
71
+ (lessgreat)
72
+ (clobber)
73
+ (dless)
74
+ (dlessdash)
75
+ ] @operator
76
+
77
+ (io_file
78
+ operator: [
79
+ "<"
80
+ ">"
81
+ ] @operator)
82
+
83
+ (assignment_word
84
+ "=" @operator)
85
+
86
+ [
87
+ "&"
88
+ "|"
89
+ ] @operator
90
+
91
+ ";" @punctuation.delimiter
92
+
93
+ [
94
+ "("
95
+ ")"
96
+ "{"
97
+ "}"
98
+ "$("
99
+ "${"
100
+ ] @punctuation.bracket
101
+
102
+ (parameter_expansion
103
+ "$" @constant)
104
+
105
+ (single_quoted
106
+ "'" @punctuation.delimiter)
107
+
108
+ (double_quoted
109
+ "\"" @punctuation.delimiter)
110
+
111
+ (dollar_single_quoted
112
+ [
113
+ "$'"
114
+ "'"
115
+ ] @punctuation.delimiter)
116
+
117
+ (backquote_substitution
118
+ "`" @punctuation.delimiter)
119
+
120
+ (tilde_expansion
121
+ "~" @string.special.path)
122
+
123
+ (tilde_expansion
124
+ user: (tilde_user
125
+ (literal) @string.special.path))
126
+
127
+ (here_end
128
+ word: (word
129
+ (literal) @label))
130
+
131
+ (here_end
132
+ word: (word
133
+ (single_quoted
134
+ (single_quote_content) @label)))
135
+
136
+ (here_end
137
+ word: (word
138
+ (double_quoted
139
+ (double_quote_text) @label)))
140
+
141
+ (here_document_end) @label
142
+
143
+ (cmd_name
144
+ (word
145
+ (literal) @function.call))
146
+
147
+ (cmd_word
148
+ (word
149
+ (literal) @function.call))
150
+
151
+ (parameter_pattern
152
+ [
153
+ (literal) @string.regexp
154
+ (pattern_star_source) @character.special
155
+ (pattern_question_source) @character.special
156
+ ])
157
+
158
+ (pattern_list
159
+ (word
160
+ [
161
+ (literal) @string.regexp
162
+ (pattern_star_source) @character.special
163
+ (pattern_question_source) @character.special
164
+ ]))
165
+
166
+ (cmd_name
167
+ (word
168
+ [
169
+ (pattern_star_source) @character.special
170
+ (pattern_question_source) @character.special
171
+ ]))
172
+
173
+ (cmd_word
174
+ (word
175
+ [
176
+ (pattern_star_source) @character.special
177
+ (pattern_question_source) @character.special
178
+ ]))
179
+
180
+ (cmd_suffix
181
+ word: (word
182
+ [
183
+ (pattern_star_source) @character.special
184
+ (pattern_question_source) @character.special
185
+ ]))
186
+
187
+ (wordlist
188
+ word: (word
189
+ [
190
+ (pattern_star_source) @character.special
191
+ (pattern_question_source) @character.special
192
+ ]))
193
+
194
+ (filename
195
+ word: (word
196
+ [
197
+ (pattern_star_source) @character.special
198
+ (pattern_question_source) @character.special
199
+ ]))
200
+
201
+ [
202
+ (cmd_name
203
+ (word
204
+ (literal) @string.regexp
205
+ [
206
+ (pattern_star_source)
207
+ (pattern_question_source)
208
+ (pattern_bracket_source)
209
+ ]))
210
+ (cmd_name
211
+ (word
212
+ [
213
+ (pattern_star_source)
214
+ (pattern_question_source)
215
+ (pattern_bracket_source)
216
+ ]
217
+ (literal) @string.regexp))
218
+ (cmd_word
219
+ (word
220
+ (literal) @string.regexp
221
+ [
222
+ (pattern_star_source)
223
+ (pattern_question_source)
224
+ (pattern_bracket_source)
225
+ ]))
226
+ (cmd_word
227
+ (word
228
+ [
229
+ (pattern_star_source)
230
+ (pattern_question_source)
231
+ (pattern_bracket_source)
232
+ ]
233
+ (literal) @string.regexp))
234
+ (cmd_suffix
235
+ word: (word
236
+ (literal) @string.regexp
237
+ [
238
+ (pattern_star_source)
239
+ (pattern_question_source)
240
+ (pattern_bracket_source)
241
+ ]))
242
+ (cmd_suffix
243
+ word: (word
244
+ [
245
+ (pattern_star_source)
246
+ (pattern_question_source)
247
+ (pattern_bracket_source)
248
+ ]
249
+ (literal) @string.regexp))
250
+ (wordlist
251
+ word: (word
252
+ (literal) @string.regexp
253
+ [
254
+ (pattern_star_source)
255
+ (pattern_question_source)
256
+ (pattern_bracket_source)
257
+ ]))
258
+ (wordlist
259
+ word: (word
260
+ [
261
+ (pattern_star_source)
262
+ (pattern_question_source)
263
+ (pattern_bracket_source)
264
+ ]
265
+ (literal) @string.regexp))
266
+ (filename
267
+ word: (word
268
+ (literal) @string.regexp
269
+ [
270
+ (pattern_star_source)
271
+ (pattern_question_source)
272
+ (pattern_bracket_source)
273
+ ]))
274
+ (filename
275
+ word: (word
276
+ [
277
+ (pattern_star_source)
278
+ (pattern_question_source)
279
+ (pattern_bracket_source)
280
+ ]
281
+ (literal) @string.regexp))
282
+ ]
283
+
284
+ (pattern_list
285
+ (word
286
+ (pattern_bracket_source
287
+ "[" @punctuation.bracket
288
+ (pattern_bracket_negation_source)? @punctuation.special
289
+ (pattern_bracket_members_source
290
+ [
291
+ (pattern_bracket_character_source) @character
292
+ (pattern_bracket_hyphen_source) @character
293
+ (pattern_bracket_range_source
294
+ start: [
295
+ (pattern_bracket_character_source)
296
+ (pattern_bracket_hyphen_source)
297
+ ] @character
298
+ operator: (pattern_bracket_range_operator_source) @punctuation.special
299
+ end: [
300
+ (pattern_bracket_character_source)
301
+ (pattern_bracket_hyphen_source)
302
+ ] @character)
303
+ (pattern_character_class_source
304
+ "[" @punctuation.bracket
305
+ ":" @punctuation.bracket
306
+ content: (pattern_character_class_content_source) @character.special
307
+ ":" @punctuation.bracket
308
+ "]" @punctuation.bracket)
309
+ (pattern_collating_symbol_source) @character.special
310
+ (pattern_equivalence_class_source) @character.special
311
+ ])
312
+ "]" @punctuation.bracket)))
313
+
314
+ (parameter_pattern
315
+ (pattern_bracket_source
316
+ "[" @punctuation.bracket
317
+ (pattern_bracket_negation_source)? @punctuation.special
318
+ (pattern_bracket_members_source
319
+ [
320
+ (pattern_bracket_character_source) @character
321
+ (pattern_bracket_hyphen_source) @character
322
+ (pattern_bracket_range_source
323
+ start: [
324
+ (pattern_bracket_character_source)
325
+ (pattern_bracket_hyphen_source)
326
+ ] @character
327
+ operator: (pattern_bracket_range_operator_source) @punctuation.special
328
+ end: [
329
+ (pattern_bracket_character_source)
330
+ (pattern_bracket_hyphen_source)
331
+ ] @character)
332
+ (pattern_character_class_source
333
+ "[" @punctuation.bracket
334
+ ":" @punctuation.bracket
335
+ content: (pattern_character_class_content_source) @character.special
336
+ ":" @punctuation.bracket
337
+ "]" @punctuation.bracket)
338
+ (pattern_collating_symbol_source) @character.special
339
+ (pattern_equivalence_class_source) @character.special
340
+ ])
341
+ "]" @punctuation.bracket))
342
+
343
+ (cmd_name
344
+ (word
345
+ (pattern_bracket_source
346
+ "[" @punctuation.bracket
347
+ (pattern_bracket_negation_source)? @punctuation.special
348
+ (pattern_bracket_members_source
349
+ [
350
+ (pattern_bracket_character_source) @character
351
+ (pattern_bracket_hyphen_source) @character
352
+ (pattern_bracket_range_source
353
+ start: [
354
+ (pattern_bracket_character_source)
355
+ (pattern_bracket_hyphen_source)
356
+ ] @character
357
+ operator: (pattern_bracket_range_operator_source) @punctuation.special
358
+ end: [
359
+ (pattern_bracket_character_source)
360
+ (pattern_bracket_hyphen_source)
361
+ ] @character)
362
+ (pattern_character_class_source
363
+ "[" @punctuation.bracket
364
+ ":" @punctuation.bracket
365
+ content: (pattern_character_class_content_source) @character.special
366
+ ":" @punctuation.bracket
367
+ "]" @punctuation.bracket)
368
+ (pattern_collating_symbol_source) @character.special
369
+ (pattern_equivalence_class_source) @character.special
370
+ ])
371
+ "]" @punctuation.bracket)))
372
+
373
+ (cmd_word
374
+ (word
375
+ (pattern_bracket_source
376
+ "[" @punctuation.bracket
377
+ (pattern_bracket_negation_source)? @punctuation.special
378
+ (pattern_bracket_members_source
379
+ [
380
+ (pattern_bracket_character_source) @character
381
+ (pattern_bracket_hyphen_source) @character
382
+ (pattern_bracket_range_source
383
+ start: [
384
+ (pattern_bracket_character_source)
385
+ (pattern_bracket_hyphen_source)
386
+ ] @character
387
+ operator: (pattern_bracket_range_operator_source) @punctuation.special
388
+ end: [
389
+ (pattern_bracket_character_source)
390
+ (pattern_bracket_hyphen_source)
391
+ ] @character)
392
+ (pattern_character_class_source
393
+ "[" @punctuation.bracket
394
+ ":" @punctuation.bracket
395
+ content: (pattern_character_class_content_source) @character.special
396
+ ":" @punctuation.bracket
397
+ "]" @punctuation.bracket)
398
+ (pattern_collating_symbol_source) @character.special
399
+ (pattern_equivalence_class_source) @character.special
400
+ ])
401
+ "]" @punctuation.bracket)))
402
+
403
+ (cmd_suffix
404
+ word: (word
405
+ (pattern_bracket_source
406
+ "[" @punctuation.bracket
407
+ (pattern_bracket_negation_source)? @punctuation.special
408
+ (pattern_bracket_members_source
409
+ [
410
+ (pattern_bracket_character_source) @character
411
+ (pattern_bracket_hyphen_source) @character
412
+ (pattern_bracket_range_source
413
+ start: [
414
+ (pattern_bracket_character_source)
415
+ (pattern_bracket_hyphen_source)
416
+ ] @character
417
+ operator: (pattern_bracket_range_operator_source) @punctuation.special
418
+ end: [
419
+ (pattern_bracket_character_source)
420
+ (pattern_bracket_hyphen_source)
421
+ ] @character)
422
+ (pattern_character_class_source
423
+ "[" @punctuation.bracket
424
+ ":" @punctuation.bracket
425
+ content: (pattern_character_class_content_source) @character.special
426
+ ":" @punctuation.bracket
427
+ "]" @punctuation.bracket)
428
+ (pattern_collating_symbol_source) @character.special
429
+ (pattern_equivalence_class_source) @character.special
430
+ ])
431
+ "]" @punctuation.bracket)))
432
+
433
+ (wordlist
434
+ word: (word
435
+ (pattern_bracket_source
436
+ "[" @punctuation.bracket
437
+ (pattern_bracket_negation_source)? @punctuation.special
438
+ (pattern_bracket_members_source
439
+ [
440
+ (pattern_bracket_character_source) @character
441
+ (pattern_bracket_hyphen_source) @character
442
+ (pattern_bracket_range_source
443
+ start: [
444
+ (pattern_bracket_character_source)
445
+ (pattern_bracket_hyphen_source)
446
+ ] @character
447
+ operator: (pattern_bracket_range_operator_source) @punctuation.special
448
+ end: [
449
+ (pattern_bracket_character_source)
450
+ (pattern_bracket_hyphen_source)
451
+ ] @character)
452
+ (pattern_character_class_source
453
+ "[" @punctuation.bracket
454
+ ":" @punctuation.bracket
455
+ content: (pattern_character_class_content_source) @character.special
456
+ ":" @punctuation.bracket
457
+ "]" @punctuation.bracket)
458
+ (pattern_collating_symbol_source) @character.special
459
+ (pattern_equivalence_class_source) @character.special
460
+ ])
461
+ "]" @punctuation.bracket)))
462
+
463
+ (filename
464
+ word: (word
465
+ (pattern_bracket_source
466
+ "[" @punctuation.bracket
467
+ (pattern_bracket_negation_source)? @punctuation.special
468
+ (pattern_bracket_members_source
469
+ [
470
+ (pattern_bracket_character_source) @character
471
+ (pattern_bracket_hyphen_source) @character
472
+ (pattern_bracket_range_source
473
+ start: [
474
+ (pattern_bracket_character_source)
475
+ (pattern_bracket_hyphen_source)
476
+ ] @character
477
+ operator: (pattern_bracket_range_operator_source) @punctuation.special
478
+ end: [
479
+ (pattern_bracket_character_source)
480
+ (pattern_bracket_hyphen_source)
481
+ ] @character)
482
+ (pattern_character_class_source
483
+ "[" @punctuation.bracket
484
+ ":" @punctuation.bracket
485
+ content: (pattern_character_class_content_source) @character.special
486
+ ":" @punctuation.bracket
487
+ "]" @punctuation.bracket)
488
+ (pattern_collating_symbol_source) @character.special
489
+ (pattern_equivalence_class_source) @character.special
490
+ ])
491
+ "]" @punctuation.bracket)))
package/src/parser.c CHANGED
@@ -1403345,7 +1403345,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_sh(void) {
1403345
1403345
  .max_reserved_word_set_size = 0,
1403346
1403346
  .metadata = {
1403347
1403347
  .major_version = 0,
1403348
- .minor_version = 1,
1403348
+ .minor_version = 2,
1403349
1403349
  .patch_version = 0,
1403350
1403350
  },
1403351
1403351
  };
package/tree-sitter.json CHANGED
@@ -6,13 +6,14 @@
6
6
  "title": "POSIX sh",
7
7
  "scope": "source.sh",
8
8
  "file-types": ["sh"],
9
- "injection-regex": "^(sh|shell)$"
9
+ "injection-regex": "^(sh|shell)$",
10
+ "highlights": "queries/highlights.scm"
10
11
  }
11
12
  ],
12
13
  "metadata": {
13
- "version": "0.1.0",
14
+ "version": "0.2.0",
14
15
  "license": "MIT",
15
- "description": "A Tree-sitter grammar for POSIX sh.",
16
+ "description": "Tree-sitter grammar for POSIX sh.",
16
17
  "authors": [
17
18
  {
18
19
  "name": "konomanoasa"