From 734c66710e9bffa986c094e8c584295b33cd2f63 Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Wed, 2 Nov 2011 13:57:11 +0000 Subject: merge GF.Infra.Modules and GF.Grammar.Grammar. This is a preparation for the separate PGF building --- src/compiler/GF/Compile/GetGrammar.hs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/compiler/GF/Compile/GetGrammar.hs') diff --git a/src/compiler/GF/Compile/GetGrammar.hs b/src/compiler/GF/Compile/GetGrammar.hs index 339f28578..914a19aac 100644 --- a/src/compiler/GF/Compile/GetGrammar.hs +++ b/src/compiler/GF/Compile/GetGrammar.hs @@ -12,12 +12,11 @@ -- this module builds the internal GF grammar that is sent to the type checker ----------------------------------------------------------------------------- -module GF.Compile.GetGrammar (getSourceModule, addOptionsToModule) where +module GF.Compile.GetGrammar (getSourceModule) where import GF.Data.Operations import GF.Infra.UseIO -import GF.Infra.Modules import GF.Infra.Option import GF.Grammar.Lexer import GF.Grammar.Parser @@ -40,16 +39,10 @@ getSourceModule opts file0 = ioe $ Left (Pn l c,msg) -> do file <- writeTemp tmp let location = file++":"++show l++":"++show c return (Bad (location++": "++msg)) - Right mo -> do removeTemp tmp - return (Ok (addOptionsToModule opts (setSrcPath file0 mo))) + Right (i,mi) -> do removeTemp tmp + return (Ok (i,mi{mflags=mflags mi `addOptions` opts, msrc=file0})) `catch` (return . Bad . show) -setSrcPath :: FilePath -> SourceModule -> SourceModule -setSrcPath fpath = mapSourceModule (\m -> m{msrc=fpath}) - -addOptionsToModule :: Options -> SourceModule -> SourceModule -addOptionsToModule opts = mapSourceModule (\m -> m { flags = flags m `addOptions` opts }) - runPreprocessor :: Temporary -> String -> IO Temporary runPreprocessor tmp0 p = maybe external internal (lookup p builtin_preprocessors) @@ -100,4 +93,4 @@ keepTemp tmp = Internal str -> return str removeTemp (Temp path) = removeFile path -removeTemp _ = return () \ No newline at end of file +removeTemp _ = return () -- cgit v1.2.3