1
0
forked from GitHub/gf-core

GF.Data.Str: unexport & comment out unused functions

This commit is contained in:
hallgren
2015-12-01 14:32:24 +00:00
parent 5c05f4c6f3
commit 6d51e7f790

View File

@@ -13,15 +13,14 @@
-----------------------------------------------------------------------------
module GF.Data.Str (
Str (..), Tok (..), --- constructors needed in PrGrammar
str2strings, str2allStrings, str, sstr, sstrV,
isZeroTok, prStr, plusStr, glueStr,
strTok,
allItems
Str, Tok, --- constructors no longer needed in PrGrammar
str2strings, str, sstr, --sstrV, str2allStrings,
plusStr, glueStr, --prStr, isZeroTok,
strTok --, allItems
) where
import GF.Data.Operations(prQuotedString)
import Data.List (isPrefixOf, intersperse) --, isSuffixOf
--import GF.Data.Operations(prQuotedString)
import Data.List (isPrefixOf) --, intersperse, isSuffixOf
-- | abstract token list type. AR 2001, revised and simplified 20\/4\/2003
newtype Str = Str [Tok] deriving (Read, Show, Eq, Ord)
@@ -46,10 +45,10 @@ type Ss = [String]
matchPrefix :: Ss -> [(Ss,[String])] -> [String] -> Ss
matchPrefix s vs t =
head $ [u |
(u,as) <- vs,
any (\c -> isPrefixOf c (concat (unmarkup t))) as
] ++ [s]
head $ [u | let t' = concat (unmarkup t),
(u,as) <- vs,
any (`isPrefixOf` t') as]
++ [s]
{-
matchSuffix :: String -> Ss -> [(Ss,[String])] -> Ss
matchSuffix t s vs =
@@ -68,7 +67,7 @@ str2strings (Str st) = alls st where
TN ds vs : ts -> matchPrefix ds vs t ++ t where t = alls ts
---- u :TP ds vs: ts -> [u] ++ matchSuffix u ds vs ++ alls ts
[] -> []
{-
str2allStrings :: Str -> [Ss]
str2allStrings (Str st) = alls st where
alls st = case st of
@@ -76,34 +75,34 @@ str2allStrings (Str st) = alls st where
TN ds vs : [] -> [ds ++ v | v <- map fst vs]
TN ds vs : ts -> [matchPrefix ds vs t ++ t | t <- alls ts]
[] -> [[]]
-}
sstr :: Str -> String
sstr = unwords . str2strings
{-
-- | to handle a list of variants
sstrV :: [Str] -> String
sstrV ss = case ss of
[] -> "*"
_ -> unwords $ intersperse "/" $ map (unwords . str2strings) ss
-}
str :: String -> Str
str s = if null s then Str [] else Str [itS s]
itS :: String -> Tok
itS s = TK s
{-
isZeroTok :: Str -> Bool
isZeroTok t = case t of
Str [] -> True
Str [TK []] -> True
_ -> False
-}
strTok :: Ss -> [(Ss,[String])] -> Str
strTok ds vs = Str [TN ds vs]
{-
prStr :: Str -> String
prStr = prQuotedString . sstr
-}
plusStr :: Str -> Str -> Str
plusStr (Str ss) (Str tt) = Str (ss ++ tt)
@@ -125,10 +124,11 @@ glues ss tt = case (ss,tt) of
([],_) -> tt
(_,[]) -> ss
_ -> init ss ++ [last ss ++ head tt] ++ tail tt
{-
-- | to create the list of all lexical items
allItems :: Str -> [String]
allItems (Str s) = concatMap allOne s where
allOne t = case t of
TK s -> [s]
TN ds vs -> ds ++ concatMap fst vs
-}