summaryrefslogtreecommitdiff
path: root/src/GF/Grammar/Compute.hs
diff options
context:
space:
mode:
authoraarne <unknown>2004-11-27 08:13:45 +0000
committeraarne <unknown>2004-11-27 08:13:45 +0000
commit84c23918d01e5b02dc578c0d67efb371d0476cda (patch)
treef7b39d9b018d4ff4e5661068c42cf6a76818bafc /src/GF/Grammar/Compute.hs
parentfcbe58ef07be9f6177410d2c2c785f3261000648 (diff)
finishing verbs; bug fixes in comp
Diffstat (limited to 'src/GF/Grammar/Compute.hs')
-rw-r--r--src/GF/Grammar/Compute.hs22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/GF/Grammar/Compute.hs b/src/GF/Grammar/Compute.hs
index 6c557b479..5573e5e4e 100644
--- a/src/GF/Grammar/Compute.hs
+++ b/src/GF/Grammar/Compute.hs
@@ -139,6 +139,13 @@ computeTerm gr = comp where
foldr1 C (map K (str2strings (glueStr v (str a)))) | v <- x']
,return $ Glue x y
]
+ (FV ks,_) -> do
+ kys <- mapM (comp g . flip Glue y) ks
+ return $ FV kys
+ (_,FV ks) -> do
+ xks <- mapM (comp g . Glue x) ks
+ return $ FV xks
+
_ -> do
mapM_ checkNoArgVars [x,y]
r <- composOp (comp g) t
@@ -152,10 +159,17 @@ computeTerm gr = comp where
C a b -> do
a' <- comp g a
b' <- comp g b
- returnC $ case (a',b') of
- (Empty,_) -> b'
- (_,Empty) -> a'
- _ -> C a' b'
+ case (a',b') of
+ (Alts _, K a) -> checks [do
+ as <- strsFromTerm a' -- this may fail when compiling opers
+ return $ variants [
+ foldr1 C (map K (str2strings (plusStr v (str a)))) | v <- as]
+ ,
+ return $ C a' b'
+ ]
+ (Empty,_) -> returnC b'
+ (_,Empty) -> returnC a'
+ _ -> returnC $ C a' b'
-- reduce free variation as much as you can
FV [t] -> comp g t