mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
GF.Data.Str: unexport & comment out unused functions
This commit is contained in:
@@ -13,15 +13,14 @@
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
module GF.Data.Str (
|
module GF.Data.Str (
|
||||||
Str (..), Tok (..), --- constructors needed in PrGrammar
|
Str, Tok, --- constructors no longer needed in PrGrammar
|
||||||
str2strings, str2allStrings, str, sstr, sstrV,
|
str2strings, str, sstr, --sstrV, str2allStrings,
|
||||||
isZeroTok, prStr, plusStr, glueStr,
|
plusStr, glueStr, --prStr, isZeroTok,
|
||||||
strTok,
|
strTok --, allItems
|
||||||
allItems
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import GF.Data.Operations(prQuotedString)
|
--import GF.Data.Operations(prQuotedString)
|
||||||
import Data.List (isPrefixOf, intersperse) --, isSuffixOf
|
import Data.List (isPrefixOf) --, intersperse, isSuffixOf
|
||||||
|
|
||||||
-- | abstract token list type. AR 2001, revised and simplified 20\/4\/2003
|
-- | abstract token list type. AR 2001, revised and simplified 20\/4\/2003
|
||||||
newtype Str = Str [Tok] deriving (Read, Show, Eq, Ord)
|
newtype Str = Str [Tok] deriving (Read, Show, Eq, Ord)
|
||||||
@@ -46,10 +45,10 @@ type Ss = [String]
|
|||||||
|
|
||||||
matchPrefix :: Ss -> [(Ss,[String])] -> [String] -> Ss
|
matchPrefix :: Ss -> [(Ss,[String])] -> [String] -> Ss
|
||||||
matchPrefix s vs t =
|
matchPrefix s vs t =
|
||||||
head $ [u |
|
head $ [u | let t' = concat (unmarkup t),
|
||||||
(u,as) <- vs,
|
(u,as) <- vs,
|
||||||
any (\c -> isPrefixOf c (concat (unmarkup t))) as
|
any (`isPrefixOf` t') as]
|
||||||
] ++ [s]
|
++ [s]
|
||||||
{-
|
{-
|
||||||
matchSuffix :: String -> Ss -> [(Ss,[String])] -> Ss
|
matchSuffix :: String -> Ss -> [(Ss,[String])] -> Ss
|
||||||
matchSuffix t s vs =
|
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
|
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
|
---- u :TP ds vs: ts -> [u] ++ matchSuffix u ds vs ++ alls ts
|
||||||
[] -> []
|
[] -> []
|
||||||
|
{-
|
||||||
str2allStrings :: Str -> [Ss]
|
str2allStrings :: Str -> [Ss]
|
||||||
str2allStrings (Str st) = alls st where
|
str2allStrings (Str st) = alls st where
|
||||||
alls st = case st of
|
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 : [] -> [ds ++ v | v <- map fst vs]
|
||||||
TN ds vs : ts -> [matchPrefix ds vs t ++ t | t <- alls ts]
|
TN ds vs : ts -> [matchPrefix ds vs t ++ t | t <- alls ts]
|
||||||
[] -> [[]]
|
[] -> [[]]
|
||||||
|
-}
|
||||||
sstr :: Str -> String
|
sstr :: Str -> String
|
||||||
sstr = unwords . str2strings
|
sstr = unwords . str2strings
|
||||||
|
{-
|
||||||
-- | to handle a list of variants
|
-- | to handle a list of variants
|
||||||
sstrV :: [Str] -> String
|
sstrV :: [Str] -> String
|
||||||
sstrV ss = case ss of
|
sstrV ss = case ss of
|
||||||
[] -> "*"
|
[] -> "*"
|
||||||
_ -> unwords $ intersperse "/" $ map (unwords . str2strings) ss
|
_ -> unwords $ intersperse "/" $ map (unwords . str2strings) ss
|
||||||
|
-}
|
||||||
str :: String -> Str
|
str :: String -> Str
|
||||||
str s = if null s then Str [] else Str [itS s]
|
str s = if null s then Str [] else Str [itS s]
|
||||||
|
|
||||||
itS :: String -> Tok
|
itS :: String -> Tok
|
||||||
itS s = TK s
|
itS s = TK s
|
||||||
|
{-
|
||||||
isZeroTok :: Str -> Bool
|
isZeroTok :: Str -> Bool
|
||||||
isZeroTok t = case t of
|
isZeroTok t = case t of
|
||||||
Str [] -> True
|
Str [] -> True
|
||||||
Str [TK []] -> True
|
Str [TK []] -> True
|
||||||
_ -> False
|
_ -> False
|
||||||
|
-}
|
||||||
strTok :: Ss -> [(Ss,[String])] -> Str
|
strTok :: Ss -> [(Ss,[String])] -> Str
|
||||||
strTok ds vs = Str [TN ds vs]
|
strTok ds vs = Str [TN ds vs]
|
||||||
|
{-
|
||||||
prStr :: Str -> String
|
prStr :: Str -> String
|
||||||
prStr = prQuotedString . sstr
|
prStr = prQuotedString . sstr
|
||||||
|
-}
|
||||||
plusStr :: Str -> Str -> Str
|
plusStr :: Str -> Str -> Str
|
||||||
plusStr (Str ss) (Str tt) = Str (ss ++ tt)
|
plusStr (Str ss) (Str tt) = Str (ss ++ tt)
|
||||||
|
|
||||||
@@ -125,10 +124,11 @@ glues ss tt = case (ss,tt) of
|
|||||||
([],_) -> tt
|
([],_) -> tt
|
||||||
(_,[]) -> ss
|
(_,[]) -> ss
|
||||||
_ -> init ss ++ [last ss ++ head tt] ++ tail tt
|
_ -> init ss ++ [last ss ++ head tt] ++ tail tt
|
||||||
|
{-
|
||||||
-- | to create the list of all lexical items
|
-- | to create the list of all lexical items
|
||||||
allItems :: Str -> [String]
|
allItems :: Str -> [String]
|
||||||
allItems (Str s) = concatMap allOne s where
|
allItems (Str s) = concatMap allOne s where
|
||||||
allOne t = case t of
|
allOne t = case t of
|
||||||
TK s -> [s]
|
TK s -> [s]
|
||||||
TN ds vs -> ds ++ concatMap fst vs
|
TN ds vs -> ds ++ concatMap fst vs
|
||||||
|
-}
|
||||||
Reference in New Issue
Block a user