summaryrefslogtreecommitdiff
path: root/src-2.9/GF/UseGrammar/MatchTerm.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-05-21 09:26:44 +0000
committeraarne <aarne@cs.chalmers.se>2008-05-21 09:26:44 +0000
commit055c0d0d5a5bb0dc75904fe53df7f2e4f5732a8f (patch)
tree0e63fb68c69c8f6ad0f78893c63420f0a3600e1c /src-2.9/GF/UseGrammar/MatchTerm.hs
parent915a1de71783ab8446b1af9e72c7ba7dfbc12d3f (diff)
GF/src is now for 2.9, and the new sources are in src-3.0 - keep it this way until the release of GF 3
Diffstat (limited to 'src-2.9/GF/UseGrammar/MatchTerm.hs')
-rw-r--r--src-2.9/GF/UseGrammar/MatchTerm.hs50
1 files changed, 0 insertions, 50 deletions
diff --git a/src-2.9/GF/UseGrammar/MatchTerm.hs b/src-2.9/GF/UseGrammar/MatchTerm.hs
deleted file mode 100644
index 9acffd44c..000000000
--- a/src-2.9/GF/UseGrammar/MatchTerm.hs
+++ /dev/null
@@ -1,50 +0,0 @@
-----------------------------------------------------------------------
--- |
--- Module : MatchTerm
--- Maintainer : AR
--- Stability : (stable)
--- Portability : (portable)
---
---
--- functions for matching with terms. AR 16/3/2006
------------------------------------------------------------------------------
-
-module GF.UseGrammar.MatchTerm where
-
-import GF.Data.Operations
-import GF.Data.Zipper
-
-import GF.Grammar.Grammar
-import GF.Grammar.PrGrammar
-import GF.Infra.Ident
-import GF.Grammar.Values
-import GF.Grammar.Macros
-import GF.Grammar.MMacros
-
-import Control.Monad
-import Data.List
-
--- test if a term has duplicated idents, either any or just atoms
-
-hasDupIdent, hasDupAtom :: Exp -> Bool
-hasDupIdent = (>1) . maximum . map length . group . sort . allConstants True
-hasDupAtom = (>1) . maximum . map length . group . sort . allConstants False
-
--- test if a certain ident occurs in term
-
-grepIdent :: Ident -> Exp -> Bool
-grepIdent c = elem c . allConstants True
-
--- form the list of all constants, optionally ignoring all but atoms
-
-allConstants :: Bool -> Exp -> [Ident]
-allConstants alsoApp = err (const []) snd . flip appSTM [] . collect where
- collect e = case e of
- Q _ c -> add c e
- QC _ c -> add c e
- Cn c -> add c e
- App f a | not alsoApp -> case f of
- App g b -> collect b >> collect a
- _ -> collect a
- _ -> composOp collect e
- add c e = updateSTM (c:) >> return e