hxt-regex-xmlschema 9.0.0 → 9.0.1
raw patch · 3 files changed
+116/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.Regex.Glob.String: match :: String -> String -> Bool
+ Text.Regex.Glob.String: parseRegex :: String -> Regex
+ Text.Regex.Glob.String: type Regex = GenRegex String
+ Text.Regex.Glob.String.RegexParser: parseRegex :: String -> Regex
Files
- hxt-regex-xmlschema.cabal +5/−3
- src/Text/Regex/Glob/String.hs +32/−0
- src/Text/Regex/Glob/String/RegexParser.hs +79/−0
hxt-regex-xmlschema.cabal view
@@ -1,5 +1,5 @@ Name: hxt-regex-xmlschema-Version: 9.0.0+Version: 9.0.1 Synopsis: A regular expression library for W3C XML Schema regular expressions Description: This library supports full W3C XML Schema regular expressions inclusive all Unicode character sets and blocks.@@ -11,7 +11,7 @@ The library can be used for constricting lightweight scanners and tokenizers. It is a standalone library, no external regex libraries are used. This package is a substitute for the old regex-xmlschema package.-License: OtherLicense+License: MIT License-file: LICENSE Author: Uwe Schmidt Maintainer: Uwe Schmidt <uwe@fh-wedel.de>@@ -19,7 +19,6 @@ Stability: stable Category: Text Homepage: http://www.haskell.org/haskellwiki/Regular_expressions_for_XML_Schema-Copyright: Copyright (c) 2010 Uwe Schmidt Build-type: Simple Cabal-version: >=1.6 @@ -39,10 +38,13 @@ Text.Regex.XMLSchema.String.RegexParser Text.Regex.XMLSchema.String.Regex Text.Regex.XMLSchema.String+ Text.Regex.Glob.String.RegexParser+ Text.Regex.Glob.String hs-source-dirs: src ghc-options: -Wall+ ghc-prof-options: -auto-all -caf-all build-depends: base >= 4 && < 5, haskell98 >= 1 && < 2,
+ src/Text/Regex/Glob/String.hs view
@@ -0,0 +1,32 @@+-- ------------------------------------------------------------++{- |+ Module : Text.Regex.Glob.String+ Copyright : Copyright (C) 2011- Uwe Schmidt+ License : MIT++ Maintainer : Uwe Schmidt <uwe@fh-wedel.de>+ Stability : stable+ Portability: portable++ csh glob style pattern matcher+-}++-- ------------------------------------------------------------++module Text.Regex.Glob.String+ ( Regex+ , match+ , parseRegex+ )+where++import Text.Regex.XMLSchema.String.Regex+import Text.Regex.Glob.String.RegexParser++-- ------------------------------------------------------------++match :: String -> String -> Bool+match = matchWithRegex . parseRegex++-- ------------------------------------------------------------
+ src/Text/Regex/Glob/String/RegexParser.hs view
@@ -0,0 +1,79 @@+-- ------------------------------------------------------------++{- |+ Module : Text.Regex.Glob.String.RegexParser+ Copyright : Copyright (C) 2010- Uwe Schmidt+ License : MIT++ Maintainer : Uwe Schmidt (uwe@fh-wedel.de)+ Stability : stable+ Portability: portable++ csh style Glob Pattern Parser for Regular Expressions+-}++-- ------------------------------------------------------------++module Text.Regex.Glob.String.RegexParser+ ( parseRegex+ )+where++import Text.ParserCombinators.Parsec++import Text.Regex.XMLSchema.String.Regex+++-- ------------------------------------------------------------++-- | parse a glob pattern++parseRegex :: String -> Regex+parseRegex+ = either (mkZero . ("syntax error: " ++) . show) id+ .+ parse ( do+ r <- pattern+ eof+ return r+ ) ""++-- ------------------------------------------------------------++pattern :: Parser Regex+pattern+ = many part >>= return . mkSeqs++part :: Parser Regex+part+ = ( many1 (noneOf "\\?*[{") >>= return . mkWord )+ <|>+ ( char '?' >> return mkDot )+ <|>+ ( char '*' >> return mkAll )+ <|>+ ( between (char '{') (char '}') wordList )+ <|>+ ( between (char '[') (char ']') charSet )+ <|>+ ( char '\\' >> anyChar >>= return . mkSym1 )++wordList :: Parser Regex+wordList+ = sepBy (many1 (noneOf ",}")) (char ',') >>= return . foldr mkAlt (mkZero "") . map mkWord++charSet :: Parser Regex+charSet+ = ( do p1 <- charSet' anyChar+ ps <- many $ charSet' (noneOf "]")+ return $ foldr mkAlt (mkZero "") (p1 : ps)+ )+ where+ charSet' cp+ = do c1 <- cp+ c2 <- rest c1+ return $ mkSymRng c1 c2+ rest c1+ = option c1 (char '-' >> anyChar)++-- ------------------------------------------------------------