summaryrefslogtreecommitdiff
path: root/src/GF/Compile
diff options
context:
space:
mode:
authoraarne <unknown>2004-04-01 09:51:32 +0000
committeraarne <unknown>2004-04-01 09:51:32 +0000
commitf53f35978f4cd6b0e4c5e9123b5e88f04f6f4452 (patch)
tree100fc2f36a0dccc24c030b5a82389dac70780902 /src/GF/Compile
parent3f9b4e7855cf4594708a9fbad194c89540d2cf1e (diff)
2beta2
Diffstat (limited to 'src/GF/Compile')
-rw-r--r--src/GF/Compile/Compile.hs5
-rw-r--r--src/GF/Compile/ShellState.hs14
2 files changed, 17 insertions, 2 deletions
diff --git a/src/GF/Compile/Compile.hs b/src/GF/Compile/Compile.hs
index 145ada8a9..88f601a18 100644
--- a/src/GF/Compile/Compile.hs
+++ b/src/GF/Compile/Compile.hs
@@ -56,8 +56,9 @@ batchCompileOld f = compileOld defOpts f
compileModule :: Options -> ShellState -> FilePath ->
IOE (GFC.CanonGrammar, (SourceGrammar,[(FilePath,ModTime)]))
-compileModule opts st0 file | oElem showOld opts ||
- elem suff ["cf","ebnf"] = do
+compileModule opts st0 file |
+ oElem showOld opts ||
+ elem suff ["cf","ebnf"] = do
let putp = putPointE opts
let path = [] ----
grammar1 <- if suff == "cf"
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)