packages feed

hxt-charproperties 9.0.0 → 9.1.0

raw patch · 3 files changed

+154/−10 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Char.Properties.XMLCharProps: charPropXmlCharCR :: CharSet
+ Data.Char.Properties.XMLCharProps: charPropXmlSpaceCharCR :: CharSet
+ Data.Char.Properties.XMLCharProps: isXmlCharCR :: Char -> Bool
+ Data.Char.Properties.XMLCharProps: isXmlSpaceCharCR :: Char -> Bool

Files

hxt-charproperties.cabal view
@@ -1,5 +1,5 @@ Name:                hxt-charproperties-Version:             9.0.0+Version:             9.1.0 Synopsis:            Character properties and classes for XML and Unicode Description:         Character proprties defined by XML and Unicode standards.                      These modules contain predicates for Unicode blocks and char proprties@@ -38,4 +38,5 @@      hs-source-dirs: src -  ghc-options: -Wall+  ghc-options: -Wall -O2+  ghc-prof-options: -auto-all -caf-all
src/Data/Char/Properties/XMLCharProps.hs view
@@ -17,9 +17,11 @@  module Data.Char.Properties.XMLCharProps     ( isXmlChar+    , isXmlCharCR     , isXml1ByteChar     , isXmlLatin1Char     , isXmlSpaceChar+    , isXmlSpaceCharCR     , isXml11SpaceChar     , isXmlNameChar     , isXmlNameStartChar@@ -35,9 +37,11 @@     , isXmlControlOrPermanentlyUndefined      , charPropXmlChar+    , charPropXmlCharCR     , charPropXml1ByteChar     , charPropXmlLatin1Char     , charPropXmlSpaceChar+    , charPropXmlSpaceCharCR     , charPropXml11SpaceChar     , charPropXmlNameChar     , charPropXmlNameStartChar@@ -62,8 +66,25 @@ -- checking for valid XML characters  isXmlChar :: Char -> Bool+isXmlChar c                                     -- optimized+    = ( c >= ' ' && c <= '\55295' )+      ||+      c `elem` ['\n', '\t', '\r']+      ||+      ( c >= '\57344'+        &&+        ( c <= '\65533'+          ||+          c >= '\65536' &&   c <= '\1114111'+        )+      )++{- old isXmlChar c = c `elemCS` charPropXmlChar+-} +{-# INLINE isXmlChar #-}+ charPropXmlChar :: CharSet charPropXmlChar     = [ ('\x0009', '\x000A')@@ -74,14 +95,46 @@       ]  -- |+-- checking for valid XML characters, except CR++isXmlCharCR :: Char -> Bool+isXmlCharCR c                                     -- optimized+    = ( c >= ' ' && c <= '\55295' )+      ||+      c `elem` ['\n', '\t']+      ||+      ( c >= '\57344'+        &&+        ( c <= '\65533'+          ||+          c >= '\65536' &&   c <= '\1114111'+        )+      )++{- old+isXmlCharCR c = c `elemCS` charPropXmlCharCR+-}++{-# INLINE isXmlCharCR #-}++charPropXmlCharCR :: CharSet+charPropXmlCharCR+    = [ ('\x0009', '\x000A')+      , ('\x0020', '\xD7FF')+      , ('\xE000', '\xFFFD')+      , ('\x10000', '\x10FFFF')+      ]++-- | -- check for a legal 1 byte XML char  isXml1ByteChar :: Char -> Bool isXml1ByteChar c = c `elemCS` charPropXml1ByteChar+{-# INLINE isXml1ByteChar #-}  charPropXml1ByteChar :: CharSet charPropXml1ByteChar-    = stringCS ['\x20', '\x09', '\x0D', '\x0A']+    = stringCS ['\x09', '\x0A', '\x0D']       `unionCS`       [ ('\x20', '\x7F') ] @@ -90,6 +143,7 @@  isXmlLatin1Char :: Char -> Bool isXmlLatin1Char c = c `elemCS` charPropXmlLatin1Char+{-# INLINE isXmlLatin1Char #-}  charPropXmlLatin1Char :: CharSet charPropXmlLatin1Char@@ -101,13 +155,45 @@ -- checking for XML space character: \\\n, \\\r, \\\t and \" \"  isXmlSpaceChar :: Char -> Bool+isXmlSpaceChar c+    = c == ' '+      ||+      c == '\n'+      ||+      c == '\t'+      ||+      c == '\r'++{- old isXmlSpaceChar c = c `elemCS` charPropXmlSpaceChar+-}+{-# INLINE isXmlSpaceChar #-}  charPropXmlSpaceChar          :: CharSet charPropXmlSpaceChar     = stringCS ['\x20', '\x09', '\x0D', '\x0A']  -- |+-- checking for XML space character: \\\n, \\\t and \" \"++isXmlSpaceCharCR :: Char -> Bool+isXmlSpaceCharCR c+    = c == ' '+      ||+      c == '\n'+      ||+      c == '\t'++{- old+isXmlSpaceCharCR c = c `elemCS` charPropXmlSpaceCharCR+-}+{-# INLINE isXmlSpaceCharCR #-}++charPropXmlSpaceCharCR          :: CharSet+charPropXmlSpaceCharCR+    = stringCS ['\x20', '\x09', '\x0A']++-- | -- checking for XML1.1 space character: additional space 0x85 and 0x2028 -- -- see also : 'isXmlSpaceChar'@@ -117,13 +203,26 @@  charPropXml11SpaceChar                :: CharSet charPropXml11SpaceChar-    = stringCS ['\x20', '\x09', '\x0D', '\x0A', '\x85', '\x2028']+    = stringCS ['\x09', '\x0A', '\x0D', '\x20', '\x85', '\x2028']  -- | -- checking for XML name character  isXmlNameChar :: Char -> Bool-isXmlNameChar c = c `elemCS` charPropXmlNameChar+isXmlNameChar c                        -- optimized for ASCII chars+    | c <= 'z'+        = c >= 'a'+          ||+          ( c >= 'A' && c <= 'Z' )+          ||+          ( c >= '0' && c <= '9' )+          ||+          c `elem` ['-', '.', ':', '_']+    | c >= '\183'+        = c `elemCS` charPropXmlNameChar +    | otherwise+        = False+{-# INLINE isXmlNameChar #-}  charPropXmlNameChar           :: CharSet charPropXmlNameChar@@ -145,7 +244,18 @@ -- see also : 'isXmlNameChar'  isXmlNameStartChar :: Char -> Bool-isXmlNameStartChar c = c `elemCS` charPropXmlNameStartChar+isXmlNameStartChar c                                            -- optimized for ASCII chars+    | c <= 'z'+        = c >= 'a'+          ||+          ( c >= 'A' && c <= 'Z' )+          ||+          c `elem` [':', '_']+    | c >= '\192'+        = c `elemCS` charPropXmlNameStartChar+    | otherwise+        = False+{-# INLINE isXmlNameStartChar #-}  charPropXmlNameStartChar              :: CharSet charPropXmlNameStartChar@@ -161,13 +271,26 @@ -- see also : 'isXmlNameChar'  isXmlNCNameChar :: Char -> Bool-isXmlNCNameChar c = c `elemCS` charPropXmlNCNameChar+isXmlNCNameChar c                                               -- optimized for ASCII chars+    | c <= 'z'+        = c >= 'a'+          ||+          ( c >= 'A' && c <= 'Z' )+          ||+          ( c >= '0' && c <= '9' )+          ||+          c `elem` ['-', '.', '_']+    | c >= '\183'+        = c `elemCS` charPropXmlNameChar +    | otherwise+        = False+{-# INLINE isXmlNCNameChar #-}  charPropXmlNCNameChar                 :: CharSet charPropXmlNCNameChar     = charPropXmlNameChar       `diffCS`-      singleCS '\x3A'+      singleCS '\x3A'                                           -- no :  -- | -- checking for XML NCName start character: no \":\" allowed@@ -175,13 +298,24 @@ -- see also : 'isXmlNameChar', 'isXmlNCNameChar'  isXmlNCNameStartChar :: Char -> Bool-isXmlNCNameStartChar c = c `elemCS` charPropXmlNCNameStartChar+isXmlNCNameStartChar c                                          -- optimized for ASCII chars+    | c <= 'z'+        = c >= 'a'+          ||+          ( c >= 'A' && c <= 'Z' )+          ||+          c == '_'+    | c >= '\192'+        = c `elemCS` charPropXmlNameStartChar+    | otherwise+        = False+{-# INLINE isXmlNCNameStartChar #-}  charPropXmlNCNameStartChar            :: CharSet charPropXmlNCNameStartChar     = charPropXmlNameStartChar       `diffCS`-      singleCS '\x3A'+      singleCS '\x3A'                                           -- no :  -- | -- checking for XML public id character@@ -204,6 +338,7 @@  isXmlLetter :: Char -> Bool isXmlLetter c = c `elemCS` charPropXmlLetter+{-# INLINE isXmlLetter #-}  charPropXmlLetter             :: CharSet charPropXmlLetter@@ -427,6 +562,7 @@  isXmlIdeographicChar :: Char -> Bool isXmlIdeographicChar c = c `elemCS` charPropXmlIdeographicChar+{-# INLINE isXmlIdeographicChar #-}  charPropXmlIdeographicChar    :: CharSet charPropXmlIdeographicChar
src/Data/Set/CharSet.hs view
@@ -40,23 +40,29 @@  emptyCS                 :: CharSet emptyCS                 = []+{-# INLINE emptyCS #-}  allCS                   :: CharSet allCS                   = [(minBound, maxBound)]+{-# INLINE allCS #-}  singleCS                :: Char -> CharSet singleCS c              = [(c,c)]+{-# INLINE singleCS #-}  stringCS                :: String -> CharSet stringCS                = foldr (unionCS . singleCS) emptyCS+{-# INLINE stringCS #-}  rangeCS                 :: Char -> Char -> CharSet rangeCS l u     | l <= u            = [(l,u)]     | otherwise         = emptyCS+{-# INLINE rangeCS #-}  nullCS                  :: CharSet -> Bool nullCS                  = null+{-# INLINE nullCS #-}  fullCS                  :: CharSet -> Bool fullCS [(lb, ub)]@@ -67,6 +73,7 @@  elemCS                  :: Char -> CharSet -> Bool elemCS i                = foldr (\ (lb, ub) b -> i >= lb && (i <= ub || b)) False+{-# INLINE elemCS #-}  toListCS                :: CharSet -> [Char] toListCS                = concatMap (\ (lb, ub) -> [lb..ub])