summaryrefslogtreecommitdiff
path: root/src/GF/Compile/Compile.hs
diff options
context:
space:
mode:
authoraarne <unknown>2003-12-09 16:39:24 +0000
committeraarne <unknown>2003-12-09 16:39:24 +0000
commit08c9a2ab8cf7b77a5c0392f5f8e9643e39c89c5b (patch)
tree56add96ffe8436f3fe920deb4bc7da320bc19e5d /src/GF/Compile/Compile.hs
parent8e637feb793364134d469cb7d1e68605aab2c2ea (diff)
Introduced output of stripped format gfcm.
Diffstat (limited to 'src/GF/Compile/Compile.hs')
-rw-r--r--src/GF/Compile/Compile.hs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs
index 9346fce00..c83d628c7 100644
--- a/src/GF/Compile/Compile.hs
+++ b/src/GF/Compile/Compile.hs
@@ -125,6 +125,9 @@ extendCompileEnvInt (_,MGrammar ss, MGrammar cs) (k,sm,cm) =
extendCompileEnv (k,s,c) (sm,cm) = extendCompileEnvInt (k,s,c) (k,sm,cm)
+extendCompileEnvCanon (k,s,c) cgr =
+ return (k,s, MGrammar (modules cgr ++ modules c))
+
compileOne :: Options -> CompileEnv -> FullPath -> IOE CompileEnv
compileOne opts env file = do
@@ -134,7 +137,12 @@ compileOne opts env file = do
let name = fileBody file
case gf of
- -- for canonical gf, just read the file and update environment
+ -- for multilingual canonical gf, just read the file and update environment
+ "gfcm" -> do
+ cgr <- putp ("+ reading" +++ file) $ getCanonGrammar file
+ extendCompileEnvCanon env cgr
+
+ -- for canonical gf, read the file and update environment, also source env
"gfc" -> do
cm <- putp ("+ reading" +++ file) $ getCanonModule file
sm <- ioeErr $ CG.canon2sourceModule cm
@@ -180,6 +188,12 @@ compileSourceModule opts env@(k,gr,can) mo@(i,mi) = do
let putp = putPointE opts
mos = modules gr
+ if (oElem showOld opts && oElem emitCode opts)
+ then do
+ let (file,out) = (gfFile (prt i), prGrammar (MGrammar [mo]))
+ ioeIO $ writeFile file out >> putStr (" wrote file" +++ file)
+ else return ()
+
mo1 <- ioeErr $ rebuildModule mos mo
mo1b <- ioeErr $ extendModule mos mo1