@willbooster/tree-sitter-javascript 1.0.20 → 1.0.21
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 +7 -8
- package/package.json +1 -1
- package/tree-sitter-javascript.wasm +0 -0
- package/tree-sitter.json +1 -1
package/grammar.js
CHANGED
|
@@ -137,6 +137,9 @@ module.exports = grammar({
|
|
|
137
137
|
['member', 'template_call', 'new', 'call', $.expression],
|
|
138
138
|
['declaration', 'literal'],
|
|
139
139
|
[$.primary_expression, $.statement_block, 'object'],
|
|
140
|
+
// A `{` that may begin both a block and an object starts a statement or an arrow function's body, where ECMAScript
|
|
141
|
+
// reads it as a block, so `{a: 1}` there is a labeled statement in a block.
|
|
142
|
+
[$.labeled_statement, $._property_name],
|
|
140
143
|
[$.meta_property, $.import],
|
|
141
144
|
[$.import_statement, $.import],
|
|
142
145
|
[$.export_statement, $.primary_expression],
|
|
@@ -159,7 +162,6 @@ module.exports = grammar({
|
|
|
159
162
|
[$.object, $.object_pattern],
|
|
160
163
|
[$.assignment_expression, $.pattern],
|
|
161
164
|
[$.assignment_expression, $.object_assignment_pattern],
|
|
162
|
-
[$.labeled_statement, $._property_name],
|
|
163
165
|
[$.computed_property_name, $.array],
|
|
164
166
|
[$.binary_expression, $._initializer],
|
|
165
167
|
],
|
|
@@ -454,13 +456,10 @@ module.exports = grammar({
|
|
|
454
456
|
empty_statement: () => ';',
|
|
455
457
|
|
|
456
458
|
labeled_statement: ($) =>
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
':',
|
|
462
|
-
field('body', $.statement)
|
|
463
|
-
)
|
|
459
|
+
seq(
|
|
460
|
+
field('label', alias(choice($.identifier, $._reserved_identifier), $.statement_identifier)),
|
|
461
|
+
':',
|
|
462
|
+
field('body', $.statement)
|
|
464
463
|
),
|
|
465
464
|
|
|
466
465
|
//
|
package/package.json
CHANGED
|
Binary file
|