Skip to content

Commit 812b1ab

Browse files
committed
refactor module_pack_expression
1 parent 1dcfd0c commit 812b1ab

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

grammar.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ module.exports = grammar({
182182
$.module_expression,
183183
$.functor,
184184
$.extension_expression,
185-
$.module_unpack,
186185
),
187186

188187
module_unpack: $ => seq('unpack', $.call_arguments),
@@ -718,10 +717,7 @@ module.exports = grammar({
718717
module_pack_expression: $ => seq(
719718
'module',
720719
'(',
721-
choice(
722-
$._module_definition,
723-
seq(choice($.module_identifier, $.module_identifier_path), '(', $.module_unpack, ')')
724-
),
720+
choice($.module_expression, $.block),
725721
optional(seq(':', $.module_expression)),
726722
')'
727723
),
@@ -1231,7 +1227,8 @@ module.exports = grammar({
12311227
$.module_identifier_path,
12321228
$.module_type_of,
12331229
$.functor_use,
1234-
$.module_type_constraint
1230+
$.module_type_constraint,
1231+
$.module_unpack,
12351232
),
12361233

12371234
module_identifier_path: $ => prec.left(seq(

test/corpus/modules.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,11 @@ module(SomeFunctor(unpack(x)))
174174
(module_identifier)))
175175
(expression_statement
176176
(module_pack_expression
177-
(module_identifier)
178-
(module_unpack
179-
(call_arguments (value_identifier))))))
177+
(functor_use
178+
(module_identifier)
179+
(arguments
180+
(module_unpack
181+
(call_arguments (value_identifier))))))))
180182

181183

182184
===========================================

0 commit comments

Comments
 (0)