diff options
| author | krasimir <krasimir@chalmers.se> | 2009-01-23 07:16:46 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2009-01-23 07:16:46 +0000 |
| commit | f6661c32137dc2e51c9e6ba1f3f2253b75ba0133 (patch) | |
| tree | d3e1552511f26ef526c973a553f955e4d59d5862 /src/GF/Grammar | |
| parent | f0718589df2cef815cfef40f8ea6eb6a5fc671ec (diff) | |
remove some more obsolete code
Diffstat (limited to 'src/GF/Grammar')
| -rw-r--r-- | src/GF/Grammar/Grammar.hs | 6 | ||||
| -rw-r--r-- | src/GF/Grammar/Macros.hs | 32 | ||||
| -rw-r--r-- | src/GF/Grammar/PrGrammar.hs | 1 | ||||
| -rw-r--r-- | src/GF/Grammar/Printer.hs | 1 |
4 files changed, 4 insertions, 36 deletions
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
|
