@@ -30,6 +30,48 @@ module.exports = grammar({
3030 / [ \s \p{ Zs} \uFEFF \u2028 \u2029 \u2060 \u200B ] / ,
3131 ] ,
3232
33+ reserved : {
34+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words
35+ global : $ => [
36+ 'break' ,
37+ 'case' ,
38+ 'catch' ,
39+ 'class' ,
40+ 'const' ,
41+ 'continue' ,
42+ 'debugger' ,
43+ 'default' ,
44+ 'delete' ,
45+ 'do' ,
46+ 'else' ,
47+ 'export' ,
48+ 'extends' ,
49+ 'false' ,
50+ 'finally' ,
51+ 'for' ,
52+ 'function' ,
53+ 'if' ,
54+ 'import' ,
55+ 'in' ,
56+ 'instanceof' ,
57+ 'new' ,
58+ 'null' ,
59+ 'return' ,
60+ 'super' ,
61+ 'switch' ,
62+ 'this' ,
63+ 'throw' ,
64+ 'true' ,
65+ 'try' ,
66+ 'typeof' ,
67+ 'var' ,
68+ 'void' ,
69+ 'while' ,
70+ 'with' ,
71+ ] ,
72+ properties : $ => [ ] ,
73+ } ,
74+
3375 supertypes : $ => [
3476 $ . statement ,
3577 $ . declaration ,
@@ -173,6 +215,7 @@ module.exports = grammar({
173215 _module_export_name : $ => choice (
174216 $ . identifier ,
175217 $ . string ,
218+ 'default' ,
176219 ) ,
177220
178221 declaration : $ => choice (
@@ -841,7 +884,8 @@ module.exports = grammar({
841884 choice ( '.' , field ( 'optional_chain' , $ . optional_chain ) ) ,
842885 field ( 'property' , choice (
843886 $ . private_property_identifier ,
844- alias ( $ . identifier , $ . property_identifier ) ) ) ,
887+ reserved ( 'properties' , alias ( $ . identifier , $ . property_identifier ) ) ,
888+ ) ) ,
845889 ) ) ,
846890
847891 subscript_expression : $ => prec . right ( 'member' , seq (
@@ -1224,7 +1268,7 @@ module.exports = grammar({
12241268 field ( 'value' , choice ( $ . pattern , $ . assignment_pattern ) ) ,
12251269 ) ,
12261270
1227- _property_name : $ => choice (
1271+ _property_name : $ => reserved ( 'properties' , choice (
12281272 alias (
12291273 choice ( $ . identifier , $ . _reserved_identifier ) ,
12301274 $ . property_identifier ,
@@ -1233,7 +1277,7 @@ module.exports = grammar({
12331277 $ . string ,
12341278 $ . number ,
12351279 $ . computed_property_name ,
1236- ) ,
1280+ ) ) ,
12371281
12381282 computed_property_name : $ => seq (
12391283 '[' ,
0 commit comments