diff options
| author | krasimir <krasimir@chalmers.se> | 2008-04-17 12:50:51 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2008-04-17 12:50:51 +0000 |
| commit | 0ea2798b3cc9bf60e99e01089ea2eddba64a9cbf (patch) | |
| tree | 0f94cbe1bdf621e9bdf5de892a0c00cb3c1b9298 /src/GF/Devel/Compile.hs | |
| parent | 08f92cd180079125ce3d4826d1eeba1beb91ed46 (diff) | |
gf3 should not exit if there is a syntax error in the file
Diffstat (limited to 'src/GF/Devel/Compile.hs')
| -rw-r--r-- | src/GF/Devel/Compile.hs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/GF/Devel/Compile.hs b/src/GF/Devel/Compile.hs index 1b6f2710e..149e49c5d 100644 --- a/src/GF/Devel/Compile.hs +++ b/src/GF/Devel/Compile.hs @@ -30,13 +30,12 @@ import GF.Devel.Arch import Control.Monad import System.Directory -batchCompile :: Options -> [FilePath] -> IO SourceGrammar +batchCompile :: Options -> [FilePath] -> IOE SourceGrammar batchCompile opts files = do - let defOpts = addOptions opts (options [emitCode]) - egr <- appIOE $ foldM (compileModule defOpts) emptyCompileEnv files - case egr of - Ok (_,gr) -> return gr - Bad s -> error s + (_,gr) <- foldM (compileModule defOpts) emptyCompileEnv files + return gr + where + defOpts = addOptions opts (options [emitCode]) -- to output an intermediate stage intermOut :: Options -> Option -> String -> IOE () @@ -83,10 +82,7 @@ compileModule opts1 env file = do ioeIOIf $ putStrLn $ "modules to include:" +++ show names ---- let sgr2 = MGrammar [m | m@(i,_) <- modules sgr, notElem (prt i) $ map fileBody names] - let env0 = (0,sgr2) - (e,mm) <- foldIOE (compileOne opts) env0 files - maybe (return ()) putStrLnE mm - return e + foldM (compileOne opts) (0,sgr2) files compileOne :: Options -> CompileEnv -> FullPath -> IOE CompileEnv |
