@willbooster/tree-sitter-javascript 13.0.0 → 14.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/grammar.js +57 -9
- package/package.json +1 -1
- package/tree-sitter-javascript.wasm +0 -0
- package/tree-sitter-javascript_script.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -152,6 +152,10 @@ module.exports = grammar({
|
|
|
152
152
|
$._assignment_call_callee,
|
|
153
153
|
$._call_callee,
|
|
154
154
|
$._assignment_call_primary,
|
|
155
|
+
$._simple_target_expression,
|
|
156
|
+
$._simple_target_primary,
|
|
157
|
+
$._call_target_expression,
|
|
158
|
+
$._call_target_primary,
|
|
155
159
|
],
|
|
156
160
|
|
|
157
161
|
inline: ($) => [
|
|
@@ -209,6 +213,9 @@ module.exports = grammar({
|
|
|
209
213
|
],
|
|
210
214
|
|
|
211
215
|
conflicts: ($) => [
|
|
216
|
+
[$._primary_atom, $._simple_target_primary],
|
|
217
|
+
[$._simple_target_primary, $.pattern],
|
|
218
|
+
[$._primary_atom, $._simple_target_primary, $.pattern],
|
|
212
219
|
[$._call_callee, $.call_expression],
|
|
213
220
|
[$.for_in_clause, $._primary_atom],
|
|
214
221
|
[$._primary_atom, $.rest_pattern],
|
|
@@ -516,7 +523,14 @@ module.exports = grammar({
|
|
|
516
523
|
choice(
|
|
517
524
|
seq(
|
|
518
525
|
choice(
|
|
519
|
-
field(
|
|
526
|
+
field(
|
|
527
|
+
'left',
|
|
528
|
+
choice(
|
|
529
|
+
$._lhs_expression,
|
|
530
|
+
alias($._parenthesized_simple_target, $.parenthesized_expression),
|
|
531
|
+
alias($._parenthesized_call_target, $.parenthesized_expression)
|
|
532
|
+
)
|
|
533
|
+
),
|
|
520
534
|
seq(
|
|
521
535
|
field('kind', 'var'),
|
|
522
536
|
field('left', choice($.identifier, alias('of', $.identifier), $._destructuring_pattern)),
|
|
@@ -1239,13 +1253,43 @@ module.exports = grammar({
|
|
|
1239
1253
|
$._destructuring_pattern
|
|
1240
1254
|
),
|
|
1241
1255
|
|
|
1256
|
+
_simple_target_expression: ($) => alias($._simple_target_primary, $.primary_expression),
|
|
1257
|
+
|
|
1258
|
+
_simple_target_primary: ($) =>
|
|
1259
|
+
choice(
|
|
1260
|
+
$._identifier,
|
|
1261
|
+
alias(sym('_await_yield_identifier'), $.identifier),
|
|
1262
|
+
aliasWithAsyncKeyword($._reserved_identifier, $.identifier),
|
|
1263
|
+
alias($._assignment_member, $.member_expression),
|
|
1264
|
+
alias($._assignment_subscript, $.subscript_expression),
|
|
1265
|
+
alias($._parenthesized_simple_target, $.parenthesized_expression)
|
|
1266
|
+
),
|
|
1267
|
+
|
|
1268
|
+
_parenthesized_simple_target: ($) => seq('(', alias($._simple_target_expression, $.expression), ')'),
|
|
1269
|
+
|
|
1270
|
+
_call_target_expression: ($) => alias($._call_target_primary, $.primary_expression),
|
|
1271
|
+
|
|
1272
|
+
_call_target_primary: ($) => $._classic_call_target,
|
|
1273
|
+
|
|
1274
|
+
_parenthesized_call_target: ($) => seq('(', alias($._call_target_expression, $.expression), ')'),
|
|
1275
|
+
|
|
1276
|
+
_classic_call_target: ($) =>
|
|
1277
|
+
choice(
|
|
1278
|
+
alias($._assignment_call, $.call_expression),
|
|
1279
|
+
alias($._parenthesized_call_target, $.parenthesized_expression)
|
|
1280
|
+
),
|
|
1281
|
+
|
|
1242
1282
|
assignment_expression: ($) =>
|
|
1243
1283
|
prec.right(
|
|
1244
1284
|
'assign',
|
|
1245
1285
|
seq(
|
|
1246
1286
|
field(
|
|
1247
1287
|
'left',
|
|
1248
|
-
choice(
|
|
1288
|
+
choice(
|
|
1289
|
+
alias($._parenthesized_simple_target, $.parenthesized_expression),
|
|
1290
|
+
$._lhs_expression,
|
|
1291
|
+
$._classic_call_target
|
|
1292
|
+
)
|
|
1249
1293
|
),
|
|
1250
1294
|
'=',
|
|
1251
1295
|
field('right', $.expression)
|
|
@@ -1258,7 +1302,7 @@ module.exports = grammar({
|
|
|
1258
1302
|
$.subscript_expression,
|
|
1259
1303
|
aliasWithAsyncKeyword($._reserved_identifier, $.identifier),
|
|
1260
1304
|
$._identifier,
|
|
1261
|
-
$.parenthesized_expression
|
|
1305
|
+
alias($._parenthesized_simple_target, $.parenthesized_expression)
|
|
1262
1306
|
),
|
|
1263
1307
|
|
|
1264
1308
|
augmented_assignment_expression: ($) =>
|
|
@@ -1270,10 +1314,7 @@ module.exports = grammar({
|
|
|
1270
1314
|
field('left', $._augmented_assignment_lhs),
|
|
1271
1315
|
field('operator', choice(...CLASSIC_ASSIGNMENT_OPERATORS, '&&=', '||=', '??='))
|
|
1272
1316
|
),
|
|
1273
|
-
seq(
|
|
1274
|
-
field('left', alias($._assignment_call, $.call_expression)),
|
|
1275
|
-
field('operator', choice(...CLASSIC_ASSIGNMENT_OPERATORS))
|
|
1276
|
-
)
|
|
1317
|
+
seq(field('left', $._classic_call_target), field('operator', choice(...CLASSIC_ASSIGNMENT_OPERATORS)))
|
|
1277
1318
|
),
|
|
1278
1319
|
field('right', $.expression)
|
|
1279
1320
|
)
|
|
@@ -1628,9 +1669,16 @@ module.exports = grammar({
|
|
|
1628
1669
|
// This negative dynamic precedence ensures that during error recovery,
|
|
1629
1670
|
// unfinished constructs are generally treated as literal expressions,
|
|
1630
1671
|
// not patterns.
|
|
1631
|
-
pattern: ($) =>
|
|
1672
|
+
pattern: ($) =>
|
|
1673
|
+
prec.dynamic(
|
|
1674
|
+
-1,
|
|
1675
|
+
choice($._lhs_expression, alias($._parenthesized_simple_target, $.parenthesized_expression), $.rest_pattern)
|
|
1676
|
+
),
|
|
1632
1677
|
|
|
1633
|
-
rest_pattern: ($) =>
|
|
1678
|
+
rest_pattern: ($) =>
|
|
1679
|
+
prec.right(
|
|
1680
|
+
seq('...', choice($._lhs_expression, alias($._parenthesized_simple_target, $.parenthesized_expression)))
|
|
1681
|
+
),
|
|
1634
1682
|
|
|
1635
1683
|
method_definition: ($) =>
|
|
1636
1684
|
functionContext((async) =>
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|