fix infinite recursion on failed parse
This commit is contained in:
parent
0e729fdff6
commit
15fda7f452
1 changed files with 5 additions and 9 deletions
|
@ -116,14 +116,6 @@ getOutput c ps environ = do
|
||||||
writeFile (c ++ ".out") s
|
writeFile (c ++ ".out") s
|
||||||
return out
|
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 :: FilePath -> String
|
||||||
atFile f = '@':f
|
atFile f = '@':f
|
||||||
|
|
||||||
|
@ -136,7 +128,11 @@ runAtFile p s f extraparams = do
|
||||||
removeFile f
|
removeFile f
|
||||||
return out
|
return out
|
||||||
where
|
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 :: IO ()
|
||||||
main = do
|
main = do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue