From bcef4a4789f439934a40709189c1ae9e036cf1d2 Mon Sep 17 00:00:00 2001 From: Brad Richardson Date: Wed, 21 Oct 2020 10:06:11 -0500 Subject: Make module subprogram declaration detection more explicit/restricted --- bootstrap/src/BuildModel.hs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'bootstrap/src/BuildModel.hs') diff --git a/bootstrap/src/BuildModel.hs b/bootstrap/src/BuildModel.hs index 8f4d813..6dc8ddf 100644 --- a/bootstrap/src/BuildModel.hs +++ b/bootstrap/src/BuildModel.hs @@ -308,14 +308,24 @@ useStatement = do moduleSubprogramDeclaration :: ReadP LineContents moduleSubprogramDeclaration = do - skipAnything + skipSpaces + skipProcedureQualifiers _ <- string "module" skipAtLeastOneWhiteSpace - skipAnything _ <- string "function" <|> string "subroutine" skipAtLeastOneWhiteSpace return $ ModuleSubprogramDeclaration +skipProcedureQualifiers :: ReadP () +skipProcedureQualifiers = do + many skipPossibleQualifier + return () + +skipPossibleQualifier :: ReadP () +skipPossibleQualifier = do + _ <- string "pure" <|> string "elemental" <|> string "impure" + skipAtLeastOneWhiteSpace + skipAtLeastOneWhiteSpace :: ReadP () skipAtLeastOneWhiteSpace = do _ <- many1 whiteSpace -- cgit v1.2.3