summaryrefslogtreecommitdiff
path: root/src/GF/Canon/CMacros.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GF/Canon/CMacros.hs')
-rw-r--r--src/GF/Canon/CMacros.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/GF/Canon/CMacros.hs b/src/GF/Canon/CMacros.hs
index 17433e48b..d32f639b4 100644
--- a/src/GF/Canon/CMacros.hs
+++ b/src/GF/Canon/CMacros.hs
@@ -152,3 +152,15 @@ redirectIdent n f@(CIQ _ c) = CIQ n c
ciq n f = CIQ n f
+wordsInTerm :: Term -> [String]
+wordsInTerm trm = filter (not . null) $ case trm of
+ K (KS s) -> [s]
+ S c _ -> wo c
+ R rs -> concat [wo t | Ass _ t <- rs]
+ T _ cs -> concat [wo t | Cas _ t <- cs]
+ C s t -> wo s ++ wo t
+ FV ts -> concatMap wo ts
+ K (KP ss vs) -> ss ++ concat [s ++ t | Var s t <- vs]
+ P t _ -> wo t --- not needed ?
+ _ -> []
+ where wo = wordsInTerm