Skip to content

Commit cbe075b

Browse files
committed
support and in recursive modules
Close #160
1 parent 3b0c162 commit cbe075b

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

grammar.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ module.exports = grammar({
175175
$.exception_declaration,
176176
),
177177

178-
module_binding: $ => prec.left(seq(
178+
_module_binding: $ => prec.left(seq(
179179
field('name', choice($.module_identifier, $.type_identifier)),
180180
optional(seq(
181181
':',
@@ -190,14 +190,14 @@ module.exports = grammar({
190190

191191
_module_binding_and: $ => seq(
192192
'and',
193-
$.module_binding
193+
$._module_binding
194194
),
195195

196196
module_declaration: $ => seq(
197197
'module',
198198
optional('rec'),
199199
optional('type'),
200-
$.module_binding,
200+
$._module_binding,
201201
),
202202

203203
_module_definition: $ => choice(

test/corpus/modules.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,33 @@ module rec BYOBReader: {
287287
include Reader
288288
} = BYOBReader
289289

290+
module rec A: T = {
291+
let x = B.x
292+
}
293+
and B: T = {
294+
let x = 1
295+
}
296+
290297
---
291298

292299
(source_file
293300
(module_declaration
294301
(module_identifier)
295302
(block
296303
(include_statement (module_identifier)))
297-
(module_identifier)))
304+
(module_identifier))
305+
306+
(module_declaration
307+
(module_identifier) (module_identifier)
308+
(block
309+
(let_binding
310+
(value_identifier)
311+
(value_identifier_path
312+
(module_identifier) (value_identifier))))
313+
(module_identifier) (module_identifier)
314+
(block
315+
(let_binding
316+
(value_identifier) (number)))))
298317

299318
===========================================
300319
Definition through extension

0 commit comments

Comments
 (0)