Skip to content

Commit 927a3da

Browse files
committed
refactor module_pack_expression
1 parent 0ad76a9 commit 927a3da

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

grammar.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -716,15 +716,13 @@ module.exports = grammar({
716716
)),
717717

718718
module_pack_expression: $ => seq(
719-
'module', '(',
719+
'module',
720+
'(',
720721
choice(
721-
seq(
722-
field('name', choice($.module_identifier, $.module_identifier_path)),
723-
optional(field('signature', seq(':', $.module_identifier))),
724-
optional(field('definition', seq('(', $.module_unpack, ')')))
725-
),
726-
seq(field('definition', $.block), ':', field('signature', $.module_identifier))
722+
$._module_definition,
723+
seq(choice($.module_identifier, $.module_identifier_path), '(', $.module_unpack, ')')
727724
),
725+
optional(seq(':', $.module_expression)),
728726
')'
729727
),
730728

test/corpus/modules.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ module(
155155
let foo = "Hello"
156156
}: X
157157
)
158+
module(SomeFunctor(unpack(x)))
158159

159160
---
160161

@@ -170,7 +171,12 @@ module(
170171
(let_binding
171172
(value_identifier)
172173
(string (string_fragment))))
173-
(module_identifier))))
174+
(module_identifier)))
175+
(expression_statement
176+
(module_pack_expression
177+
(module_identifier)
178+
(module_unpack
179+
(call_arguments (value_identifier))))))
174180

175181

176182
===========================================

0 commit comments

Comments
 (0)