Skip to content

Commit 5db67b5

Browse files
committed
fix: resolve a conflict around module type exprs
1 parent 1d4ca54 commit 5db67b5

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

grammar.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ module.exports = grammar({
2727
$.module_primary_expression,
2828
],
2929

30+
inline: $ => [
31+
$._module_definition,
32+
],
33+
3034
precedences: $ => [
3135
// + - Operators -> precendence
3236
[
@@ -100,7 +104,6 @@ module.exports = grammar({
100104
[$._switch_value_pattern, $._parenthesized_pattern],
101105
[$.variant_declaration],
102106
[$.unit, $._function_type_parameter_list],
103-
[$._module_definition, $.parenthesized_module_expression],
104107
[$.functor_parameter, $.module_primary_expression, $.module_identifier_path],
105108
],
106109

@@ -176,7 +179,7 @@ module.exports = grammar({
176179
'module',
177180
optional('rec'),
178181
optional('type'),
179-
field('name', choice($.module_identifier, $._type_identifier)),
182+
field('name', choice($.module_identifier, $.type_identifier)),
180183
optional(seq(
181184
':',
182185
field('signature', choice($.block, $.module_expression, $.functor)),
@@ -1058,8 +1061,8 @@ module.exports = grammar({
10581061
'.',
10591062
optional(seq(
10601063
field('module', $.module_identifier),
1061-
'.')
1062-
),
1064+
'.'
1065+
)),
10631066
field('property', alias($.value_identifier, $.property_identifier)),
10641067
)),
10651068

@@ -1236,12 +1239,11 @@ module.exports = grammar({
12361239
optional(alias($.variant_arguments, $.arguments)),
12371240
)),
12381241

1239-
_type_identifier: $ =>
1240-
choice(
1241-
$.type_identifier,
1242-
$.type_identifier_path,
1243-
".."
1244-
),
1242+
_type_identifier: $ => choice(
1243+
$.type_identifier,
1244+
$.type_identifier_path,
1245+
".."
1246+
),
12451247

12461248
type_identifier_path: $ => seq(
12471249
$.module_primary_expression,

0 commit comments

Comments
 (0)