@willbooster/tree-sitter-javascript 1.0.28 → 1.0.30

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/grammar.js CHANGED
@@ -101,6 +101,9 @@ module.exports = grammar({
101
101
  $._await_keyword,
102
102
  $._let,
103
103
  $._single_statement_context,
104
+ $._resource_binding_start,
105
+ $._resource_binding_continuation,
106
+ $._plain_resource_for_of_context,
104
107
  ],
105
108
 
106
109
  extras: ($) => [$.comment, $.html_comment, /[\s\p{Zs}\uFEFF\u2028\u2029\u2060\u200B]/u],
@@ -335,12 +338,13 @@ module.exports = grammar({
335
338
  using_declaration: ($) =>
336
339
  seq(
337
340
  field('kind', choice('using', seq(alias($._await_keyword, 'await'), 'using'))),
338
- commaSep1(alias($._using_declarator, $.variable_declarator)),
341
+ $._resource_binding_start,
342
+ alias($._using_declarator, $.variable_declarator),
343
+ repeat(seq(',', $._resource_binding_continuation, alias($._using_declarator, $.variable_declarator))),
339
344
  $._semicolon
340
345
  ),
341
346
 
342
- _using_declarator: ($) =>
343
- seq(field('name', choice($.identifier, alias('of', $.identifier))), optional($._initializer)),
347
+ _using_declarator: ($) => seq(field('name', choice($.identifier, alias('of', $.identifier))), $._initializer),
344
348
 
345
349
  variable_declarator: ($) =>
346
350
  seq(
@@ -404,7 +408,9 @@ module.exports = grammar({
404
408
  _for_using_declaration: ($) =>
405
409
  seq(
406
410
  field('kind', choice('using', seq(alias($._await_keyword, 'await'), 'using'))),
407
- commaSep1(alias($._using_declarator, $.variable_declarator)),
411
+ $._resource_binding_start,
412
+ alias($._using_declarator, $.variable_declarator),
413
+ repeat(seq(',', $._resource_binding_continuation, alias($._using_declarator, $.variable_declarator))),
408
414
  ';'
409
415
  ),
410
416
 
@@ -415,22 +421,30 @@ module.exports = grammar({
415
421
  seq(
416
422
  '(',
417
423
  choice(
418
- field('left', choice($._lhs_expression, $.parenthesized_expression)),
419
424
  seq(
420
- field('kind', 'var'),
421
- field('left', choice($.identifier, alias('of', $.identifier), $._destructuring_pattern)),
422
- optional($._initializer)
423
- ),
424
- seq(
425
- field('kind', choice('let', 'const')),
426
- field('left', choice($.identifier, alias('of', $.identifier), $._destructuring_pattern))
425
+ choice(
426
+ field('left', choice($._lhs_expression, $.parenthesized_expression)),
427
+ seq(
428
+ field('kind', 'var'),
429
+ field('left', choice($.identifier, alias('of', $.identifier), $._destructuring_pattern)),
430
+ optional($._initializer)
431
+ ),
432
+ seq(
433
+ field('kind', choice('let', 'const')),
434
+ field('left', choice($.identifier, alias('of', $.identifier), $._destructuring_pattern))
435
+ )
436
+ ),
437
+ field('operator', choice('in', 'of'))
427
438
  ),
428
439
  seq(
429
- field('kind', choice('using', seq(alias($._await_keyword, 'await'), 'using'))),
430
- field('left', choice($.identifier, alias('of', $.identifier)))
440
+ choice(
441
+ seq(field('kind', 'using'), choice($._resource_binding_start, $._plain_resource_for_of_context)),
442
+ seq(field('kind', seq(alias($._await_keyword, 'await'), 'using')), $._resource_binding_start)
443
+ ),
444
+ field('left', choice($.identifier, alias('of', $.identifier))),
445
+ field('operator', 'of')
431
446
  )
432
447
  ),
433
- field('operator', choice('in', 'of')),
434
448
  field('right', $._expressions),
435
449
  ')'
436
450
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-javascript",
3
- "version": "1.0.28",
3
+ "version": "1.0.30",
4
4
  "description": "JavaScript grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
package/queries/tags.scm CHANGED
@@ -82,7 +82,7 @@
82
82
  (call_expression
83
83
  function: (member_expression
84
84
  property: (property_identifier) @name)
85
- arguments: (_) @reference.call)
85
+ arguments: (_)) @reference.call
86
86
 
87
87
  (new_expression
88
88
  constructor: (_) @name) @reference.class
Binary file
package/tree-sitter.json CHANGED
@@ -24,7 +24,7 @@
24
24
  }
25
25
  ],
26
26
  "metadata": {
27
- "version": "1.0.28",
27
+ "version": "1.0.30",
28
28
  "license": "MIT",
29
29
  "description": "JavaScript grammar for tree-sitter",
30
30
  "authors": [