@willbooster/tree-sitter-javascript 22.0.0 → 22.0.2
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 +84 -32
- package/package.json +5 -5
- 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
|
@@ -233,7 +233,6 @@ module.exports = grammar({
|
|
|
233
233
|
[$._primary_atom, $._simple_target_primary],
|
|
234
234
|
[$._simple_target_primary, $._non_rest_pattern],
|
|
235
235
|
[$._primary_atom, $._simple_target_primary, $._non_rest_pattern],
|
|
236
|
-
[$._call_callee, $.call_expression],
|
|
237
236
|
[$._class_heritage_expression, $._class_heritage_call],
|
|
238
237
|
[$.for_in_clause, $._primary_atom],
|
|
239
238
|
[$._primary_atom, $.rest_pattern],
|
|
@@ -241,13 +240,17 @@ module.exports = grammar({
|
|
|
241
240
|
[$._primary_atom, $._non_rest_pattern],
|
|
242
241
|
[$.arrow_function, $._primary_atom],
|
|
243
242
|
[$._primary_atom, $.await_expression],
|
|
244
|
-
[$.
|
|
245
|
-
[$.
|
|
243
|
+
[$._assignment_call_primary, $._classic_call_target],
|
|
244
|
+
[$._assignment_call_primary, $._simple_target_primary, $._non_rest_pattern],
|
|
245
|
+
[$._non_assignment_call_primary, $._non_rest_pattern],
|
|
246
|
+
[$._non_assignment_call_primary, $._object_rest_pattern],
|
|
247
|
+
[$.for_in_clause, $._non_assignment_call_primary],
|
|
248
|
+
[$._non_assignment_call_primary, $.rest_pattern],
|
|
246
249
|
[$._local_export_specifier, $._module_export_name],
|
|
247
|
-
[$.
|
|
248
|
-
[$.
|
|
249
|
-
[$.
|
|
250
|
-
[$.
|
|
250
|
+
[$._assignment_call_primary, $.rest_pattern],
|
|
251
|
+
[$._assignment_call_primary, $._object_rest_pattern],
|
|
252
|
+
[$._assignment_call_primary, $._non_rest_pattern],
|
|
253
|
+
[$._assignment_call_primary, $.for_in_clause],
|
|
251
254
|
[$.array, $.array_pattern],
|
|
252
255
|
[$.object, $.object_pattern],
|
|
253
256
|
[$.assignment_expression, $._non_rest_pattern],
|
|
@@ -661,7 +664,14 @@ module.exports = grammar({
|
|
|
661
664
|
|
|
662
665
|
_unary_operand: ($) => choice($.primary_expression, $.await_expression, $.unary_expression, $.update_expression),
|
|
663
666
|
|
|
664
|
-
|
|
667
|
+
// Calls in `_assignment_call_primary` chains can be classic call assignment targets; the other chains contain an
|
|
668
|
+
// optional chain or start with an arrow function. Keeping the two disjoint lets the tokens read so far decide every
|
|
669
|
+
// chain, where overlapping chains would split the parse at every call until its arguments end.
|
|
670
|
+
primary_expression: ($) =>
|
|
671
|
+
choice(alias($._assignment_call_primary, $.primary_expression), $._non_assignment_call_primary),
|
|
672
|
+
|
|
673
|
+
_non_assignment_call_primary: ($) =>
|
|
674
|
+
choice($.member_expression, $.subscript_expression, $.call_expression, $.arrow_function),
|
|
665
675
|
|
|
666
676
|
yield_expression: ($) =>
|
|
667
677
|
prec.right(
|
|
@@ -859,12 +869,14 @@ module.exports = grammar({
|
|
|
859
869
|
_class_heritage_expression: ($) => alias($._class_heritage_primary, $.primary_expression),
|
|
860
870
|
|
|
861
871
|
_class_heritage_primary: ($) =>
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
872
|
+
choice(
|
|
873
|
+
$._class_heritage_atom,
|
|
874
|
+
alias($._class_heritage_subscript, $.subscript_expression),
|
|
875
|
+
alias($._class_heritage_member, $.member_expression),
|
|
876
|
+
alias($._class_heritage_call, $.call_expression),
|
|
877
|
+
$.new_expression,
|
|
878
|
+
alias($._argumentless_new_expression, $.new_expression)
|
|
879
|
+
),
|
|
868
880
|
|
|
869
881
|
_class_heritage_atom: ($) => primaryAtom($, $._expression_identifier),
|
|
870
882
|
|
|
@@ -994,7 +1006,25 @@ module.exports = grammar({
|
|
|
994
1006
|
|
|
995
1007
|
optional_chain: () => '?.',
|
|
996
1008
|
|
|
997
|
-
call_expression: ($) =>
|
|
1009
|
+
call_expression: ($) =>
|
|
1010
|
+
choice(
|
|
1011
|
+
prec('call', seq(field('function', $._non_assignment_call_primary), field('arguments', $.arguments))),
|
|
1012
|
+
prec(
|
|
1013
|
+
'template_call',
|
|
1014
|
+
seq(
|
|
1015
|
+
field('function', $._non_assignment_call_primary),
|
|
1016
|
+
field('arguments', alias($._tagged_template_string, $.template_string))
|
|
1017
|
+
)
|
|
1018
|
+
),
|
|
1019
|
+
prec(
|
|
1020
|
+
'member',
|
|
1021
|
+
seq(
|
|
1022
|
+
field('function', alias($._call_callee, $.expression)),
|
|
1023
|
+
field('optional_chain', $.optional_chain),
|
|
1024
|
+
field('arguments', $.arguments)
|
|
1025
|
+
)
|
|
1026
|
+
)
|
|
1027
|
+
),
|
|
998
1028
|
|
|
999
1029
|
_primary_atom: ($) => primaryAtom($, $._reserved_identifier),
|
|
1000
1030
|
|
|
@@ -1186,14 +1216,47 @@ module.exports = grammar({
|
|
|
1186
1216
|
)
|
|
1187
1217
|
),
|
|
1188
1218
|
|
|
1189
|
-
member_expression: ($) =>
|
|
1219
|
+
member_expression: ($) =>
|
|
1220
|
+
prec(
|
|
1221
|
+
'member',
|
|
1222
|
+
seq(
|
|
1223
|
+
choice(
|
|
1224
|
+
seq(
|
|
1225
|
+
field('object', choice(alias($._call_callee, $.expression), $.import)),
|
|
1226
|
+
field('optional_chain', $.optional_chain)
|
|
1227
|
+
),
|
|
1228
|
+
seq(field('object', choice($._non_assignment_call_primary, $.import)), '.')
|
|
1229
|
+
),
|
|
1230
|
+
field(
|
|
1231
|
+
'property',
|
|
1232
|
+
choice(
|
|
1233
|
+
$.private_property_identifier,
|
|
1234
|
+
reserved('properties', alias($.identifier, sym('property_identifier')))
|
|
1235
|
+
)
|
|
1236
|
+
)
|
|
1237
|
+
)
|
|
1238
|
+
),
|
|
1190
1239
|
|
|
1191
|
-
subscript_expression: ($) =>
|
|
1240
|
+
subscript_expression: ($) =>
|
|
1241
|
+
prec.right(
|
|
1242
|
+
'member',
|
|
1243
|
+
seq(
|
|
1244
|
+
choice(
|
|
1245
|
+
seq(field('object', alias($._call_callee, $.expression)), field('optional_chain', $.optional_chain)),
|
|
1246
|
+
field('object', $._non_assignment_call_primary)
|
|
1247
|
+
),
|
|
1248
|
+
'[',
|
|
1249
|
+
field('index', $._expressions),
|
|
1250
|
+
']'
|
|
1251
|
+
)
|
|
1252
|
+
),
|
|
1192
1253
|
|
|
1193
1254
|
_lhs_expression: ($) =>
|
|
1194
1255
|
choice(
|
|
1195
1256
|
$.member_expression,
|
|
1196
1257
|
$.subscript_expression,
|
|
1258
|
+
alias($._assignment_member, $.member_expression),
|
|
1259
|
+
alias($._assignment_subscript, $.subscript_expression),
|
|
1197
1260
|
$._identifier,
|
|
1198
1261
|
aliasWithAsyncKeyword($._reserved_identifier, $.identifier),
|
|
1199
1262
|
$._destructuring_pattern
|
|
@@ -1246,6 +1309,8 @@ module.exports = grammar({
|
|
|
1246
1309
|
choice(
|
|
1247
1310
|
$.member_expression,
|
|
1248
1311
|
$.subscript_expression,
|
|
1312
|
+
alias($._assignment_member, $.member_expression),
|
|
1313
|
+
alias($._assignment_subscript, $.subscript_expression),
|
|
1249
1314
|
aliasWithAsyncKeyword($._reserved_identifier, $.identifier),
|
|
1250
1315
|
$._identifier,
|
|
1251
1316
|
alias($._parenthesized_simple_target, $.parenthesized_expression)
|
|
@@ -1612,6 +1677,8 @@ module.exports = grammar({
|
|
|
1612
1677
|
choice(
|
|
1613
1678
|
$.member_expression,
|
|
1614
1679
|
$.subscript_expression,
|
|
1680
|
+
alias($._assignment_member, $.member_expression),
|
|
1681
|
+
alias($._assignment_subscript, $.subscript_expression),
|
|
1615
1682
|
$._identifier,
|
|
1616
1683
|
aliasWithAsyncKeyword($._reserved_identifier, $.identifier),
|
|
1617
1684
|
alias($._parenthesized_simple_target, $.parenthesized_expression)
|
|
@@ -1714,21 +1781,6 @@ module.exports = grammar({
|
|
|
1714
1781
|
},
|
|
1715
1782
|
});
|
|
1716
1783
|
|
|
1717
|
-
/**
|
|
1718
|
-
* @param {GrammarSymbols<'_primary_atom' | 'subscript_expression' | 'member_expression' | 'call_expression' | 'new_expression' | '_argumentless_new_expression'>} $
|
|
1719
|
-
* @param {{atom?: RuleOrLiteral, subscript?: RuleOrLiteral, member?: RuleOrLiteral, call?: RuleOrLiteral}} [forms]
|
|
1720
|
-
*/
|
|
1721
|
-
function leftHandSideExpression($, forms = {}) {
|
|
1722
|
-
return choice(
|
|
1723
|
-
forms.atom ?? $._primary_atom,
|
|
1724
|
-
forms.subscript ?? $.subscript_expression,
|
|
1725
|
-
forms.member ?? $.member_expression,
|
|
1726
|
-
forms.call ?? $.call_expression,
|
|
1727
|
-
$.new_expression,
|
|
1728
|
-
alias($._argumentless_new_expression, $.new_expression)
|
|
1729
|
-
);
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
1784
|
/**
|
|
1733
1785
|
* @param {import('@willbooster/web-tree-sitter/dsl').GrammarSymbols<'_escaped_let'>} $
|
|
1734
1786
|
* @param {boolean} heritage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-javascript",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.2",
|
|
4
4
|
"description": "JavaScript grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -47,24 +47,24 @@
|
|
|
47
47
|
"verify-full": "bun wb verify --full"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@babel/parser": "8.0.
|
|
50
|
+
"@babel/parser": "8.0.10",
|
|
51
51
|
"@tsconfig/bun": "1.0.11",
|
|
52
52
|
"@types/bun": "1.4.4",
|
|
53
53
|
"@vitest/browser-playwright": "5.0.5",
|
|
54
54
|
"@willbooster/oxlint-config": "1.4.9",
|
|
55
|
-
"@willbooster/wb": "23.0
|
|
55
|
+
"@willbooster/wb": "23.3.0",
|
|
56
56
|
"@willbooster/web-tree-sitter": "17.0.1",
|
|
57
57
|
"acorn": "8.19.0",
|
|
58
58
|
"acorn-jsx": "5.3.2",
|
|
59
59
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
60
60
|
"lefthook": "2.2.2",
|
|
61
|
-
"oxlint": "1.
|
|
61
|
+
"oxlint": "1.90.0",
|
|
62
62
|
"oxlint-tsgolint": "7.0.2005",
|
|
63
63
|
"playwright": "1.64.1",
|
|
64
64
|
"semantic-release": "25.0.9",
|
|
65
65
|
"vite": "8.3.5",
|
|
66
66
|
"vitest": "5.0.5",
|
|
67
|
-
"wrangler": "4.
|
|
67
|
+
"wrangler": "4.156.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@willbooster/web-tree-sitter": "^17.0.1"
|
|
Binary file
|
|
Binary file
|