mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -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.Compile.GrammarToCanon
|
||||||
import GF.Canon.Share
|
import GF.Canon.Share
|
||||||
import GF.Canon.Subexpressions (elimSubtermsMod,unSubelimModule)
|
import GF.Canon.Subexpressions (elimSubtermsMod,unSubelimModule)
|
||||||
|
import GF.UseGrammar.Linear (unoptimizeCanonMod) ----
|
||||||
|
|
||||||
import qualified GF.Canon.CanonToGrammar as CG
|
import qualified GF.Canon.CanonToGrammar as CG
|
||||||
|
|
||||||
@@ -165,7 +166,7 @@ extendCompileEnvCanon ((k,s,c),fts) cgr ft =
|
|||||||
type TimedCompileEnv = (CompileEnv,[(FilePath,ModTime)])
|
type TimedCompileEnv = (CompileEnv,[(FilePath,ModTime)])
|
||||||
|
|
||||||
compileOne :: Options -> TimedCompileEnv -> FullPath -> IOE TimedCompileEnv
|
compileOne :: Options -> TimedCompileEnv -> FullPath -> IOE TimedCompileEnv
|
||||||
compileOne opts env@((_,srcgr,_),_) file = do
|
compileOne opts env@((_,srcgr,cancgr0),_) file = do
|
||||||
|
|
||||||
let putp = putPointE opts
|
let putp = putPointE opts
|
||||||
let putpp = putPointEsil 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
|
-- for canonical gf, read the file and update environment, also source env
|
||||||
"gfc" -> do
|
"gfc" -> do
|
||||||
cm <- putp ("+ reading" +++ file) $ getCanonModule file
|
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
|
ft <- getReadTimes file
|
||||||
extendCompileEnv env (sm, cm) ft
|
extendCompileEnv env (sm, cm) ft
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,10 @@ expandLinTables gr t = case t of
|
|||||||
-- Do this for an entire grammar:
|
-- Do this for an entire grammar:
|
||||||
|
|
||||||
unoptimizeCanon :: CanonGrammar -> CanonGrammar
|
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)) =
|
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)))
|
(m, M.ModMod (M.Module (M.MTConcrete a) x flags me os (mapTree convDef defs)))
|
||||||
convMod mm = mm
|
convMod mm = mm
|
||||||
|
|||||||
Reference in New Issue
Block a user