Skip to content

Commit bcef4a4

Browse files
Make module subprogram declaration detection more explicit/restricted
1 parent 1830d3e commit bcef4a4

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bootstrap/src/BuildModel.hs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,14 +308,24 @@ useStatement = do
308308

309309
moduleSubprogramDeclaration :: ReadP LineContents
310310
moduleSubprogramDeclaration = do
311-
skipAnything
311+
skipSpaces
312+
skipProcedureQualifiers
312313
_ <- string "module"
313314
skipAtLeastOneWhiteSpace
314-
skipAnything
315315
_ <- string "function" <|> string "subroutine"
316316
skipAtLeastOneWhiteSpace
317317
return $ ModuleSubprogramDeclaration
318318

319+
skipProcedureQualifiers :: ReadP ()
320+
skipProcedureQualifiers = do
321+
many skipPossibleQualifier
322+
return ()
323+
324+
skipPossibleQualifier :: ReadP ()
325+
skipPossibleQualifier = do
326+
_ <- string "pure" <|> string "elemental" <|> string "impure"
327+
skipAtLeastOneWhiteSpace
328+
319329
skipAtLeastOneWhiteSpace :: ReadP ()
320330
skipAtLeastOneWhiteSpace = do
321331
_ <- many1 whiteSpace

0 commit comments

Comments
 (0)