summaryrefslogtreecommitdiff
path: root/src-3.0/GF/Compile
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@chalmers.se>2008-05-22 15:32:31 +0000
committerkr.angelov <kr.angelov@chalmers.se>2008-05-22 15:32:31 +0000
commit359647445a851e3d6fc8b2071cada614aacda11e (patch)
treedc17e592c0594ab52afa739cc672cccc6206ce2c /src-3.0/GF/Compile
parent2ecfbf154365177265eed3e1dce5e673ab4b5028 (diff)
GF.Devel.ModDeps is removed. The only used function is moved to GrammarToGFCC
Diffstat (limited to 'src-3.0/GF/Compile')
-rw-r--r--src-3.0/GF/Compile/GrammarToGFCC.hs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src-3.0/GF/Compile/GrammarToGFCC.hs b/src-3.0/GF/Compile/GrammarToGFCC.hs
index 93fe856ad..fc52e7d1c 100644
--- a/src-3.0/GF/Compile/GrammarToGFCC.hs
+++ b/src-3.0/GF/Compile/GrammarToGFCC.hs
@@ -19,7 +19,6 @@ import qualified GF.Infra.Option as O
import GF.Conversion.SimpleToFCFG (convertConcrete)
import GF.Parsing.FCFG.PInfo (buildFCFPInfo)
import GF.Devel.PrintGFCC
-import GF.Devel.ModDeps
import GF.Infra.Ident
import GF.Infra.Option
import GF.Data.Operations
@@ -539,3 +538,17 @@ prtTrace tr n =
prTrace tr n = trace ("-- OBSERVE" +++ A.prt tr +++ show n +++ show tr) n
+-- | this function finds out what modules are really needed in the canonical gr.
+-- its argument is typically a concrete module name
+requiredCanModules :: (Ord i, Show i) => Bool -> M.MGrammar i f a -> i -> [i]
+requiredCanModules isSingle gr c = nub $ filter notReuse ops ++ exts where
+ exts = M.allExtends gr c
+ ops = if isSingle
+ then map fst (M.modules gr)
+ else iterFix (concatMap more) $ exts
+ more i = errVal [] $ do
+ m <- M.lookupModMod gr i
+ return $ M.extends m ++ [o | o <- map M.openedModule (M.opens m)]
+ notReuse i = errVal True $ do
+ m <- M.lookupModMod gr i
+ return $ M.isModRes m -- to exclude reused Cnc and Abs from required