summaryrefslogtreecommitdiff
path: root/src/GF/Compile/ShellState.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Compile/ShellState.hs')
-rw-r--r--src/GF/Compile/ShellState.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/GF/Compile/ShellState.hs b/src/GF/Compile/ShellState.hs
index 7c674a0dc..9bfc4a048 100644
--- a/src/GF/Compile/ShellState.hs
+++ b/src/GF/Compile/ShellState.hs
@@ -210,6 +210,20 @@ greatestAbstract gr = case allAbstracts gr of
[] -> Nothing
a -> return $ last a
+-- all resource modules
+allResources :: G.SourceGrammar -> [Ident]
+allResources gr = [i | (i,M.ModMod m) <- M.modules gr, M.mtype m == M.MTResource]
+
+
+-- the last resource in dependency order
+greatestResource :: G.SourceGrammar -> Maybe Ident
+greatestResource gr = case allResources gr of
+ [] -> Nothing
+ a -> return $ last a
+
+resourceOfShellState :: ShellState -> Maybe Ident
+resourceOfShellState = greatestResource . srcModules
+
qualifTop :: StateGrammar -> G.QIdent -> G.QIdent
qualifTop gr (_,c) = (absId gr,c)