From c31179e91a4bd9695de298084425cf5be86c22a1 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sun, 5 Mar 2023 21:41:20 -0300 Subject: [PATCH] allow unpack as a valid identifier --- grammar.js | 4 +++- queries/highlights.scm | 3 ++- test/corpus/let_bindings.txt | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/grammar.js b/grammar.js index f2d83ae..c1ed37e 100644 --- a/grammar.js +++ b/grammar.js @@ -66,6 +66,7 @@ module.exports = grammar({ ], [$._jsx_attribute_value, $.pipe_expression], [$.function_type_parameters, $.function_type], + [$._reserved_identifier, $.module_unpack] ], conflicts: $ => [ @@ -1495,7 +1496,8 @@ module.exports = grammar({ uncurry: $ => '.', _reserved_identifier: $ => choice( - 'async' + 'async', + 'unpack' ) }, }); diff --git a/queries/highlights.scm b/queries/highlights.scm index f954f03..20dd556 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -114,13 +114,14 @@ "assert" "await" "with" - "unpack" "lazy" "constraint" ] @keyword ((function "async" @keyword)) +(module_unpack "unpack" @keyword) + [ "if" "else" diff --git a/test/corpus/let_bindings.txt b/test/corpus/let_bindings.txt index e5bd87c..57e751c 100644 --- a/test/corpus/let_bindings.txt +++ b/test/corpus/let_bindings.txt @@ -8,6 +8,7 @@ let c = #foo let list = 1 let a = list let async = 1 +let unpack = 2 export d = 5 --- @@ -25,6 +26,8 @@ export d = 5 (let_binding (value_identifier) (value_identifier))) (let_declaration (let_binding (value_identifier) (number))) + (let_declaration + (let_binding (value_identifier) (number))) (let_declaration (let_binding (value_identifier) (number))))