@willbooster/tree-sitter-javascript 1.0.13 → 1.0.15

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
@@ -81,6 +81,7 @@ module.exports = grammar({
81
81
  $._line_break_after_binding,
82
82
  $._line_break_after_field,
83
83
  $._line_break_after_modifier,
84
+ $._line_break_before_attributes,
84
85
  ],
85
86
 
86
87
  extras: ($) => [$.comment, $.html_comment, /[\s\p{Zs}\uFEFF\u2028\u2029\u2060\u200B]/u],
@@ -179,9 +180,11 @@ module.exports = grammar({
179
180
  seq(
180
181
  'export',
181
182
  choice(
182
- seq('*', $._from_clause),
183
- seq($.namespace_export, $._from_clause),
184
- seq($.export_clause, $._from_clause),
183
+ seq(
184
+ choice('*', $.namespace_export, $.export_clause),
185
+ $._from_clause,
186
+ optional(choice($.import_attribute, $._line_break_before_attributes))
187
+ ),
185
188
  alias($._local_export_clause, $.export_clause)
186
189
  ),
187
190
  $._semicolon
@@ -240,7 +243,7 @@ module.exports = grammar({
240
243
  seq(
241
244
  'import',
242
245
  choice(seq($.import_clause, $._from_clause), field('source', $.string)),
243
- optional($.import_attribute),
246
+ optional(choice($.import_attribute, $._line_break_before_attributes)),
244
247
  $._semicolon
245
248
  ),
246
249
 
@@ -1189,9 +1192,9 @@ module.exports = grammar({
1189
1192
  // This negative dynamic precedence ensures that during error recovery,
1190
1193
  // unfinished constructs are generally treated as literal expressions,
1191
1194
  // not patterns.
1192
- pattern: ($) => prec.dynamic(-1, choice($._lhs_expression, $.rest_pattern)),
1195
+ pattern: ($) => prec.dynamic(-1, choice($._lhs_expression, $.parenthesized_expression, $.rest_pattern)),
1193
1196
 
1194
- rest_pattern: ($) => prec.right(seq('...', $._lhs_expression)),
1197
+ rest_pattern: ($) => prec.right(seq('...', choice($._lhs_expression, $.parenthesized_expression))),
1195
1198
 
1196
1199
  method_definition: ($) =>
1197
1200
  seq(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-javascript",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "JavaScript grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -103,6 +103,10 @@
103
103
  "type": "object_pattern",
104
104
  "named": true
105
105
  },
106
+ {
107
+ "type": "parenthesized_expression",
108
+ "named": true
109
+ },
106
110
  {
107
111
  "type": "rest_pattern",
108
112
  "named": true
@@ -1170,13 +1174,17 @@
1170
1174
  }
1171
1175
  },
1172
1176
  "children": {
1173
- "multiple": false,
1177
+ "multiple": true,
1174
1178
  "required": false,
1175
1179
  "types": [
1176
1180
  {
1177
1181
  "type": "export_clause",
1178
1182
  "named": true
1179
1183
  },
1184
+ {
1185
+ "type": "import_attribute",
1186
+ "named": true
1187
+ },
1180
1188
  {
1181
1189
  "type": "namespace_export",
1182
1190
  "named": true
@@ -2505,6 +2513,10 @@
2505
2513
  "type": "object_pattern",
2506
2514
  "named": true
2507
2515
  },
2516
+ {
2517
+ "type": "parenthesized_expression",
2518
+ "named": true
2519
+ },
2508
2520
  {
2509
2521
  "type": "subscript_expression",
2510
2522
  "named": true
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "1.0.13",
19
+ "version": "1.0.15",
20
20
  "license": "MIT",
21
21
  "description": "JavaScript grammar for tree-sitter",
22
22
  "authors": [