summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-09-06 20:09:37 +0000
committeraarne <aarne@cs.chalmers.se>2006-09-06 20:09:37 +0000
commitdbc874d62f6b771609e1349c596cf7ae8623375b (patch)
tree811b9f971831cc695bfd3337cea9e9e08dd8fc3a /src
parent9657d57e5bb665efea3f8332d973b666160c58e0 (diff)
finding labels behind selections in GFCC
Diffstat (limited to 'src')
-rw-r--r--src/GF/Canon/CanonToGFCC.hs25
-rw-r--r--src/GF/Canon/log.txt5
2 files changed, 27 insertions, 3 deletions
diff --git a/src/GF/Canon/CanonToGFCC.hs b/src/GF/Canon/CanonToGFCC.hs
index 2881ee4ca..a180d8dd4 100644
--- a/src/GF/Canon/CanonToGFCC.hs
+++ b/src/GF/Canon/CanonToGFCC.hs
@@ -147,10 +147,19 @@ paramValues cgr = (labels,untyps,typs) where
untyps = Map.fromList $ concatMap Map.toList [typ | (_,typ) <- Map.toList typs]
lincats = [(cat,ls) | (_,(cat,CncCat (RecType ls) _ _)) <- jments]
labels = Map.fromList $ concat
- [((cat,[lab]),i):[((cat,[lab,lab2]),j) |
- RecType rs <- [typ], (Lbg lab2 _,j) <- zip rs [0..]]
+ [((cat,[lab]),i):
+ [((cat,[lab,lab2]),j) |
+ RecType rs <- [typ], (Lbg lab2 _,j) <- zip rs [0..]] ++
+ [((cat,[lab,L (IC ("_")),lab2]),j) |
+ rs <- getRec typ, (Lbg lab2 _,j) <- zip rs [0..]]
|
(cat,ls) <- lincats, (Lbg lab typ,i) <- zip ls [0..]]
+ ---- this should be made recursive to give lists of any length
+ where
+ getRec typ = case typ of
+ Table _ (RecType rs) -> [rs]
+ Table _ t -> getRec t
+ _ -> []
term2term :: CanonGrammar -> ParamEnv -> Term -> Term
term2term cgr env@(labels,untyps,typs) tr = case tr of
@@ -173,7 +182,17 @@ term2term cgr env@(labels,untyps,typs) tr = case tr of
P p@(P x@(Arg (A cat i)) lab1) lab2 ->
P (r2r p) . mkLab $ maybe (prtTrace tr $ 66664) id $
Map.lookup (cat,[lab1,lab2]) labels
- P a lab -> P (t2t a) $ mkLab (prtTrace tr 66665)
+ P p lab2 -> case getLab p of
+ Just (cat,lab1) -> P (r2r p) . mkLab $ maybe (prtTrace tr $ 66664) id $
+ Map.lookup (cat,[lab1,L (IC ("_")),lab2]) labels
+ _ -> P (t2t p) $ mkLab (prtTrace tr 66665)
+ P p lab2 -> P (t2t p) $ mkLab (prtTrace tr 66665)
+ _ -> tr ----
+ ---- this should be made recursive
+ getLab tr = case tr of
+ S (P (Arg (A cat i)) lab1) _ -> return (cat,lab1)
+ S p _ -> getLab p
+ _ -> Nothing
mkLab k = L (IC ("_" ++ show k))
valNum tr = maybe (K (KS (A.prt tr +++ prtTrace tr "66667"))) EInt $
Map.lookup tr untyps
diff --git a/src/GF/Canon/log.txt b/src/GF/Canon/log.txt
index 22913ba54..44dba3954 100644
--- a/src/GF/Canon/log.txt
+++ b/src/GF/Canon/log.txt
@@ -13,3 +13,8 @@ GFCC, 6/9/2006
66664 2
66665 125 missing: (VP.s!vf).fin
66668 1
+
+
+66661/3 24 same lines:
+66664 2
+66668 1