diff options
author | Joey Hess <joey@kitenet.net> | 2013-12-09 15:34:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-12-09 15:34:56 -0400 |
commit | ce5bbf184c167aa7b7aec20cb9447263a49bc294 (patch) | |
tree | df206037180855a05fd875be11ca7409c6c7d432 | |
parent | 4d0e50a1c8abe9e2ee6258ef82e2d223b006ccb6 (diff) |
fix infinite recursion on failed parse
-rw-r--r-- | Build/EvilLinker.hs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/Build/EvilLinker.hs b/Build/EvilLinker.hs index 584f12381..e62b5a4f9 100644 --- a/Build/EvilLinker.hs +++ b/Build/EvilLinker.hs @@ -116,14 +116,6 @@ getOutput c ps environ = do writeFile (c ++ ".out") s return out -runParser' :: Parser a -> String -> String -> a -runParser' p s paramfile = either failedparse id (parse p "" s) - where - failedparse e = error $ - (show e) ++ - "\n<<<\n" ++ s ++ "\n>>>" ++ - "\nparam file contained: >>>\n" ++ paramfile ++ "\n<<<" - atFile :: FilePath -> String atFile f = '@':f @@ -136,7 +128,11 @@ runAtFile p s f extraparams = do removeFile f return out where - c = runParser' p s (opts c) + c = case parse p "" s of + Left e -> error $ + (show e) ++ + "\n<<<\n" ++ s ++ "\n>>>" + Right r -> r main :: IO () main = do |