Skip to content

Commit 62c0d3c

Browse files
maxbrunsfeldamaanq
andcommitted
Use new grammar API for reserved words
Co-authored-by: Amaan <amaanq12@gmail.com>
1 parent 88b4235 commit 62c0d3c

File tree

5 files changed

+221
-224
lines changed

5 files changed

+221
-224
lines changed

grammar.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = grammar({
3131
],
3232

3333
reserved: {
34-
global: [
34+
global: $ => [
3535
'const',
3636
'do',
3737
'else',
@@ -45,7 +45,7 @@ module.exports = grammar({
4545
'var',
4646
'while',
4747
],
48-
properties: [],
48+
properties: $ => [],
4949
},
5050

5151
supertypes: $ => [
@@ -550,7 +550,7 @@ module.exports = grammar({
550550
$.method_definition,
551551
alias(
552552
choice($.identifier, $._reserved_identifier),
553-
$.shorthand_property_identifier
553+
$.shorthand_property_identifier,
554554
),
555555
))),
556556
'}',
@@ -564,7 +564,7 @@ module.exports = grammar({
564564
$.object_assignment_pattern,
565565
alias(
566566
choice($.identifier, $._reserved_identifier),
567-
$.shorthand_property_identifier_pattern
567+
$.shorthand_property_identifier_pattern,
568568
),
569569
))),
570570
'}',
@@ -581,7 +581,7 @@ module.exports = grammar({
581581
$._destructuring_pattern,
582582
alias(
583583
choice($._reserved_identifier, $.identifier),
584-
$.shorthand_property_identifier_pattern
584+
$.shorthand_property_identifier_pattern,
585585
),
586586
)),
587587
'=',
@@ -1217,15 +1217,15 @@ module.exports = grammar({
12171217
field('value', choice($.pattern, $.assignment_pattern)),
12181218
),
12191219

1220-
_property_name: $ => reserved([], choice(
1220+
_property_name: $ => reserved('properties', choice(
12211221
alias(choice(
12221222
$.identifier,
1223-
$._reserved_identifier
1223+
$._reserved_identifier,
12241224
), $.property_identifier),
12251225
$.private_property_identifier,
12261226
$.string,
12271227
$.number,
1228-
$.computed_property_name
1228+
$.computed_property_name,
12291229
)),
12301230

12311231
computed_property_name: $ => seq(

src/grammar.json

+55-52
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)