Skip to content

Commit acb94b2

Browse files
reid-spencerclaude
andcommitted
Fix module parser to accept undefined (???) body
The module parser required at least one real definition inside its body, unlike every other scope parser which accepts ???. This caused parse errors for `module X is { ??? }`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e5a3ac6 commit acb94b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

language/shared/src/main/scala/com/ossuminc/riddl/language/parsing/ModuleParser.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ private[parsing] trait ModuleParser {
3434

3535
def module[u: P]: P[Module] = {
3636
P(
37-
Index ~ Keywords.module ~/ identifier ~ is ~ open ~ moduleContents ~ close ~ withMetaData ~ Index
37+
Index ~ Keywords.module ~/ identifier ~ is ~ open ~
38+
(undefined(Seq.empty[ModuleContents]) | moduleContents) ~
39+
close ~ withMetaData ~ Index
3840
)./.map { case (start, id, contents, descriptives, end) =>
3941
checkForDuplicateIncludes(contents)
4042
Module(at(start, end), id, contents.toContents, descriptives.toContents)

0 commit comments

Comments
 (0)