diff options
| author | bjorn <bjorn@bringert.net> | 2008-10-15 11:38:34 +0000 |
|---|---|---|
| committer | bjorn <bjorn@bringert.net> | 2008-10-15 11:38:34 +0000 |
| commit | 1ecb4f63e9765962aab570bf043cb65c22df1e45 (patch) | |
| tree | c12112454cbd1bb41d2a83864dd795347fa4df81 /src/GF/Compile | |
| parent | 60ba93cfbb043ecf0831f182b2044c5e94508d47 (diff) | |
Added OPTIONS class to make options handling somewhat nicer. Next, I will merge Flags and ModuleFlags.
Diffstat (limited to 'src/GF/Compile')
| -rw-r--r-- | src/GF/Compile/Coding.hs | 2 | ||||
| -rw-r--r-- | src/GF/Compile/Export.hs | 2 | ||||
| -rw-r--r-- | src/GF/Compile/GetGrammar.hs | 2 | ||||
| -rw-r--r-- | src/GF/Compile/GrammarToGFCC.hs | 4 | ||||
| -rw-r--r-- | src/GF/Compile/Optimize.hs | 6 | ||||
| -rw-r--r-- | src/GF/Compile/ReadFiles.hs | 2 | ||||
| -rw-r--r-- | src/GF/Compile/Rebuild.hs | 2 |
7 files changed, 10 insertions, 10 deletions
diff --git a/src/GF/Compile/Coding.hs b/src/GF/Compile/Coding.hs index 704e95201..89e458956 100644 --- a/src/GF/Compile/Coding.hs +++ b/src/GF/Compile/Coding.hs @@ -15,7 +15,7 @@ encodeStringsInModule = codeSourceModule encodeUTF8 decodeStringsInModule :: SourceModule -> SourceModule decodeStringsInModule mo = case mo of - (_,ModMod m) -> case moduleFlag optEncoding (moduleOptions (flags m)) of + (_,ModMod m) -> case flag optEncoding (flags m) of UTF_8 -> codeSourceModule decodeUTF8 mo CP_1251 -> codeSourceModule decodeCP1251 mo _ -> mo diff --git a/src/GF/Compile/Export.hs b/src/GF/Compile/Export.hs index 8b924113d..575a9dc84 100644 --- a/src/GF/Compile/Export.hs +++ b/src/GF/Compile/Export.hs @@ -51,7 +51,7 @@ exportPGF opts fmt pgf = FmtRegExp -> single "rexp" regexpPrinter FmtFA -> single "dot" slfGraphvizPrinter where - name = fromMaybe (prCId (absname pgf)) (moduleFlag optName opts) + name = fromMaybe (prCId (absname pgf)) (flag optName opts) multi :: String -> (PGF -> String) -> [(FilePath,String)] multi ext pr = [(name <.> ext, pr pgf)] diff --git a/src/GF/Compile/GetGrammar.hs b/src/GF/Compile/GetGrammar.hs index 6f02ac824..f9cdbcc14 100644 --- a/src/GF/Compile/GetGrammar.hs +++ b/src/GF/Compile/GetGrammar.hs @@ -38,7 +38,7 @@ import System.Cmd (system) getSourceModule :: Options -> FilePath -> IOE SourceModule getSourceModule opts file0 = do - file <- foldM runPreprocessor file0 (moduleFlag optPreprocessors opts) + file <- foldM runPreprocessor file0 (flag optPreprocessors opts) string <- readFileIOE file let tokens = myLexer string mo1 <- ioeErr $ pModDef tokens diff --git a/src/GF/Compile/GrammarToGFCC.hs b/src/GF/Compile/GrammarToGFCC.hs index e57937f52..5b2d14586 100644 --- a/src/GF/Compile/GrammarToGFCC.hs +++ b/src/GF/Compile/GrammarToGFCC.hs @@ -240,13 +240,13 @@ reorder abs cg = M.MGrammar $ predefADefs = [(c, AbsCat (Yes []) Nope) | c <- [cFloat,cInt,cString]] aflags = - concatModuleOptions [M.flags mo | (_,mo) <- M.allModMod cg, M.isModAbs mo] + concatOptions [M.flags mo | (_,mo) <- M.allModMod cg, M.isModAbs mo] cncs = sortIds [(lang, concr lang) | lang <- M.allConcretes cg abs] concr la = (flags, sortIds (predefCDefs ++ jments)) where jments = Look.allOrigInfos cg la - flags = concatModuleOptions + flags = concatOptions [M.flags mo | (i,mo) <- mos, M.isModCnc mo, Just r <- [lookup i (M.allExtendSpecs cg la)]] diff --git a/src/GF/Compile/Optimize.hs b/src/GF/Compile/Optimize.hs index 83cbeb57a..ca3e6ec3e 100644 --- a/src/GF/Compile/Optimize.hs +++ b/src/GF/Compile/Optimize.hs @@ -58,8 +58,8 @@ optimizeModule opts mse@(ms,eenv) mo@(_,mi) = case mi of return (mo2,eenv) _ -> evalModule oopts mse mo where - oopts = addOptions opts (moduleOptions (flagsModule mo)) - optim = moduleFlag optOptimizations oopts + oopts = opts `addOptions` toOptions (flagsModule mo) + optim = flag optOptimizations oopts evalModule :: Options -> ([(Ident,SourceModInfo)],EEnv) -> (Ident,SourceModInfo) -> Err ((Ident,SourceModInfo),EEnv) @@ -102,7 +102,7 @@ evalResInfo oopts gr (c,info) = case info of where comp = if optres then computeConcrete gr else computeConcreteRec gr eIn cat = errIn ("Error optimizing" +++ cat +++ prt c +++ ":") - optim = moduleFlag optOptimizations oopts + optim = flag optOptimizations oopts optres = OptExpand `Set.member` optim diff --git a/src/GF/Compile/ReadFiles.hs b/src/GF/Compile/ReadFiles.hs index a8558963e..67535227b 100644 --- a/src/GF/Compile/ReadFiles.hs +++ b/src/GF/Compile/ReadFiles.hs @@ -210,4 +210,4 @@ getOptionsFromFile file = do s <- ioeIO $ readFileIfStrict file let ls = filter (BS.isPrefixOf (BS.pack "--#")) $ BS.lines s fs = map (BS.unpack . BS.unwords . BS.words . BS.drop 3) ls - ioeErr $ liftM moduleOptions $ parseModuleOptions fs + ioeErr $ liftM toOptions $ parseModuleOptions fs diff --git a/src/GF/Compile/Rebuild.hs b/src/GF/Compile/Rebuild.hs index 5dc781887..04fc43d10 100644 --- a/src/GF/Compile/Rebuild.hs +++ b/src/GF/Compile/Rebuild.hs @@ -81,7 +81,7 @@ rebuildModule ms mo@(i,mi) = do ++ [oSimple i | i <- map snd insts] ---- --- check if me is incomplete - let fs1 = addModuleOptions fs fs_ -- new flags have priority + let fs1 = fs `addOptions` fs_ -- new flags have priority let js0 = [ci | ci@(c,_) <- tree2list js, isInherited incl c] let js1 = buildTree (tree2list js_ ++ js0) let ps1 = buildTree (tree2list ps_ ++ tree2list ps0) |
