diff options
| author | hallgren <hallgren@chalmers.se> | 2014-10-21 14:42:31 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2014-10-21 14:42:31 +0000 |
| commit | 3bfcfa157dc291e03bfb4db3baed8b0098d76f50 (patch) | |
| tree | 8e71873156f297219ff79803990c7c22ffe7c198 /src/compiler/GF/Compile.hs | |
| parent | f6441b22921c6ae24840d60b80672d499ddaef33 (diff) | |
Renaming SourceGrammar to Grammar and similarly for some related types
Included renamings:
SourceGrammar -> Grammar
SourceModule -> Module
SourceModInfo -> ModuleInfo
emptySourceGrammar -> emptyGrammar
Also introduces a type synonym (which might be good to turn into a newtype):
type ModuleName = Ident
The reason is to make types like the following more self documenting:
type Module = (ModuleName,ModuleInfo)
type QIdent = (ModuleName,Ident)
Diffstat (limited to 'src/compiler/GF/Compile.hs')
| -rw-r--r-- | src/compiler/GF/Compile.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/GF/Compile.hs b/src/compiler/GF/Compile.hs index 2eed7a6ff..6e7c84ce2 100644 --- a/src/compiler/GF/Compile.hs +++ b/src/compiler/GF/Compile.hs @@ -5,7 +5,7 @@ import GF.Compile.ReadFiles(ModEnv,getOptionsFromFile,getAllFiles, importsOfModule) import GF.CompileOne(compileOne) -import GF.Grammar.Grammar(SourceGrammar,emptySourceGrammar, +import GF.Grammar.Grammar(Grammar,emptyGrammar, abstractOfConcrete,prependModule)--,msrc,modules import GF.Infra.Ident(Ident,identS)--,showIdent @@ -32,7 +32,7 @@ compileToPGF opts fs = link opts =<< batchCompile opts fs -- | Link a grammar into a 'PGF' that can be used to 'PGF.linearize' and -- 'PGF.parse' with the "PGF" run-time system. -link :: Options -> (Ident,t,SourceGrammar) -> IOE PGF +link :: Options -> (Ident,t,Grammar) -> IOE PGF link opts (cnc,_,gr) = putPointE Normal opts "linking ... " $ do let abs = srcAbsName gr cnc @@ -46,7 +46,7 @@ link opts (cnc,_,gr) = srcAbsName gr cnc = err (const cnc) id $ abstractOfConcrete gr cnc -- | Compile the given grammar files and everything they depend on -batchCompile :: Options -> [FilePath] -> IOE (Ident,UTCTime,SourceGrammar) +batchCompile :: Options -> [FilePath] -> IOE (Ident,UTCTime,Grammar) batchCompile opts files = do (gr,menv) <- foldM (compileModule opts) emptyCompileEnv files let cnc = identS (justModuleName (last files)) @@ -54,7 +54,7 @@ batchCompile opts files = do return (cnc,t,gr) {- -- to compile a set of modules, e.g. an old GF or a .cf file -compileSourceGrammar :: Options -> SourceGrammar -> IOE SourceGrammar +compileSourceGrammar :: Options -> Grammar -> IOE Grammar compileSourceGrammar opts gr = do cwd <- getCurrentDirectory (_,gr',_) <- foldM (\env -> compileSourceModule opts cwd env Nothing) @@ -104,10 +104,10 @@ compileOne' opts env@(gr,_) = extendCompileEnv env <=< compileOne opts gr -- auxiliaries -- | The environment -type CompileEnv = (SourceGrammar,ModEnv) +type CompileEnv = (Grammar,ModEnv) emptyCompileEnv :: CompileEnv -emptyCompileEnv = (emptySourceGrammar,Map.empty) +emptyCompileEnv = (emptyGrammar,Map.empty) extendCompileEnv (gr,menv) (mfile,mo) = do menv2 <- case mfile of |
