@@ -20,13 +20,14 @@ import qualified Reporting.Result as Result
20import qualified Validate
20import qualified Validate
24 :: Package.Name
25 :: Package.Name
25 -> OpTable
26 -> OpTable
27 -> Result.Result wrn Error.Error M.ValidModule
28 -> Result.Result wrn Error.Error M.ValidModule
28program pkgName table src =
29program pkgName table src =
29− do (M.Module name filePath docs exports imports sourceDecls) <-
30+ do (M.Module kind name filePath docs exports imports sourceDecls) <-
30 parseWithTable table src (programParser pkgName)
31 parseWithTable table src (programParser pkgName)
32 validDecls <- Validate.declarations sourceDecls
33 validDecls <- Validate.declarations sourceDecls
@@ -37,14 +38,16 @@ program pkgName table src =
40− return (M.Module name filePath docs exports ammendedImports validDecls)
41+ return (M.Module kind name filePath docs exports ammendedImports validDecls)
43-- HEADERS AND DECLARATIONS
45-- HEADERS AND DECLARATIONS
45programParser :: Package.Name -> IParser M.SourceModule
48programParser :: Package.Name -> IParser M.SourceModule
46programParser pkgName =
49programParser pkgName =
47− do (M.Header name docs exports imports) <- Module.header
50+ do (M.Header kind name docs exports imports) <- Module.header
48 decls <- declarations
51 decls <- declarations
49 _ <- many (spaces <|> newline)
52 _ <- many (spaces <|> newline)
@@ -52,7 +55,7 @@ programParser pkgName =
52 let canonicalName =
55 let canonicalName =
53 ModuleName.Canonical pkgName name
56 ModuleName.Canonical pkgName name
55− return $ M.Module canonicalName "" docs exports imports decls
58+ return $ M.Module kind canonicalName "" docs exports imports decls
58declarations :: IParser [D.SourceDecl]
61declarations :: IParser [D.SourceDecl]
@@ -68,8 +71,10 @@ freshDef =
68 Decl.declaration
71 Decl.declaration
71-- RUN PARSERS
75-- RUN PARSERS
73parse :: String -> IParser a -> Result.Result wrn Error.Error a
78parse :: String -> IParser a -> Result.Result wrn Error.Error a
74parse source parser =
79parse source parser =
75 case iParse parser source of
80 case iParse parser source of
@@ -101,6 +106,7 @@ parseWithTable table source parser =
102-- INFIX INFO
107-- INFIX INFO
104makeInfixTable
110makeInfixTable
105 :: Map.Map String (Int, D.Assoc)
111 :: Map.Map String (Int, D.Assoc)
106 -> [(String, InfixInfo)]
112 -> [(String, InfixInfo)]
@@ -142,4 +148,4 @@ parseFixities =
142data InfixInfo = InfixInfo
148data InfixInfo = InfixInfo
143 { _region :: R.Region
149 { _region :: R.Region
144 , _info :: (Int, D.Assoc)
150 , _info :: (Int, D.Assoc)