summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2015-12-01 14:32:24 +0000
committerhallgren <hallgren@chalmers.se>2015-12-01 14:32:24 +0000
commitd6ae5e811b7d61ab714b2cab1437af2c350aefb6 (patch)
tree6e4aa6aefccac6df605e251995918474ed3777a1 /src/compiler
parentfffab8746909950b7a1bbcbe6271dd541266dd52 (diff)
GF.Data.Str: unexport & comment out unused functions
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/GF/Data/Str.hs40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/compiler/GF/Data/Str.hs b/src/compiler/GF/Data/Str.hs
index 0c9ab05ec..7b79add0a 100644
--- a/src/compiler/GF/Data/Str.hs
+++ b/src/compiler/GF/Data/Str.hs
@@ -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
+-} \ No newline at end of file