From 3cbd135010a597aa4caf1098bd21b95814f5de64 Mon Sep 17 00:00:00 2001 From: aarne Date: Sat, 25 Feb 2006 18:59:32 +0000 Subject: resource specialized to present tense ; preprocessor flag --- src/GF/Compile/GetGrammar.hs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/GF/Compile/GetGrammar.hs') diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs index 4eebc2845..019e2f3d2 100644 --- a/src/GF/Compile/GetGrammar.hs +++ b/src/GF/Compile/GetGrammar.hs @@ -44,16 +44,25 @@ import GF.Infra.ReadFiles ---- import Data.Char (toUpper) import Data.List (nub) import Control.Monad (foldM) - -getSourceModule :: FilePath -> IOE SourceModule -getSourceModule file = do +import System (system) + +getSourceModule :: Options -> FilePath -> IOE SourceModule +getSourceModule opts file0 = do + file <- case getOptVal opts usePreprocessor of + Just p -> do + let tmp = "_gf_preproc.tmp" + cmd = p +++ file0 ++ ">" ++ tmp + ioeIO $ system cmd + -- ioeIO $ putStrLn $ "preproc" +++ cmd + return tmp + _ -> return file0 string <- readFileIOE file let tokens = myLexer string mo1 <- ioeErr $ {- err2err $ -} pModDef tokens ioeErr $ transModDef mo1 -getSourceGrammar :: FilePath -> IOE SourceGrammar -getSourceGrammar file = do +getSourceGrammar :: Options -> FilePath -> IOE SourceGrammar +getSourceGrammar opts file = do string <- readFileIOE file let tokens = myLexer string gr1 <- ioeErr $ {- err2err $ -} pGrammar tokens -- cgit v1.2.3