summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2009-01-23 07:16:46 +0000
committerkrasimir <krasimir@chalmers.se>2009-01-23 07:16:46 +0000
commitf6661c32137dc2e51c9e6ba1f3f2253b75ba0133 (patch)
treed3e1552511f26ef526c973a553f955e4d59d5862 /src
parentf0718589df2cef815cfef40f8ea6eb6a5fc671ec (diff)
remove some more obsolete code
Diffstat (limited to 'src')
-rw-r--r--src/GF/Compile/Compute.hs3
-rw-r--r--src/GF/Compile/Optimize.hs6
-rw-r--r--src/GF/Grammar/Grammar.hs6
-rw-r--r--src/GF/Grammar/Macros.hs32
-rw-r--r--src/GF/Grammar/PrGrammar.hs1
-rw-r--r--src/GF/Grammar/Printer.hs1
-rw-r--r--src/GF/Source/SourceToGrammar.hs5
7 files changed, 8 insertions, 46 deletions
diff --git a/src/GF/Compile/Compute.hs b/src/GF/Compile/Compute.hs
index 90295b697..d9fb8c12b 100644
--- a/src/GF/Compile/Compute.hs
+++ b/src/GF/Compile/Compute.hs
@@ -56,9 +56,6 @@ computeTermOpt rec gr = comput True where
Q p c | p == cPredef -> return t
| otherwise -> look p c
- -- if computed do nothing
- Computed t' -> return $ unComputed t'
-
Vr x -> do
t' <- maybe (prtBad ("no value given to variable") x) return $ lookup x g
case t' of
diff --git a/src/GF/Compile/Optimize.hs b/src/GF/Compile/Optimize.hs
index 31564d444..177e5bf70 100644
--- a/src/GF/Compile/Optimize.hs
+++ b/src/GF/Compile/Optimize.hs
@@ -168,7 +168,7 @@ partEval opts gr (context, val) trm = errIn ("parteval" +++ prt_ trm) $ do
-- {s = variants {"Auto" ; "Wagen"} ; g = variants {N ; M}} ;
recordExpand :: Type -> Term -> Err Term
-recordExpand typ trm = case unComputed typ of
+recordExpand typ trm = case typ of
RecType tys -> case trm of
FV rs -> return $ FV [R [assign lab (P r lab) | (lab,_) <- tys] | r <- rs]
_ -> return $ R [assign lab (P trm lab) | (lab,_) <- tys]
@@ -179,12 +179,12 @@ recordExpand typ trm = case unComputed typ of
mkLinDefault :: SourceGrammar -> Type -> Err Term
mkLinDefault gr typ = do
- case unComputed typ of
+ case typ of
RecType lts -> mapPairsM mkDefField lts >>= (return . Abs varStr . R . mkAssign)
_ -> liftM (Abs varStr) $ mkDefField typ
---- _ -> prtBad "linearization type must be a record type, not" typ
where
- mkDefField typ = case unComputed typ of
+ mkDefField typ = case typ of
Table p t -> do
t' <- mkDefField t
let T _ cs = mkWildCases t'
diff --git a/src/GF/Grammar/Grammar.hs b/src/GF/Grammar/Grammar.hs
index ec4fd7374..f36177774 100644
--- a/src/GF/Grammar/Grammar.hs
+++ b/src/GF/Grammar/Grammar.hs
@@ -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)
diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs
index 34c6302fd..958ad9a68 100644
--- a/src/GF/Grammar/Macros.hs
+++ b/src/GF/Grammar/Macros.hs
@@ -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
diff --git a/src/GF/Grammar/PrGrammar.hs b/src/GF/Grammar/PrGrammar.hs
index e359d360b..c4be21472 100644
--- a/src/GF/Grammar/PrGrammar.hs
+++ b/src/GF/Grammar/PrGrammar.hs
@@ -45,7 +45,6 @@ import GF.Source.GrammarToSource
import GF.Infra.Option
import GF.Infra.Ident
-import GF.Data.Str
import GF.Infra.CompactPrint
diff --git a/src/GF/Grammar/Printer.hs b/src/GF/Grammar/Printer.hs
index 63cd6e2aa..7145ff33b 100644
--- a/src/GF/Grammar/Printer.hs
+++ b/src/GF/Grammar/Printer.hs
@@ -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
diff --git a/src/GF/Source/SourceToGrammar.hs b/src/GF/Source/SourceToGrammar.hs
index 61912704b..11cec4898 100644
--- a/src/GF/Source/SourceToGrammar.hs
+++ b/src/GF/Source/SourceToGrammar.hs
@@ -31,7 +31,6 @@ import GF.Grammar.Predef
import GF.Infra.Ident
import GF.Source.AbsGF
import GF.Source.PrintGF
-import GF.Compile.RemoveLiT --- for bw compat
import GF.Data.Operations
import GF.Infra.Option
@@ -494,7 +493,6 @@ transExp x = case x of
EPatt patt -> liftM G.EPatt (transPatt patt)
ELString (LString str) -> return $ G.K (BS.unpack str) -- use the grammar encoding here
- ELin id -> liftM G.LiT $ transIdent id
EEqs eqs -> liftM G.Eqs $ mapM transEquation eqs
@@ -656,8 +654,7 @@ transOldGrammar :: Options -> FilePath -> OldGrammar -> Err G.SourceGrammar
transOldGrammar opts name0 x = case x of
OldGr includes topdefs -> do --- includes must be collected separately
let moddefs = sortTopDefs topdefs
- g1 <- transGrammar $ Gr moddefs
- removeLiT g1 --- needed for bw compatibility with an obsolete feature
+ transGrammar $ Gr moddefs
where
sortTopDefs ds = [mkAbs a, mkCnc ops (c ++ r)]
where