diff options
| author | aarne <unknown> | 2004-09-14 17:05:46 +0000 |
|---|---|---|
| committer | aarne <unknown> | 2004-09-14 17:05:46 +0000 |
| commit | fe045070cf4333cee0e634db5c877493d1b16030 (patch) | |
| tree | 285273eb564dbd3ad510a183a1c701ec02a1b57a /src/GF/Compile/ShellState.hs | |
| parent | 35f884ddfd984edb7d580cd54c6f2f1ad9358a34 (diff) | |
gfcm header
Diffstat (limited to 'src/GF/Compile/ShellState.hs')
| -rw-r--r-- | src/GF/Compile/ShellState.hs | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/src/GF/Compile/ShellState.hs b/src/GF/Compile/ShellState.hs index 4b1e5a8f3..8676a60b6 100644 --- a/src/GF/Compile/ShellState.hs +++ b/src/GF/Compile/ShellState.hs @@ -119,7 +119,7 @@ updateShellState :: Options -> ShellState -> Err ShellState updateShellState opts sh ((_,sgr,gr),rts) = do let cgr0 = M.updateMGrammar (canModules sh) gr - a' = ifNull Nothing (return . head) $ allAbstracts cgr0 + a' = M.greatestAbstract cgr0 abstr0 <- case abstract sh of Just a -> do -- test that abstract is compatible --- unsafe exception for old? @@ -128,7 +128,7 @@ updateShellState opts sh ((_,sgr,gr),rts) = do return $ Just a _ -> return a' let cgr = filterAbstracts abstr0 cgr0 - let concrs = maybe [] (allConcretes cgr) abstr0 + let concrs = maybe [] (M.allConcretes cgr) abstr0 concr0 = ifNull Nothing (return . head) concrs notInrts f = notElem f $ map fst rts cfs <- mapM (canon2cf opts cgr) concrs --- would not need to update all... @@ -217,37 +217,12 @@ grammar2stateGrammar opts gr = do concr <- maybeErr "no concrete syntax" $ concrete st return $ stateGrammarOfLang st concr --- all abstract modules -allAbstracts :: CanonGrammar -> [Ident] -allAbstracts gr = [i | (i,M.ModMod m) <- M.modules gr, M.mtype m == M.MTAbstract] - --- the last abstract in dependency order (head of list) -greatestAbstract :: CanonGrammar -> Maybe Ident -greatestAbstract gr = case allAbstracts gr of - [] -> Nothing - a -> return $ head a - --- all resource modules -allResources :: G.SourceGrammar -> [Ident] -allResources gr = [i | (i,M.ModMod m) <- M.modules gr, M.isModRes m] - - --- the greatest resource in dependency order -greatestResource :: G.SourceGrammar -> Maybe Ident -greatestResource gr = case allResources gr of - [] -> Nothing - a -> return $ head a - resourceOfShellState :: ShellState -> Maybe Ident -resourceOfShellState = greatestResource . srcModules +resourceOfShellState = M.greatestResource . srcModules qualifTop :: StateGrammar -> G.QIdent -> G.QIdent qualifTop gr (_,c) = (absId gr,c) --- all concretes for a given abstract -allConcretes :: CanonGrammar -> Ident -> [Ident] -allConcretes gr a = [i | (i,M.ModMod m) <- M.modules gr, M.mtype m== M.MTConcrete a] - stateGrammarOfLang :: ShellState -> Language -> StateGrammar stateGrammarOfLang st l = StGr { absId = maybe (identC "Abs") id (abstract st), --- |
