summaryrefslogtreecommitdiff
path: root/src/GF/Canon
diff options
context:
space:
mode:
authoraarne <unknown>2005-09-20 08:32:55 +0000
committeraarne <unknown>2005-09-20 08:32:55 +0000
commit6d179267de8f988ab2ee52a5fef99b3b05576222 (patch)
treea543ed396c364bd63987517b8ead00fb9d193213 /src/GF/Canon
parent263beccd56f5a6242ea97e696a9843cd0f597e16 (diff)
CSEE now works fine
Diffstat (limited to 'src/GF/Canon')
-rw-r--r--src/GF/Canon/Look.hs6
-rw-r--r--src/GF/Canon/Subexpressions.hs11
2 files changed, 10 insertions, 7 deletions
diff --git a/src/GF/Canon/Look.hs b/src/GF/Canon/Look.hs
index 0ba888beb..c0566f4dc 100644
--- a/src/GF/Canon/Look.hs
+++ b/src/GF/Canon/Look.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/09/19 16:11:06 $
+-- > CVS $Date: 2005/09/20 09:32:56 $
-- > CVS $Author: aarne $
--- > CVS $Revision: 1.16 $
+-- > CVS $Revision: 1.17 $
--
-- lookup in GFC. AR 2003
-----------------------------------------------------------------------------
@@ -187,7 +187,7 @@ ccompute cnc = comp []
_ -> return t
where
compt = comp g xs
- look c = lookupGlobal cnc c
+ look c = lookupGlobal cnc c >>= compt
lookVar c co = case lookup c co of
Just t -> return t
diff --git a/src/GF/Canon/Subexpressions.hs b/src/GF/Canon/Subexpressions.hs
index b1891d065..4ec645b05 100644
--- a/src/GF/Canon/Subexpressions.hs
+++ b/src/GF/Canon/Subexpressions.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/09/19 13:01:18 $
+-- > CVS $Date: 2005/09/20 09:32:56 $
-- > CVS $Author: aarne $
--- > CVS $Revision: 1.3 $
+-- > CVS $Revision: 1.4 $
--
-- Common subexpression elimination.
-- all tables. AR 18\/9\/2005.
@@ -80,11 +80,14 @@ unSubelimCanon gr@(M.MGrammar modules) =
unSubelimModule :: CanonModule -> CanonModule
unSubelimModule mo@(i,m) = case m of
- M.ModMod (M.Module mt@(M.MTConcrete _) st fs me ops js) ->
+ M.ModMod (M.Module mt@(M.MTConcrete _) st fs me ops js) | hasSub ljs ->
(i, M.ModMod (M.Module mt st fs me ops
- (rebuild (map unparInfo (tree2list js)))))
+ (rebuild (map unparInfo ljs))))
+ where ljs = tree2list js
_ -> (i,m)
where
+ -- perform this iff the module has opers
+ hasSub ljs = not $ null [c | (c,ResOper _ _) <- ljs]
unparInfo (c,info) = case info of
CncFun k xs t m -> [(c, CncFun k xs (unparTerm t) m)]
ResOper _ _ -> []