Commit c434e82f authored by Alexis Williams's avatar Alexis Williams
Browse files

Fix incorrect environment parser

parent edf0e2ec
......@@ -30,11 +30,11 @@ parseEnvironmentFileLine = GhcEnvFileComment <$> comment
<|> pure GhcEnvFileClearPackageDbStack <* clearDb
where
comment = P.string "--" *> P.many (P.noneOf "\r\n")
unitId = P.string "package-id" *> P.spaces *>
unitId = P.try $ P.string "package-id" *> P.spaces *>
(mkUnitId <$> P.many1 (P.satisfy $ \c -> isAlphaNum c || c `elem` "-_.+"))
packageDb = (P.string "global-package-db" *> pure GlobalPackageDB)
<|> (P.string "user-package-db" *> pure UserPackageDB)
<|> (P.string "package-db" *> P.spaces *> (SpecificPackageDB <$> P.anyChar `P.endBy` P.endOfLine))
<|> (P.string "package-db" *> P.spaces *> (SpecificPackageDB <$> P.many1 (P.noneOf "\r\n") <* P.lookAhead P.endOfLine))
clearDb = P.string "clear-package-db"
newtype ParseErrorExc = ParseErrorExc P.ParseError
......@@ -43,7 +43,7 @@ newtype ParseErrorExc = ParseErrorExc P.ParseError
instance Exception ParseErrorExc
parseEnvironmentFile :: Parser [GhcEnvironmentFileEntry]
parseEnvironmentFile = parseEnvironmentFileLine `P.endBy` P.endOfLine
parseEnvironmentFile = parseEnvironmentFileLine `P.sepEndBy` P.endOfLine <* P.eof
readGhcEnvironmentFile :: FilePath -> IO [GhcEnvironmentFileEntry]
readGhcEnvironmentFile path =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment