summaryrefslogtreecommitdiff
path: root/src/GF/Data/Str.hs
diff options
context:
space:
mode:
authoraarne <unknown>2003-11-17 15:17:53 +0000
committeraarne <unknown>2003-11-17 15:17:53 +0000
commit70c9f7b365b07044c07837a04223a11dfa3b7140 (patch)
treeb39c484dd86d6226f716f241da0b4a85a630a6a0 /src/GF/Data/Str.hs
parent9d55f72d7a97658faa6ebc890535fa0c6e665a05 (diff)
Lexer by need.
Diffstat (limited to 'src/GF/Data/Str.hs')
-rw-r--r--src/GF/Data/Str.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/GF/Data/Str.hs b/src/GF/Data/Str.hs
index 0c1ecf7c9..6433e5355 100644
--- a/src/GF/Data/Str.hs
+++ b/src/GF/Data/Str.hs
@@ -32,12 +32,21 @@ type Ss = [String]
matchPrefix :: Ss -> [(Ss,[String])] -> [String] -> Ss
matchPrefix s vs t =
- head ([u | (u,as) <- vs, any (\c -> isPrefixOf c (concat t)) as] ++ [s])
+ head $ [u |
+ (u,as) <- vs,
+ any (\c -> isPrefixOf c (concat (unmarkup t))) as
+ ] ++ [s]
matchSuffix :: String -> Ss -> [(Ss,[String])] -> Ss
matchSuffix t s vs =
head ([u | (u,as) <- vs, any (\c -> isSuffixOf c t) as] ++ [s])
+unmarkup :: [String] -> [String]
+unmarkup = filter (not . isXMLtag) where
+ isXMLtag s = case s of
+ '<':cs@(_:_) -> last cs == '>'
+ _ -> False
+
str2strings :: Str -> Ss
str2strings (Str st) = alls st where
alls st = case st of