summaryrefslogtreecommitdiff
path: root/src/GF/Canon
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Canon')
-rw-r--r--src/GF/Canon/CMacros.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/GF/Canon/CMacros.hs b/src/GF/Canon/CMacros.hs
index a89d13611..609e8e869 100644
--- a/src/GF/Canon/CMacros.hs
+++ b/src/GF/Canon/CMacros.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/09/16 13:56:12 $
+-- > CVS $Date: 2005/11/14 16:03:41 $
-- > CVS $Author: aarne $
--- > CVS $Revision: 1.28 $
+-- > CVS $Revision: 1.29 $
--
-- Macros for building and analysing terms in GFC concrete syntax.
--
@@ -225,6 +225,15 @@ allLinValues trm = do
lts <- allLinFields trm
mapM (mapPairsM (return . allCaseValues)) lts
+-- | to gather all linearizations, even from nested records; params ignored
+allLinBranches :: Term -> [([Label],Term)]
+allLinBranches trm = case trm of
+ R rs -> [(l:ls,u) | Ass l t <- rs, (ls,u) <- allLinBranches t]
+ FV ts -> concatMap allLinBranches ts
+ T _ ts -> concatMap allLinBranches [t | Cas _ t <- ts]
+ V _ ts -> concatMap allLinBranches ts
+ _ -> [([],trm)]
+
redirectIdent :: A.Ident -> CIdent -> CIdent
redirectIdent n f@(CIQ _ c) = CIQ n c