remove some more obsolete code

This commit is contained in:
krasimir
2009-01-23 07:16:46 +00:00
parent 724417916c
commit d5f4482e39
7 changed files with 8 additions and 46 deletions

View File

@@ -48,7 +48,6 @@ module GF.Grammar.Grammar (SourceGrammar,
ident2label, label2ident
) where
import GF.Data.Str
import GF.Infra.Ident
import GF.Infra.Option ---
import GF.Infra.Modules
@@ -164,11 +163,6 @@ data Term =
| Alts (Term, [(Term, Term)]) -- ^ alternatives by prefix: @pre {t ; s\/c ; ...}@
| Strs [Term] -- ^ conditioning prefix strings: @strs {s ; ...}@
--
-- /below this, the last three constructors are obsolete/
| LiT Ident -- ^ linearization type
| Ready Str -- ^ result of compiling; not to be parsed ...
| Computed Term -- ^ result of computing: not to be reopened nor parsed
deriving (Read, Show, Eq, Ord)

View File

@@ -136,28 +136,6 @@ contextOfType typ = case typ of
Prod x a b -> liftM ((x,a):) $ contextOfType b
_ -> return []
unComputed :: Term -> Term
unComputed t = case t of
Computed v -> unComputed v
_ -> t --- composSafeOp unComputed t
{-
--- defined (better) in compile/PrOld
stripTerm :: Term -> Term
stripTerm t = case t of
Q _ c -> Cn c
QC _ c -> Cn c
T ti psts -> T ti [(stripPatt p, stripTerm v) | (p,v) <- psts]
_ -> composSafeOp stripTerm t
where
stripPatt p = errVal p $ term2patt $ stripTerm $ patt2term p
-}
computed :: Term -> Term
computed = Computed
termForm :: Term -> Err ([(Ident)], Term, [Term])
termForm t = case t of
Abs x b ->
@@ -322,7 +300,7 @@ mkFunType :: [Type] -> Type -> Type
mkFunType tt t = mkProd ([(identW, ty) | ty <- tt], t, []) -- nondep prod
plusRecType :: Type -> Type -> Err Type
plusRecType t1 t2 = case (unComputed t1, unComputed t2) of
plusRecType t1 t2 = case (t1, t2) of
(RecType r1, RecType r2) -> case
filter (`elem` (map fst r1)) (map fst r2) of
[] -> return (RecType (r1 ++ r2))
@@ -520,13 +498,13 @@ redirectTerm n t = case t of
-- | to gather ultimate cases in a table; preserves pattern list
allCaseValues :: Term -> [([Patt],Term)]
allCaseValues trm = case unComputed trm of
allCaseValues trm = case trm of
T _ cs -> [(p:ps, t) | (p,t0) <- cs, (ps,t) <- allCaseValues t0]
_ -> [([],trm)]
-- | to get a string from a term that represents a sequence of terminals
strsFromTerm :: Term -> Err [Str]
strsFromTerm t = case unComputed t of
strsFromTerm t = case t of
K s -> return [str s]
Empty -> return [str []]
C s t -> do
@@ -549,7 +527,6 @@ strsFromTerm t = case unComputed t of
]
FV ts -> mapM strsFromTerm ts >>= return . concat
Strs ts -> mapM strsFromTerm ts >>= return . concat
Ready ss -> return [ss]
Alias _ _ d -> strsFromTerm d --- should not be needed...
_ -> prtBad "cannot get Str from term" t
@@ -696,7 +673,7 @@ collectOp co trm = case trm of
Alts (t,aa) -> let (x,y) = unzip aa in co t ++ concatMap co (x ++ y)
FV ts -> concatMap co ts
Strs tt -> concatMap co tt
_ -> [] -- covers K, Vr, Cn, Sort, Ready
_ -> [] -- covers K, Vr, Cn, Sort
-- | to find the word items in a term
wordsInTerm :: Term -> [String]
@@ -704,7 +681,6 @@ wordsInTerm trm = filter (not . null) $ case trm of
K s -> [s]
S c _ -> wo c
Alts (t,aa) -> wo t ++ concatMap (wo . fst) aa
Ready s -> allItems s
_ -> collectOp wo trm
where wo = wordsInTerm

View File

@@ -45,7 +45,6 @@ import GF.Source.GrammarToSource
import GF.Infra.Option
import GF.Infra.Ident
import GF.Data.Str
import GF.Infra.CompactPrint

View File

@@ -156,7 +156,6 @@ ppTerm d (Alts (e,xs))=text "pre" <+> braces (ppTerm 0 e <> semi <+> fsep (punct
ppTerm d (Strs es) = text "strs" <+> braces (fsep (punctuate semi (map (ppTerm 0) es)))
ppTerm d (EPatt p) = prec d 4 (char '#' <+> ppPatt 2 p)
ppTerm d (EPattType t)=prec d 4 (text "pattern" <+> ppTerm 0 t)
ppTerm d (LiT id) = text "Lin" <+> ppIdent id
ppTerm d (P t l) = prec d 5 (ppTerm 5 t <> char '.' <> ppLabel l)
ppTerm d (Cn id) = ppIdent id
ppTerm d (Vr id) = ppIdent id