diff options
| author | aarne <unknown> | 2003-12-09 16:39:24 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2003-12-09 16:39:24 +0000 |
| commit | 08c9a2ab8cf7b77a5c0392f5f8e9643e39c89c5b (patch) | |
| tree | 56add96ffe8436f3fe920deb4bc7da320bc19e5d /src/GF/Compile/ShellState.hs | |
| parent | 8e637feb793364134d469cb7d1e68605aab2c2ea (diff) | |
Introduced output of stripped format gfcm.
Diffstat (limited to 'src/GF/Compile/ShellState.hs')
| -rw-r--r-- | src/GF/Compile/ShellState.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/GF/Compile/ShellState.hs b/src/GF/Compile/ShellState.hs index 27d88f6fb..d0232b97e 100644 --- a/src/GF/Compile/ShellState.hs +++ b/src/GF/Compile/ShellState.hs @@ -8,6 +8,7 @@ import MMacros import Look import LookAbs +import ModDeps import qualified Modules as M import qualified Grammar as G import qualified PrGrammar as P @@ -19,6 +20,8 @@ import Option import Ident import Arch (ModTime) +import List (nub,nubBy) + -- AR 11/11/2001 -- 17/6/2003 (for modules) ---- unfinished -- multilingual state with grammars and options @@ -169,6 +172,26 @@ filterAbstracts abstr cgr = M.MGrammar [m | m <- ms, needed m] where Just _ -> a : [] _ -> [] + +purgeShellState :: ShellState -> ShellState +purgeShellState sh = ShSt { + abstract = abstract sh, + concrete = concrete sh, + concretes = [(a,i) | (a,i) <- concretes sh, elem i needed], + canModules = M.MGrammar $ purge $ M.modules $ canModules sh, + srcModules = M.emptyMGrammar, + cfs = cfs sh, + morphos = morphos sh, + gloptions = gloptions sh, + readFiles = [], + absCats = absCats sh, + statistics = statistics sh + } + where + needed = nub $ concatMap (requiredCanModules (canModules sh)) acncs + purge = nubBy (\x y -> fst x == fst y) . filter (flip elem needed . fst) + acncs = maybe [] singleton (abstract sh) ++ map snd (concretes sh) + -- form just one state grammar, if unique, from a canonical grammar grammar2stateGrammar :: Options -> CanonGrammar -> Err StateGrammar |
