regex-xmlschema 0.1.3 → 0.1.4
raw patch · 3 files changed
+49/−30 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- examples/test/Main.hs +1/−0
- regex-xmlschema.cabal +22/−14
- src/Text/Regex/XMLSchema/String/RegexParser.hs +26/−16
examples/test/Main.hs view
@@ -46,6 +46,7 @@ , ("[\0-\1114111]", "\\a") , ("[\0-\1114111]|[0-9]", "\\a") , ("[\0-\1114110]", "[�-]" )+ , ("[abc-[b]]", "[ac]" ) , ("a|b|c|d", "[a-d]" ) , ("(a|b)|c", "[a-c]" ) , ("a|(b|c)", "[a-c]" )
regex-xmlschema.cabal view
@@ -1,17 +1,25 @@-name: regex-xmlschema-version: 0.1.3-license: BSD3-license-file: LICENSE-maintainer: Uwe Schmidt <uwe@fh-wedel.de>-stability: experimental-category: Text-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. The complete grammar can be found under <http://www.w3.org/TR/xmlschema11-2/#regexs>. It is implemented by the technique of derivations of regular expressions. The W3C syntax is extended to support not only union of regular sets, but also intersection, set difference, exor. Matching of subexpressions is also supported. The library can be used for constricting lightweight scanners and tokenizers. It is a standalone library, no external regex libraries are used.-homepage: http://www.haskell.org/haskellwiki/Regular_expressions_for_XML_Schema-copyright: Copyright (c) 2009 Uwe Schmidt-build-type: Simple-cabal-version: >=1.6-tested-with: GHC+Name: regex-xmlschema+Version: 0.1.4+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.+ The complete grammar can be found under <http://www.w3.org/TR/xmlschema11-2/#regexs>.+ It is implemented by the technique of derivations of regular expressions.+ The W3C syntax is extended to support not only union of regular sets,+ but also intersection, set difference, exor.+ Matching of subexpressions is also supported.+ The library can be used for constricting lightweight scanners and tokenizers.+ It is a standalone library, no external regex libraries are used.+License: BSD3+License-file: LICENSE+Author: Uwe Schmidt+Maintainer: Uwe Schmidt <uwe@fh-wedel.de>+Stability: experimental+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 extra-source-files: examples/test/Main.hs
src/Text/Regex/XMLSchema/String/RegexParser.hs view
@@ -151,15 +151,15 @@ quantifier :: Regex -> Parser Regex quantifier r = ( do- char '?'+ _ <- char '?' return $ mkOpt r ) <|> ( do- char '*'+ _ <- char '*' return $ mkStar r ) <|> ( do- char '+'+ _ <- char '+' return $ mkRep 1 r ) <|> try ( do@@ -180,7 +180,7 @@ quantityRest :: Regex -> Int -> Parser Regex quantityRest r lb = ( do- char ','+ _ <- char ',' ub <- many digit return ( if null ub then mkRep lb r@@ -227,7 +227,7 @@ charClassEsc :: Parser Regex charClassEsc = do- char '\\'+ _ <- char '\\' ( singleCharEsc <|> multiCharEsc@@ -297,7 +297,7 @@ isBlock :: Parser CharSet isBlock = do- string "Is"+ _ <- string "Is" name <- many1 (satisfy legalChar) case lookup name codeBlocks of Just b -> return $ uncurry rangeCS b@@ -369,7 +369,7 @@ where prop c1 cs2 = do- char c1+ _ <- char c1 s2 <- option "" ( do c2 <- satisfy (`elem` cs2)@@ -379,7 +379,7 @@ complEsc :: Parser Regex complEsc = do- char 'P'+ _ <- char 'P' s <- between (char '{') (char '}') charProp return $ mkSym $ compCS s @@ -396,7 +396,7 @@ ) s <- option (mkZero "") -- charClassSub ( do- char '-'+ _ <- char '-' charClassExpr ) return $ mkDiff r s@@ -417,26 +417,36 @@ seRange = do c1 <- charOrEsc'- char '-'+ _ <- char '-' c2 <- charOrEsc' return $ mkSymRng c1 c2 charOrEsc' :: Parser Char charOrEsc'- = satisfy (`notElem` "\\-[]")+ = ( do+ _ <- char '\\'+ singleCharEsc'+ ) <|>- singleCharEsc'+ satisfy (`notElem` "\\-[]") xmlCharIncDash :: Parser Regex xmlCharIncDash- = do- c <- satisfy (`notElem` "\\[]")- return $ mkSym1 c+ = try ( do -- dash is only allowed if not followed by a [, else charGroup differences do not parse correctly+ _ <- char '-'+ notFollowedBy (char '[')+ return $ mkSym1 '-'+ )+ <|>+ ( do+ c <- satisfy (`notElem` "-\\[]")+ return $ mkSym1 c+ ) negCharGroup :: Parser Regex negCharGroup = do- char '^'+ _ <- char '^' r <- posCharGroup return $ mkDiff mkDot r