diff options
| author | aarne <unknown> | 2003-11-10 10:02:26 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2003-11-10 10:02:26 +0000 |
| commit | 9eb32352c460f184f73fc13b8d92a0a77d7f5155 (patch) | |
| tree | e6ca352fc86cbe51c71db74c16d1427e696544b3 /src/GF/Infra/Modules.hs | |
| parent | 86662714a00f2ac08e6129c8bdac235f3e1efb2e (diff) | |
Fixed local flags.
Diffstat (limited to 'src/GF/Infra/Modules.hs')
| -rw-r--r-- | src/GF/Infra/Modules.hs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/GF/Infra/Modules.hs b/src/GF/Infra/Modules.hs index 4b642fd72..4eba62283 100644 --- a/src/GF/Infra/Modules.hs +++ b/src/GF/Infra/Modules.hs @@ -126,6 +126,16 @@ allDepsModule gr m = iterFix add os0 where m <- depPathModule n] mods = modules gr +-- select just those modules that a given one depends on, including itself +partOfGrammar :: Ord i => MGrammar i f a -> (i,ModInfo i f a) -> MGrammar i f a +partOfGrammar gr (i,m) = MGrammar [mo | mo@(j,_) <- mods, elem j modsFor] + where + mods = modules gr + modsFor = case m of + ModMod n -> (i:) $ map openedModule $ allDepsModule gr n + _ -> [i] ---- ModWith? + + -- all modules that a module extends, directly or indirectly allExtends :: (Show i,Ord i) => MGrammar i f a -> i -> [i] allExtends gr i = case lookupModule gr i of @@ -164,6 +174,11 @@ addModule gr name mi = MGrammar $ (modules gr ++ [(name,mi)]) emptyMGrammar :: MGrammar i f a emptyMGrammar = MGrammar [] +emptyModInfo :: ModInfo i f a +emptyModInfo = ModMod emptyModule + +emptyModule :: Module i f a +emptyModule = Module MTResource MSComplete [] Nothing [] NT -- we store the module type with the identifier |
