summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/GetGrammar.hs
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2011-11-02 13:57:11 +0000
committerkr.angelov <kr.angelov@gmail.com>2011-11-02 13:57:11 +0000
commit734c66710e9bffa986c094e8c584295b33cd2f63 (patch)
tree73fb499ba17a3d6d8986784f4a17ad03420204e4 /src/compiler/GF/Compile/GetGrammar.hs
parent5fe49ed9f7ac7089301e867e55bfedefcba230dd (diff)
merge GF.Infra.Modules and GF.Grammar.Grammar. This is a preparation for the separate PGF building
Diffstat (limited to 'src/compiler/GF/Compile/GetGrammar.hs')
-rw-r--r--src/compiler/GF/Compile/GetGrammar.hs15
1 files changed, 4 insertions, 11 deletions
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 ()