diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2011-11-15 13:33:44 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2011-11-15 13:33:44 +0000 |
| commit | 61c16f2eb2a042152a2b04f709d0cefe6e5a14df (patch) | |
| tree | 04fad20bcc0923f4a505a87a2ec9ef139394d868 /src/compiler/GFC.hs | |
| parent | 8a7aa15c5717e3ab4ebe0e63459759be4863e07e (diff) | |
more structured format for errors and warnings from the compiler
Diffstat (limited to 'src/compiler/GFC.hs')
| -rw-r--r-- | src/compiler/GFC.hs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs index 075b82f18..3fff0701c 100644 --- a/src/compiler/GFC.hs +++ b/src/compiler/GFC.hs @@ -24,15 +24,21 @@ import System.IO import Control.Exception -mainGFC :: Options -> [FilePath] -> IOE () -mainGFC opts fs = - case () of - _ | null fs -> fail $ "No input files." - _ | all (extensionIs ".cf") fs -> compileCFFiles opts fs - _ | all (\f -> extensionIs ".gf" f || extensionIs ".gfo" f) fs -> compileSourceFiles opts fs - _ | all (extensionIs ".pgf") fs -> unionPGFFiles opts fs - _ -> fail $ "Don't know what to do with these input files: " ++ unwords fs - where extensionIs ext = (== ext) . takeExtension +mainGFC :: Options -> [FilePath] -> IO () +mainGFC opts fs = do + r <- appIOE (case () of + _ | null fs -> fail $ "No input files." + _ | all (extensionIs ".cf") fs -> compileCFFiles opts fs + _ | all (\f -> extensionIs ".gf" f || extensionIs ".gfo" f) fs -> compileSourceFiles opts fs + _ | all (extensionIs ".pgf") fs -> unionPGFFiles opts fs + _ -> fail $ "Don't know what to do with these input files: " ++ unwords fs) + case r of + Ok x -> return x + Bad msg -> die $ if flag optVerbosity opts == Normal + then ('\n':msg) + else msg + where + extensionIs ext = (== ext) . takeExtension compileSourceFiles :: Options -> [FilePath] -> IOE () compileSourceFiles opts fs = |
