mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
bug fixed (?) in compilation
This commit is contained in:
@@ -39,6 +39,7 @@ import GF.Compile.Optimize
|
||||
import GF.Compile.GrammarToCanon
|
||||
import GF.Canon.Share
|
||||
import GF.Canon.Subexpressions (elimSubtermsMod,unSubelimModule)
|
||||
import GF.UseGrammar.Linear (unoptimizeCanonMod) ----
|
||||
|
||||
import qualified GF.Canon.CanonToGrammar as CG
|
||||
|
||||
@@ -165,7 +166,7 @@ extendCompileEnvCanon ((k,s,c),fts) cgr ft =
|
||||
type TimedCompileEnv = (CompileEnv,[(FilePath,ModTime)])
|
||||
|
||||
compileOne :: Options -> TimedCompileEnv -> FullPath -> IOE TimedCompileEnv
|
||||
compileOne opts env@((_,srcgr,_),_) file = do
|
||||
compileOne opts env@((_,srcgr,cancgr0),_) file = do
|
||||
|
||||
let putp = putPointE opts
|
||||
let putpp = putPointEsil opts
|
||||
@@ -189,7 +190,8 @@ compileOne opts env@((_,srcgr,_),_) file = do
|
||||
-- for canonical gf, read the file and update environment, also source env
|
||||
"gfc" -> do
|
||||
cm <- putp ("+ reading" +++ file) $ getCanonModule file
|
||||
sm <- ioeErr $ CG.canon2sourceModule $ unSubelimModule cm
|
||||
let cancgr = updateMGrammar (MGrammar [cm]) cancgr0
|
||||
sm <- ioeErr $ CG.canon2sourceModule $ unoptimizeCanonMod cancgr $ unSubelimModule cm
|
||||
ft <- getReadTimes file
|
||||
extendCompileEnv env (sm, cm) ft
|
||||
|
||||
|
||||
@@ -121,7 +121,10 @@ expandLinTables gr t = case t of
|
||||
-- Do this for an entire grammar:
|
||||
|
||||
unoptimizeCanon :: CanonGrammar -> CanonGrammar
|
||||
unoptimizeCanon g@(M.MGrammar ms) = M.MGrammar $ map convMod ms where
|
||||
unoptimizeCanon g@(M.MGrammar ms) = M.MGrammar $ map (unoptimizeCanonMod g) ms
|
||||
|
||||
unoptimizeCanonMod :: CanonGrammar -> CanonModule -> CanonModule
|
||||
unoptimizeCanonMod g = convMod where
|
||||
convMod (m, M.ModMod (M.Module (M.MTConcrete a) x flags me os defs)) =
|
||||
(m, M.ModMod (M.Module (M.MTConcrete a) x flags me os (mapTree convDef defs)))
|
||||
convMod mm = mm
|
||||
|
||||
Reference in New Issue
Block a user