regex-xmlschema 0.1.4 → 0.1.5
raw patch · 13 files changed
+924/−926 lines, 13 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Text.Regex.XMLSchema.String.Regex: instance (Eq l) => Eq (GenRegex l)
- Text.Regex.XMLSchema.String.Regex: instance (Ord l) => Ord (GenRegex l)
- Text.Regex.XMLSchema.String.Regex: instance (Show l) => Show (GenRegex l)
+ Text.Regex.XMLSchema.String.Regex: instance Eq l => Eq (GenRegex l)
+ Text.Regex.XMLSchema.String.Regex: instance Ord l => Ord (GenRegex l)
+ Text.Regex.XMLSchema.String.Regex: instance Show l => Show (GenRegex l)
- Text.Regex.XMLSchema.String: mkAll :: (Eq l) => GenRegex l
+ Text.Regex.XMLSchema.String: mkAll :: Eq l => GenRegex l
- Text.Regex.XMLSchema.String: mkAlt :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkAlt :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String: mkCompl :: (Eq l) => GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkCompl :: Eq l => GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String: mkDiff :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkDiff :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String: mkElse :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkElse :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String: mkExor :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkExor :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String: mkIsect :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkIsect :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String: mkRep :: (Eq l) => Int -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkRep :: Eq l => Int -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String: mkStar :: (Eq l) => GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String: mkStar :: Eq l => GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: delta :: (Eq l) => GenRegex l -> String -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: delta :: Eq l => GenRegex l -> String -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: delta1 :: (Eq l) => GenRegex l -> Char -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: delta1 :: Eq l => GenRegex l -> Char -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: matchWithRegex :: (Eq l) => GenRegex l -> String -> Bool
+ Text.Regex.XMLSchema.String.Regex: matchWithRegex :: Eq l => GenRegex l -> String -> Bool
- Text.Regex.XMLSchema.String.Regex: matchWithRegex' :: (Eq l) => GenRegex l -> String -> Maybe [(Label l, String)]
+ Text.Regex.XMLSchema.String.Regex: matchWithRegex' :: Eq l => GenRegex l -> String -> Maybe [(Label l, String)]
- Text.Regex.XMLSchema.String.Regex: mkAll :: (Eq l) => GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkAll :: Eq l => GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkAlt :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkAlt :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkCompl :: (Eq l) => GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkCompl :: Eq l => GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkDiff :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkDiff :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkElse :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkElse :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkExor :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkExor :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkIsect :: (Eq l) => GenRegex l -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkIsect :: Eq l => GenRegex l -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkRep :: (Eq l) => Int -> GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkRep :: Eq l => Int -> GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: mkStar :: (Eq l) => GenRegex l -> GenRegex l
+ Text.Regex.XMLSchema.String.Regex: mkStar :: Eq l => GenRegex l -> GenRegex l
- Text.Regex.XMLSchema.String.Regex: splitWithRegex :: (Eq l) => GenRegex l -> String -> Maybe ([(Label l, String)], String)
+ Text.Regex.XMLSchema.String.Regex: splitWithRegex :: Eq l => GenRegex l -> String -> Maybe ([(Label l, String)], String)
- Text.Regex.XMLSchema.String.Regex: splitWithRegex' :: (Eq l) => GenRegex l -> String -> Maybe (GenRegex l, String)
+ Text.Regex.XMLSchema.String.Regex: splitWithRegex' :: Eq l => GenRegex l -> String -> Maybe (GenRegex l, String)
- Text.Regex.XMLSchema.String.Regex: splitWithRegexCS :: (Eq l) => GenRegex l -> CharSet -> String -> Maybe ([(Label l, String)], String)
+ Text.Regex.XMLSchema.String.Regex: splitWithRegexCS :: Eq l => GenRegex l -> CharSet -> String -> Maybe ([(Label l, String)], String)
- Text.Regex.XMLSchema.String.Regex: splitWithRegexCS' :: (Eq l) => GenRegex l -> CharSet -> String -> Maybe (GenRegex l, String)
+ Text.Regex.XMLSchema.String.Regex: splitWithRegexCS' :: Eq l => GenRegex l -> CharSet -> String -> Maybe (GenRegex l, String)
Files
- examples/colorizeProgs/ColorizeSourceCode.hs +311/−311
- examples/performance/Makefile +2/−2
- examples/performance/REtest.hs +32/−33
- examples/test/Main.hs +220/−220
- regex-xmlschema.cabal +1/−1
- src/Text/Regex/XMLSchema/String.hs +92/−92
- src/Text/Regex/XMLSchema/String/Regex.hs +0/−1
- src/Text/Regex/XMLSchema/String/RegexParser.hs +13/−13
- src/Text/Regex/XMLSchema/String/Unicode/Blocks.hs +197/−197
- src/Text/Regex/XMLSchema/String/Unicode/Blocks.txt +1/−1
- src/Text/Regex/XMLSchema/String/Unicode/CharProps.hs +36/−36
- src/Text/Regex/XMLSchema/String/Unicode/GenBlocks.hs +1/−1
- src/Text/Regex/XMLSchema/String/XML/CharProps.hs +18/−18
examples/colorizeProgs/ColorizeSourceCode.hs view
@@ -37,27 +37,27 @@ -- ------------------------------------------------------------ -data Process = P { inFilter :: String -> String- , tokenRE :: Regex- , markupRE :: Regex -> Regex- , formatToken :: (String, String) -> String- , formatDoc :: [String] -> String- , outFilter :: String -> String- , input :: Handle- , output :: Handle- , inputFile :: String- }+data Process = P { inFilter :: String -> String+ , tokenRE :: Regex+ , markupRE :: Regex -> Regex+ , formatToken :: (String, String) -> String+ , formatDoc :: [String] -> String+ , outFilter :: String -> String+ , input :: Handle+ , output :: Handle+ , inputFile :: String+ } -defaultProcess = P { inFilter = id- , tokenRE = plainRE- , markupRE = id- , formatToken = uncurry (++)- , formatDoc = unlines- , outFilter = id- , input = stdin- , output = stdout- , inputFile = " "- }+defaultProcess = P { inFilter = id+ , tokenRE = plainRE+ , markupRE = id+ , formatToken = uncurry (++)+ , formatDoc = unlines+ , outFilter = id+ , input = stdin+ , output = stdout+ , inputFile = " "+ } -- ------------------------------------------------------------ @@ -68,7 +68,7 @@ s <- hGetContents (input p) hPutStr (output p) (process p s) hFlush (output p)- hClose (output p)+ hClose (output p) exitWith ExitSuccess options :: [OptDescr (String, String)]@@ -85,11 +85,11 @@ , Option "n" ["number"] (NoArg ("number", "1")) "with line numbers" , Option "t" ["tabs"] (NoArg ("tabs", "1")) "substitute tabs by blanks" , Option "m" ["markup"] (NoArg ("markup", "1")) "text contains embedded markup"- , Option "e" ["erefs"] (NoArg ("erefs", "1")) "resolve HTML entity refs before processing"+ , Option "e" ["erefs"] (NoArg ("erefs", "1")) "resolve HTML entity refs before processing" , Option "o" ["output"] (ReqArg ((,) "output") "FILE") "output file, \"-\" stands for stdout" , Option "s" ["scan"] (NoArg ("scan", "1")) "just scan input, for testing" , Option "x" ["html"] (NoArg ("html", "1")) "html output"- , Option "f" ["full"] (NoArg ("full", "1")) "full HTML document with header and css"+ , Option "f" ["full"] (NoArg ("full", "1")) "full HTML document with header and css" ] exitErr :: String -> IO a@@ -105,9 +105,9 @@ | otherwise = do inp <- openFile fn ReadMode evalOpts opts (defaultProcess { input = inp- , inputFile = fn- }- )+ , inputFile = fn+ }+ ) where (fn:fns) = files @@ -138,15 +138,15 @@ evalOpt ("pplass", "1") p = return $ p { tokenRE = pplassRE } evalOpt ("plain", "1") p = return $ p { tokenRE = plainRE } evalOpt ("scan", "1") p = return $ p { tokenRE = plainRE- , formatToken = uncurry formatTok+ , formatToken = uncurry formatTok , formatDoc = formatHList }-evalOpt ("number", "1") p = return $ p { formatDoc = numberLines >>> formatDoc p }-evalOpt ("tabs", "1") p = return $ p { inFilter = inFilter p >>> substTabs }-evalOpt ("erefs", "1") p = return $ p { inFilter = resolveHtmlEntities >>> inFilter p }-evalOpt ("markup", "1") p = return $ p { markupRE = addMarkup }+evalOpt ("number", "1") p = return $ p { formatDoc = numberLines >>> formatDoc p }+evalOpt ("tabs", "1") p = return $ p { inFilter = inFilter p >>> substTabs }+evalOpt ("erefs", "1") p = return $ p { inFilter = resolveHtmlEntities >>> inFilter p }+evalOpt ("markup", "1") p = return $ p { markupRE = addMarkup } evalOpt ("html", "1") p = return $ p { formatToken = formatHtmlTok- , formatDoc = formatHtmlDoc }-evalOpt ("full", "1") p = return $ p { outFilter = outFilter p >>> fullHtml (inputFile p) }+ , formatDoc = formatHtmlDoc }+evalOpt ("full", "1") p = return $ p { outFilter = outFilter p >>> fullHtml (inputFile p) } usage :: IO () usage = hPutStrLn stderr use@@ -158,18 +158,18 @@ process :: Process -> String -> String process p = inFilter p- >>> tokenizeSubexRE (markupRE p (tokenRE p))+ >>> tokenizeSubexRE (markupRE p (tokenRE p)) >>> map (formatToken p) >>> concat >>> lines >>> formatDoc p- >>> outFilter p+ >>> outFilter p -addMarkup :: Regex -> Regex-addMarkup = mkElse (parseRegex . mkLE $ markupT)+addMarkup :: Regex -> Regex+addMarkup = mkElse (parseRegex . mkLE $ markupT) -tokenizeLines :: String -> [(String, String)] -tokenizeLines = map (\ l -> ("",l ++ "\n")) . lines+tokenizeLines :: String -> [(String, String)]+tokenizeLines = map (\ l -> ("",l ++ "\n")) . lines numberLines :: [String] -> [String] numberLines = zipWith addNum [1..]@@ -182,22 +182,22 @@ . (replicate l ' ' ++) . show -substTabs :: String -> String-substTabs = subs 0+substTabs :: String -> String+substTabs = subs 0 -subs _ "" = ""+subs _ "" = "" subs i (x:xs)- | x == '\t' = replicate (8 - (i `mod` 8)) ' ' ++ subs 0 xs+ | x == '\t' = replicate (8 - (i `mod` 8)) ' ' ++ subs 0 xs | x == '\n' = x : subs 0 xs- | otherwise = x : subs (i+1) xs+ | otherwise = x : subs (i+1) xs -- ------------------------------------------------------------ -resolveHtmlEntities :: String -> String-resolveHtmlEntities = sed (replaceEntity . drop 1 . init) "&\\i\\c*;"- where- replaceEntity e = maybe ("&" ++ e ++ ";") ((:[]) . toEnum)- . lookup e $ xhtmlEntities+resolveHtmlEntities :: String -> String+resolveHtmlEntities = sed (replaceEntity . drop 1 . init) "&\\i\\c*;"+ where+ replaceEntity e = maybe ("&" ++ e ++ ";") ((:[]) . toEnum)+ . lookup e $ xhtmlEntities -- ------------------------------------------------------------ @@ -211,35 +211,35 @@ >>> ("<div class=\"codeblock\">" :) >>> (++ ["</div>"]) >>> unlines- where- preserveEmptyLines "" = " "- preserveEmptyLines l = l+ where+ preserveEmptyLines "" = " "+ preserveEmptyLines l = l formatHtmlTok :: (String, String) -> String formatHtmlTok (m, t)- | m == "markup" = t- | otherwise = colorizeTokens m (escapeText >>> sed (const " ") " " $ t)+ | m == "markup" = t+ | otherwise = colorizeTokens m (escapeText >>> sed (const " ") " " $ t) escapeText :: String -> String escapeText = concat . runLA (xshow (mkText >>> escapeHtmlDoc)) -fullHtml :: String -> String -> String-fullHtml fn s = unlines- [ "<html>"- , "<head>"- , "<title>" ++ fn ++ "</title>"- , "<style>"- , css- , "</style>"- , "</head>"- , "<body>"- , s- , "</body>"- , "</html>"- ]+fullHtml :: String -> String -> String+fullHtml fn s = unlines+ [ "<html>"+ , "<head>"+ , "<title>" ++ fn ++ "</title>"+ , "<style>"+ , css+ , "</style>"+ , "</head>"+ , "<body>"+ , s+ , "</body>"+ , "</html>"+ ] -css :: String+css :: String css = unlines [ ".typename { color: #0000dd; }" , ".varname { color: #000000; }"@@ -263,10 +263,10 @@ , ".tclproc { color: #FF6000; }" , ".tclvar { color: #0000CD; }" , ".tclcomment { color: #c80000; }"- , ""- , ".linenr { color: #909090; padding-right: 2em; }"- , "div.codeline { font-family: monospace; width: 100%; white-space: pre; border-width: 1px; border-style: solid; border-color: transparent; padding-left: 0.3em; }"- , "div.codeline:hover { background-color:#ddddff; color:#c80000; border-width: 1px; border-style: solid; border-color: #c80000; }"+ , ""+ , ".linenr { color: #909090; padding-right: 2em; }"+ , "div.codeline { font-family: monospace; width: 100%; white-space: pre; border-width: 1px; border-style: solid; border-color: transparent; padding-left: 0.3em; }"+ , "div.codeline:hover { background-color:#ddddff; color:#c80000; border-width: 1px; border-style: solid; border-color: #c80000; }" ] @@ -276,24 +276,24 @@ colorizeTokens tok | tok `elem` [ "comment" , "keyword"- , "keyglyph"+ , "keyglyph" , "typekeyword" , "varname", "typename", "labelname", "instancename", "globalname" , "opname"- , "par"+ , "par" , "operator" , "strconst", "charconst"- , "bnfnt", "bnfmeta"- , "cppcommand"- , "specialword"+ , "bnfnt", "bnfmeta"+ , "cppcommand"+ , "specialword" ]- = wrap+ = wrap | tok == "longcomment" = wrap' "comment" . mlc- | tok == "bnfterminal" = wrap . drop 1 . init- -- | tok == "markupstart" = (("<span class=\"" ) ++) . (++ ("\">")) . drop 4 . init+ | tok == "bnfterminal" = wrap . drop 1 . init+ -- | tok == "markupstart" = (("<span class=\"" ) ++) . (++ ("\">")) . drop 4 . init -- | tok == "markupend" = const "</span>"- | null tok = const ""- | otherwise = id+ | null tok = const ""+ | otherwise = id where wrap = wrap' tok wrap' tok' = (("<span class=\"" ++ tok' ++ "\">") ++) . (++ "</span>")@@ -303,9 +303,9 @@ buildRegex :: [(String, String)] -> Regex buildRegex = foldr1 mkElse . map (uncurry mkBr') . map (second parseRegex)- where- mkBr' "" = id- mkBr' l = mkBr l+ where+ mkBr' "" = id+ mkBr' l = mkBr l buildKeywords :: [String] -> String@@ -314,10 +314,10 @@ untilRE :: String -> String untilRE re = "(\\A{" ++ "\\}\\A" ++ re ++ "\\A)" ++ re -mkLE :: (String, String) -> String-mkLE (l, re) = "({" ++ l ++ "}(" ++ re ++ "))"+mkLE :: (String, String) -> String+mkLE (l, re) = "({" ++ l ++ "}(" ++ re ++ "))" -ws1RE = "\\s+"+ws1RE = "\\s+" ws1RE' = "[ \t]+" ws0RE = "[ \t]*" @@ -325,38 +325,38 @@ charconst, number, par, xxx :: (String, String) --- markupS = ("markupstart", "<[a-zA-Z0-9]+>" )--- markupE = ("markupend", "</[a-zA-Z0-9]+>" )+-- markupS = ("markupstart", "<[a-zA-Z0-9]+>" )+-- markupE = ("markupend", "</[a-zA-Z0-9]+>" ) markupT = ("markup", ( "</?" ++ xname ++ "(" ++ xattr ++ ")*" ++ "\\s*>"- ++ "|" ++- "&" ++ xname ++ ";"- )- )- where- xname = "[A-Za-z][-_:A-Za-z0-9]*"- xattr = ws1RE ++ xname ++ eq ++ "(" ++ dq ++ "|" ++ sq ++ ")"- eq = "\\s*=\\s*"- dq = "\"[^\"]*\""- sq = "\'[^\']*\'"+ ++ "|" +++ "&" ++ xname ++ ";"+ )+ )+ where+ xname = "[A-Za-z][-_:A-Za-z0-9]*"+ xattr = ws1RE ++ xname ++ eq ++ "(" ++ dq ++ "|" ++ sq ++ ")"+ eq = "\\s*=\\s*"+ dq = "\"[^\"]*\""+ sq = "\'[^\']*\'" ws = ("ws", ws1RE ) ws' = ("ws", ws1RE' )-javacmt1 = ("comment", "//.*" )+javacmt1 = ("comment", "//.*" ) javacmt = ("longcomment", "/\\*" ++ untilRE "\\*/" )-shcmt1 = ("comment", "#.*" )-strconst = ("strconst", "\"([^\"\\\\\n\r]|\\\\.)*\"" )-charconst = ("charconst", "\'([^\'\\\\\n\r]|\\\\.)*\'" )+shcmt1 = ("comment", "#.*" )+strconst = ("strconst", "\"([^\"\\\\\n\r]|\\\\.)*\"" )+charconst = ("charconst", "\'([^\'\\\\\n\r]|\\\\.)*\'" ) number = ("number", "[0-9]+(\\.[0-9]*([eE][-+]?[0-9]+)?)?" ) par = ("par", "[\\(\\)\\[\\]\\{\\}]" ) xxx = ("xxx", "." ) -- ------------------------------------------------------------ -plainRE :: Regex-plainRE = buildRegex- [ ("xxx", "[^<&\n]+" )- , ("xxx", "[<&\n]" )- ]+plainRE :: Regex+plainRE = buildRegex+ [ ("xxx", "[^<&\n]+" )+ , ("xxx", "[<&\n]" )+ ] -- ------------------------------------------------------------ @@ -367,26 +367,26 @@ , ("longcomment", "\\{" ++ untilRE "-\\}" ) , ("keyword", buildKeywords [ "case", "class"- , "data", "default", "deriving", "do"- , "else"- , "forall"- , "if", "import", "in"- , "infix", "infixl", "infixr"- , "instance"- , "let"- , "module"- , "newtype"- , "of"- , "qualified"- , "then", "type"- , "where"- , "_"- , "as", "ccall", "foreign", "hiding", "proc", "safe", "unsafe"+ , "data", "default", "deriving", "do"+ , "else"+ , "forall"+ , "if", "import", "in"+ , "infix", "infixl", "infixr"+ , "instance"+ , "let"+ , "module"+ , "newtype"+ , "of"+ , "qualified"+ , "then", "type"+ , "where"+ , "_"+ , "as", "ccall", "foreign", "hiding", "proc", "safe", "unsafe" ]- )- , ("keyglyph", buildKeywords- ["\\.\\.","::","=","\\\\","\\|","<-","->","-<","@","~","=>","!",",",";"]- )+ )+ , ("keyglyph", buildKeywords+ ["\\.\\.","::","=","\\\\","\\|","<-","->","-<","@","~","=>","!",",",";"]+ ) , ("varname" , varname ) , ("typename", "[A-Z_][a-zA-Z0-9_]*[']*" ) , ("opname", "`" ++ varname ++ "`" )@@ -394,7 +394,7 @@ , charconst , number , par- , ("operator", "[-!#$%&\\*\\+./<=>\\?@\\\\^\\|~]+")+ , ("operator", "[-!#$%&\\*\\+./<=>\\?@\\\\^\\|~]+") , xxx ] where@@ -436,13 +436,13 @@ , "true" , "void" ] )- , ("labelname", "(" ++ varname ++ "{\\}default):" )- , ("", ( mkLE ("keyword", "break|continue")- ++ mkLE ws ++- mkLE ("labelname", varname)- )- )- , ("varname", varname )+ , ("labelname", "(" ++ varname ++ "{\\}default):" )+ , ("", ( mkLE ("keyword", "break|continue")+ ++ mkLE ws +++ mkLE ("labelname", varname)+ )+ )+ , ("varname", varname ) , ("typename", "[A-Z][a-zA-Z0-9_]*" ) , strconst , charconst@@ -453,25 +453,25 @@ , xxx ] where- varname = "[a-z][a-zA-Z0-9_]*"+ varname = "[a-z][a-zA-Z0-9_]*" -- ------------------------------------------------------------ -bnfRE = buildRegex- [ ws- , ("bnfnt" , "[A-Z][a-zA-Z0-9_]*" )- , ("bnfterminal", "\"([^\"\\\\\n\r]|\\\\.)*\"" )- , ("bnfmeta", buildKeywords- [ "\\["- , "\\]"- , "::="- , "\\|"- , "\\{"- , "\\}"- ]- )- , xxx- ]+bnfRE = buildRegex+ [ ws+ , ("bnfnt" , "[A-Z][a-zA-Z0-9_]*" )+ , ("bnfterminal", "\"([^\"\\\\\n\r]|\\\\.)*\"" )+ , ("bnfmeta", buildKeywords+ [ "\\["+ , "\\]"+ , "::="+ , "\\|"+ , "\\{"+ , "\\}"+ ]+ )+ , xxx+ ] -- ------------------------------------------------------------ @@ -482,63 +482,63 @@ , javacmt , ("keyword", buildKeywords [ "asm" , "auto"- , "break"- , "case" , "catch" , "class" , "const" , "continue"- , "default" , "delete" , "do"- , "else" , "extern" - , "for" , "friend"- , "goto"- , "if" , "inline"- , "new"- , "operator" , "overload"- , "private" , "protected" , "public"- , "register" , "return"- , "sizeof" , "static" , "switch"- , "template" , "this" , "typedef" , "throw" , "try"- , "virtual" , "volatile"- , "while"- ]- )+ , "break"+ , "case" , "catch" , "class" , "const" , "continue"+ , "default" , "delete" , "do"+ , "else" , "extern"+ , "for" , "friend"+ , "goto"+ , "if" , "inline"+ , "new"+ , "operator" , "overload"+ , "private" , "protected" , "public"+ , "register" , "return"+ , "sizeof" , "static" , "switch"+ , "template" , "this" , "typedef" , "throw" , "try"+ , "virtual" , "volatile"+ , "while"+ ]+ ) , ("typekeyword", buildKeywords [ "char"- , "double"- , "enum"- , "float"- , "int"- , "long"- , "short"- , "signed"- , "struct"- , "union"- , "unsigned"- , "void"- ]- )- , ("cppcommand", ( "#" ++ ws0RE ++ "("- +++ , "double"+ , "enum"+ , "float"+ , "int"+ , "long"+ , "short"+ , "signed"+ , "struct"+ , "union"+ , "unsigned"+ , "void"+ ]+ )+ , ("cppcommand", ( "#" ++ ws0RE ++ "("+ ++ buildKeywords- [ "define"- , "else"- , "endif"- , "if"- , "ifdef"- , "ifndef"- , "(include[ \t].*)"- , "undef"- ]- ++ ")"- )- )- , ("specialword", buildKeywords+ [ "define"+ , "else"+ , "endif"+ , "if"+ , "ifdef"+ , "ifndef"+ , "(include[ \t].*)"+ , "undef"+ ]+ ++ ")"+ )+ )+ , ("specialword", buildKeywords [ "assert"- , "exit"- , "free"- , "main"- , "malloc"- ]- )- , ("varname", varname )+ , "exit"+ , "free"+ , "main"+ , "malloc"+ ]+ )+ , ("varname", varname ) , ("typename", "[A-Z][a-zA-Z0-9_]*" ) , strconst , charconst@@ -549,114 +549,114 @@ , xxx ] where- varname = "[a-z][a-zA-Z0-9_]*"+ varname = "[a-z][a-zA-Z0-9_]*" -- ------------------------------------------------------------ -shRE = buildRegex- [ ws- , shcmt1- , ("keyword", buildKeywords- [ "alias"- , "break" , "bg"- , "case" , "cd" , "continue"- , "declare" , "do" , "done"- , "echo" , "elif" , "else" , "env" , "esac" , "eval" , "exec" , "exit" , "export"- , "false" , "fg" , "fi" , "for" , "function"- , "if" , "in"- , "jobs"- , "kill"- , "local"- , "pwd"- , "return"- , "set" , "shift"- , "test" , "then" , "trap" , "true"- , "unalias" , "unset"- , "while" , "wait"- ]- )- , ("varname", "[A-Za-z_][a-zA-Z0-9_]*" )- , ("operator", "[-+!%&=\\\\\\*\\?~|<>:@$]+" )- , ("operator", "[\\(\\)\\[\\]\\{\\}]+" )+shRE = buildRegex+ [ ws+ , shcmt1+ , ("keyword", buildKeywords+ [ "alias"+ , "break" , "bg"+ , "case" , "cd" , "continue"+ , "declare" , "do" , "done"+ , "echo" , "elif" , "else" , "env" , "esac" , "eval" , "exec" , "exit" , "export"+ , "false" , "fg" , "fi" , "for" , "function"+ , "if" , "in"+ , "jobs"+ , "kill"+ , "local"+ , "pwd"+ , "return"+ , "set" , "shift"+ , "test" , "then" , "trap" , "true"+ , "unalias" , "unset"+ , "while" , "wait"+ ]+ )+ , ("varname", "[A-Za-z_][a-zA-Z0-9_]*" )+ , ("operator", "[-+!%&=\\\\\\*\\?~|<>:@$]+" )+ , ("operator", "[\\(\\)\\[\\]\\{\\}]+" ) , strconst , charconst- , xxx- ]+ , xxx+ ] -- ------------------------------------------------------------ -rubyRE = buildRegex- [ ws- , rubycmt- , ("keyword", buildKeywords- [ "begin" , "break"- , "catch" , "case" , "class"- , "def" , "do"- , "else" , "elif" , "end" , "ensure"- , "false" , "for"- , "if" , "in" , "include" , "initialize"- , "loop"- , "module"- , "new" , "nil"- , "raise" , "require" , "rescue"- , "self"- , "then" , "true" , "type"- , "until"- , "when" , "while"- , "yield"- ]- )- , ("typename", "[A-Z][A-Za-z0-9]*" )- , ("varname", "[A-Za-z_][a-zA-Z0-9_]*(!|\\?)?" )- , ("instancename", "(@{1,2}|$)[A-Za-z_][a-zA-Z0-9_]*" )- , ("strconst", "%[qQx]\\{.*\\}" )- , ("strconst", "#\\{.*\\}" )- , ("strconst", ":[a-z][A-Za-z0-9]*" )- , strconst- , charconst- , regex- , xxx- ]+rubyRE = buildRegex+ [ ws+ , rubycmt+ , ("keyword", buildKeywords+ [ "begin" , "break"+ , "catch" , "case" , "class"+ , "def" , "do"+ , "else" , "elif" , "end" , "ensure"+ , "false" , "for"+ , "if" , "in" , "include" , "initialize"+ , "loop"+ , "module"+ , "new" , "nil"+ , "raise" , "require" , "rescue"+ , "self"+ , "then" , "true" , "type"+ , "until"+ , "when" , "while"+ , "yield"+ ]+ )+ , ("typename", "[A-Z][A-Za-z0-9]*" )+ , ("varname", "[A-Za-z_][a-zA-Z0-9_]*(!|\\?)?" )+ , ("instancename", "(@{1,2}|$)[A-Za-z_][a-zA-Z0-9_]*" )+ , ("strconst", "%[qQx]\\{.*\\}" )+ , ("strconst", "#\\{.*\\}" )+ , ("strconst", ":[a-z][A-Za-z0-9]*" )+ , strconst+ , charconst+ , regex+ , xxx+ ] where- rubycmt = ("comment", "#(.{\\}\\{)*" )- regex = ("strconst", "/([^/\\\\\n\r]|\\\\.)*/" )+ rubycmt = ("comment", "#(.{\\}\\{)*" )+ regex = ("strconst", "/([^/\\\\\n\r]|\\\\.)*/" ) -- ------------------------------------------------------------ pplRE :: Regex-pplRE = buildRegex+pplRE = buildRegex [ ws , ("comment", "(-)- .*" ) , ("keyword", buildKeywords [ "and"- , "begin"- , "div" , "do"- , "else" , "elseif" , "endif" , "endwhile" , "end"- , "function"- , "if"- , "max" , "min" , "mod"- , "not"- , "of" , "or"- , "procedure"- , "repeat"- , "return"- , "then"- , "until"- , "var"- , "while"- , "xor"- ]- )- , ("typekeyword", buildKeywords+ , "begin"+ , "div" , "do"+ , "else" , "elseif" , "endif" , "endwhile" , "end"+ , "function"+ , "if"+ , "max" , "min" , "mod"+ , "not"+ , "of" , "or"+ , "procedure"+ , "repeat"+ , "return"+ , "then"+ , "until"+ , "var"+ , "while"+ , "xor"+ ]+ )+ , ("typekeyword", buildKeywords [ "boolean"- , "false" , "float"- , "int"- , "list"- , "picture"- , "string"- , "true"- ]- )+ , "false" , "float"+ , "int"+ , "list"+ , "picture"+ , "string"+ , "true"+ ]+ ) , ("varname", "[A-Za-z_][a-zA-Z0-9_]*" ) , strconst , number@@ -666,30 +666,30 @@ -- ------------------------------------------------------------ pplassRE :: Regex-pplassRE = buildRegex+pplassRE = buildRegex [ ws , ("comment", "(-)- .*" ) , ("keyword", buildKeywords [ "loadi" , "loadf"- , "loads" , "emptyl"- , "undef" , "load"- ]- )+ , "loads" , "emptyl"+ , "undef" , "load"+ ]+ ) , ("typename", buildKeywords [ "store"- , "pop"- ]- )+ , "pop"+ ]+ ) , ("typekeyword", buildKeywords [ "jmp"- , "brfalse"- , "brtrue"- , "pushj"- , "popj"- , "svc"- ]- )- , ("labelname", "(l[0-9]+:?)|([se]?_[A-Za-z0-9]*:?)" )+ , "brfalse"+ , "brtrue"+ , "pushj"+ , "popj"+ , "svc"+ ]+ )+ , ("labelname", "(l[0-9]+:?)|([se]?_[A-Za-z0-9]*:?)" ) , ("varname", "[A-Za-z_][a-zA-Z0-9_]*" ) , strconst , xxx
examples/performance/Makefile view
@@ -1,10 +1,10 @@-PKGFLAGS = +PKGFLAGS = GHCFLAGS = -Wall -O2 GHC = ghc $(GHCFLAGS) $(PKGFLAGS) CNT = 3 -ropts = +RTS -s -RTS +ropts = +RTS -s -RTS prog = ./REtest prog2 = ./Lines
examples/performance/REtest.hs view
@@ -6,43 +6,42 @@ where import Text.Regex.XMLSchema.String--- import Control.Monad.State.Strict hiding (when)+ import Control.Arrow -import Data.List import Data.Maybe -import System.IO -- import the IO and commandline option stuff+import System.IO -- import the IO and commandline option stuff import System.Environment -- ---------------------------------------- -main :: IO ()+main :: IO () main = do p <- getProgName al <- getArgs let i = if null al- then 4- else (read . head $ al)::Int+ then 4+ else (read . head $ al)::Int main' p i where main' p' = fromMaybe main1 . lookup (pn p') $ mpt- mpt = [ ("REtest", main1)- , ("Copy", main2 "copy" (:[]))- , ("Lines", main2 "lines" lines)- , ("RElines", main2 "relines" relines)- , ("SElines", main2 "selines'" relines')- , ("Words", main2 "words" words)- , ("REwords", main2 "rewords" rewords)- , ("SEwords", main2 "sewords" rewords')- ]+ mpt = [ ("REtest", main1)+ , ("Copy", main2 "copy" (:[]))+ , ("Lines", main2 "lines" lines)+ , ("RElines", main2 "relines" relines)+ , ("SElines", main2 "selines'" relines')+ , ("Words", main2 "words" words)+ , ("REwords", main2 "rewords" rewords)+ , ("SEwords", main2 "sewords" rewords')+ ] -- ---------------------------------------- -- generate a document containing a binary tree of 2^i leafs (= 2^(i-1) XML elements) -main1 :: Int -> IO ()+main1 :: Int -> IO () main1 i = do genDoc i "REtest.hs" (fn i)@@ -52,7 +51,7 @@ -- read a document containing a binary tree of 2^i leafs -main2 :: String -> (String -> [String]) -> Int -> IO ()+main2 :: String -> (String -> [String]) -> Int -> IO () main2 ext lines' i = do hPutStrLn stderr "start processing"@@ -65,33 +64,33 @@ hClose h hPutStrLn stderr "end processing" -relines :: String -> [String]-relines = tokenize ".*"+relines :: String -> [String]+relines = tokenize ".*" -relines' :: String -> [String]-relines' = tokenizeSubex "({line}.*)" >>> map snd+relines' :: String -> [String]+relines' = tokenizeSubex "({line}.*)" >>> map snd -rewords :: String -> [String]-rewords = tokenize "\\S+"+rewords :: String -> [String]+rewords = tokenize "\\S+" -rewords' :: String -> [String]-rewords' = tokenizeSubex "({word}\\S+)" >>> map snd+rewords' :: String -> [String]+rewords' = tokenizeSubex "({word}\\S+)" >>> map snd -- ---------------------------------------- -pn :: String -> String-pn = reverse . takeWhile (/= '/') . reverse+pn :: String -> String+pn = reverse . takeWhile (/= '/') . reverse -fn :: Int -> String-fn = ("lines-" ++) . (++ ".txt") . reverse . take 4 . reverse . ((replicate 4 '0') ++ ) . show+fn :: Int -> String+fn = ("lines-" ++) . (++ ".txt") . reverse . take 4 . reverse . ((replicate 4 '0') ++ ) . show -- ---------------------------------------- -genDoc :: Int -> String -> String -> IO ()+genDoc :: Int -> String -> String -> IO () genDoc d inp outp = do- s <- readFile inp- let s' = take (2^d) . concat . repeat $ s- writeFile outp s'+ s <- readFile inp+ let s' = take (2^d) . concat . repeat $ s+ writeFile outp s' -- ----------------------------------------
examples/test/Main.hs view
@@ -12,235 +12,235 @@ -- ------------------------------------------------------------ -parseTests :: Test+parseTests :: Test parseTests = TestLabel "parse tests" $ TestList $ map parseTest $ tests where parseTest (re, rep)- = TestCase $- assertEqual (show re ++ " must be parsed as " ++ show rep)+ = TestCase $+ assertEqual (show re ++ " must be parsed as " ++ show rep) rep- (show . parseRegex $ re)+ (show . parseRegex $ re) - tests = [ ("", "()")- , (".", ".")- , (".*", "(.*)")- , ("\\a", "\\a")- , ("\\A", "\\A")- , ("(())", "()")- , ("(a*)*", "(a*)")- , ("(a*)+", "(a*)")- , ("(a+)*", "(a*)")- , ("(a+)+", "(a+)")- , ("(a?){2,}", "(a*)")- , ("((a?){2,}){0,}", "(a*)")- , ("((a?){2,}){3,}", "(a*)")- , ("(a{0,}){2,}", "(a*)")- , ("(a{2,}){3,}", "(a{6,})")- , ("[9-0]", "{empty char range}")- , ("[0-9]", "[0-9]")- , ("[0-99-0]", "[0-9]")- , ("[abc]", "[a-c]")- , ("[\0-\1114111]", "\\a")- , ("[\0-\1114111]|[0-9]", "\\a")- , ("[\0-\1114110]", "[�-]" )+ tests = [ ("", "()")+ , (".", ".")+ , (".*", "(.*)")+ , ("\\a", "\\a")+ , ("\\A", "\\A")+ , ("(())", "()")+ , ("(a*)*", "(a*)")+ , ("(a*)+", "(a*)")+ , ("(a+)*", "(a*)")+ , ("(a+)+", "(a+)")+ , ("(a?){2,}", "(a*)")+ , ("((a?){2,}){0,}", "(a*)")+ , ("((a?){2,}){3,}", "(a*)")+ , ("(a{0,}){2,}", "(a*)")+ , ("(a{2,}){3,}", "(a{6,})")+ , ("[9-0]", "{empty char range}")+ , ("[0-9]", "[0-9]")+ , ("[0-99-0]", "[0-9]")+ , ("[abc]", "[a-c]")+ , ("[\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]" )- , ("abc", "(a(bc))" ) -- seq is right ass- , ("a*{^}b*", "((a*){^}(b*))" ) -- extension: exor- , ("a*{^}b*{^}c*", "((a*){^}((b*){^}(c*)))")- , ("a*{&}b*", "((a*){&}(b*))" ) -- extension: intersection- , ("a*{&}b*{&}c*", "((a*){&}((b*){&}(c*)))")- , ("a*{\\}b*", "((a*){\\}(b*))" ) -- extension: set difference- , ("a*{\\}b*{\\}c*", "(((a*){\\}(b*)){\\}(c*))" )- , ("(a|b)*{\\}(.*aa.*)", "(([ab]*){\\}((.*)(a(a(.*)))))" )- , ("({1}a+)", "({1}(a+))" ) -- extension: labeled subexpressions- , ("({1}({2}({3}a)))", "({1}({2}({3}a)))" )- , ("({1}do){|}({2}[a-z]+)", "(({1}(do)){|}({2}([a-z]+)))" ) -- deterministic choice of submatches- , ("a{:}b{:}c", "(a{:}(b{:}c))" ) -- interleave- ]+ , ("a|b|c|d", "[a-d]" )+ , ("(a|b)|c", "[a-c]" )+ , ("a|(b|c)", "[a-c]" )+ , ("abc", "(a(bc))" ) -- seq is right ass+ , ("a*{^}b*", "((a*){^}(b*))" ) -- extension: exor+ , ("a*{^}b*{^}c*", "((a*){^}((b*){^}(c*)))")+ , ("a*{&}b*", "((a*){&}(b*))" ) -- extension: intersection+ , ("a*{&}b*{&}c*", "((a*){&}((b*){&}(c*)))")+ , ("a*{\\}b*", "((a*){\\}(b*))" ) -- extension: set difference+ , ("a*{\\}b*{\\}c*", "(((a*){\\}(b*)){\\}(c*))" )+ , ("(a|b)*{\\}(.*aa.*)", "(([ab]*){\\}((.*)(a(a(.*)))))" )+ , ("({1}a+)", "({1}(a+))" ) -- extension: labeled subexpressions+ , ("({1}({2}({3}a)))", "({1}({2}({3}a)))" )+ , ("({1}do){|}({2}[a-z]+)", "(({1}(do)){|}({2}([a-z]+)))" ) -- deterministic choice of submatches+ , ("a{:}b{:}c", "(a{:}(b{:}c))" ) -- interleave+ ] -simpleMatchTests :: Test+simpleMatchTests :: Test simpleMatchTests = TestLabel "simple match tests" $ TestList $ concatMap matchTest $ tests where matchTest (re, ok, er)- = map (matchOK re) ok- ++- map (matchErr re) er- matchOK re s = TestCase $ assertBool (show s ++ " must match " ++ show re) (match re s)- matchErr re s = TestCase $ assertBool (show s ++ " must not match " ++ show re) (not (match re s))+ = map (matchOK re) ok+ +++ map (matchErr re) er+ matchOK re s = TestCase $ assertBool (show s ++ " must match " ++ show re) (match re s)+ matchErr re s = TestCase $ assertBool (show s ++ " must not match " ++ show re) (not (match re s)) tests = [ ( ""- , [""]- , ["a"]- )- , ( "a"- , ["a"]- , ["", "b", "ab"]- )- , ( "()"- , [""]- , ["a"]- )- , ( "ab"- , ["ab"]- , ["", "b", "abc"]- )- , ( "."- , [".","a","\0","\1114111"]- , ["\n","\r","",".."]- )- , ( "\\a"- , [".","a","\n","\r","\0","\1114111"]- , ["",".."]- )- , ( "\\A"- , ["",".","a","\n","\r","\0","\1114111",".."]- , []- )- , ( "a*"- , ["", "a", "aa"]- , ["b", "ab", "aab"]- )- , ( "a+"- , ["a", "aa", "aaa"]- , ["", "b", "ab"]- )- , ( "a?"- , ["", "a"]- , ["b", "ab"]- )- , ( "a{2}"- , ["aa"]- , ["", "a", "aaa"]- )- , ( "a{2,}"- , ["aa","aaa"]- , ["", "a", "aaab"]- )- , ( "a{2,4}"- , ["aa", "aaa", "aaaa"]- , ["", "a", "aaaaa", "ab"]- )- , ( "a|b"- , ["a", "b"]- , ["", "c", "ab", "abc"]- )- , ( "[0-9]"- , ["0", "5", "9"]- , ["", "a", "00"]- )- , ( "[^0-9]"- , ["a"]- , ["", "0", "9", "00"])- , ( "\32"- , [" "]- , []- )- , ( "[\0-\1114111]"- , ["\0","\1114111","a"]- , ["","aaa"]- )- , ( "[^\0-\1114111]"- , []- , ["","aaa","\0","\1114111","a"]- )- , ( ".*a.*|.*b.*|.*c.*"- , ["a", "abc", "acdc"]- , ["", "dddd"]- )- , ( ".*a.*{&}.*b.*{&}.*c.*"- , ["abc", "abcd", "abcabcd"]- , ["", "a", "bc", "acdc", "dddd"]- )- , ( ".*a.*{&}.*b.*{&}.*c.*{&}.{3}" -- all permutations of "abc"- , ["abc", "acb", "bac", "bca", "cab", "cba"]- , ["", "a", "bc", "acd", "aaaa", "aba"]- )- , ( ".*a.*{&}.*b.*{&}.*c.*" -- all words containing at least 1 a, 1 b and 1 c- , ["abc", "acb", "bac", "bca", "cab", "cba", "abcd", "abcabc"]- , ["", "a", "bc", "acd", "aaaa"]- )- , ( ".*a.*{^}.*b.*" -- all words containing at least 1 a or 1 b but not both a's and b's- , ["a", "b", "ac", "bc", "aaaa", "bbb", "aacc", "ccbb", "acdc"]- , ["", "ab", "abc", "dddd"]- )- , ( "/[*](.*{\\}(.*[*]/.*))[*]/" -- single line C comment of form /*...*/, but without any */ in the comment body- -- this is the way to specify none greedy expessions- -- if multy line comment are required, substitute .* by \A, so newlines are allowed- , ["/**/","/***/","/*x*/","/*///*/"]- , ["", "/", "/*", "/*/", "/**/*/", "/*xxx*/xxx*/"]- )- , ( "a{:}b{:}c"- , ["abc", "acb", "bac", "bca", "cab", "cba"]- , ["", "a", "ab", "abcc", "abca", "aba"]- )- ]+ , [""]+ , ["a"]+ )+ , ( "a"+ , ["a"]+ , ["", "b", "ab"]+ )+ , ( "()"+ , [""]+ , ["a"]+ )+ , ( "ab"+ , ["ab"]+ , ["", "b", "abc"]+ )+ , ( "."+ , [".","a","\0","\1114111"]+ , ["\n","\r","",".."]+ )+ , ( "\\a"+ , [".","a","\n","\r","\0","\1114111"]+ , ["",".."]+ )+ , ( "\\A"+ , ["",".","a","\n","\r","\0","\1114111",".."]+ , []+ )+ , ( "a*"+ , ["", "a", "aa"]+ , ["b", "ab", "aab"]+ )+ , ( "a+"+ , ["a", "aa", "aaa"]+ , ["", "b", "ab"]+ )+ , ( "a?"+ , ["", "a"]+ , ["b", "ab"]+ )+ , ( "a{2}"+ , ["aa"]+ , ["", "a", "aaa"]+ )+ , ( "a{2,}"+ , ["aa","aaa"]+ , ["", "a", "aaab"]+ )+ , ( "a{2,4}"+ , ["aa", "aaa", "aaaa"]+ , ["", "a", "aaaaa", "ab"]+ )+ , ( "a|b"+ , ["a", "b"]+ , ["", "c", "ab", "abc"]+ )+ , ( "[0-9]"+ , ["0", "5", "9"]+ , ["", "a", "00"]+ )+ , ( "[^0-9]"+ , ["a"]+ , ["", "0", "9", "00"])+ , ( "\32"+ , [" "]+ , []+ )+ , ( "[\0-\1114111]"+ , ["\0","\1114111","a"]+ , ["","aaa"]+ )+ , ( "[^\0-\1114111]"+ , []+ , ["","aaa","\0","\1114111","a"]+ )+ , ( ".*a.*|.*b.*|.*c.*"+ , ["a", "abc", "acdc"]+ , ["", "dddd"]+ )+ , ( ".*a.*{&}.*b.*{&}.*c.*"+ , ["abc", "abcd", "abcabcd"]+ , ["", "a", "bc", "acdc", "dddd"]+ )+ , ( ".*a.*{&}.*b.*{&}.*c.*{&}.{3}" -- all permutations of "abc"+ , ["abc", "acb", "bac", "bca", "cab", "cba"]+ , ["", "a", "bc", "acd", "aaaa", "aba"]+ )+ , ( ".*a.*{&}.*b.*{&}.*c.*" -- all words containing at least 1 a, 1 b and 1 c+ , ["abc", "acb", "bac", "bca", "cab", "cba", "abcd", "abcabc"]+ , ["", "a", "bc", "acd", "aaaa"]+ )+ , ( ".*a.*{^}.*b.*" -- all words containing at least 1 a or 1 b but not both a's and b's+ , ["a", "b", "ac", "bc", "aaaa", "bbb", "aacc", "ccbb", "acdc"]+ , ["", "ab", "abc", "dddd"]+ )+ , ( "/[*](.*{\\}(.*[*]/.*))[*]/" -- single line C comment of form /*...*/, but without any */ in the comment body+ -- this is the way to specify none greedy expessions+ -- if multy line comment are required, substitute .* by \A, so newlines are allowed+ , ["/**/","/***/","/*x*/","/*///*/"]+ , ["", "/", "/*", "/*/", "/**/*/", "/*xxx*/xxx*/"]+ )+ , ( "a{:}b{:}c"+ , ["abc", "acb", "bac", "bca", "cab", "cba"]+ , ["", "a", "ab", "abcc", "abca", "aba"]+ )+ ] -- ------------------------------------------------------------ -simpleSplitTests :: Test+simpleSplitTests :: Test simpleSplitTests = TestLabel "simple split tests" $ TestList $ map splitTest $ tests where splitTest (re, inp, tok)- = TestCase $- assertEqual ("split " ++ show re ++ show inp ++ " = (" ++ show tok ++ ", ... )")- tok- (fst (split re inp))- tests = [ ("", "a", "" )- , ("a*b", "abc", "ab" )- , ("a*", "bc", "" )- , ("a+", "bc", "" )- , ("a{2}", "aaa", "aa" )- , ("a{2,}", "aaa", "aaa" )- , ("a|b", "ab", "a" )- , ("a|b*", "bbba", "bbb" )- , ("abc", "abcd", "abc" )- ]+ = TestCase $+ assertEqual ("split " ++ show re ++ show inp ++ " = (" ++ show tok ++ ", ... )")+ tok+ (fst (split re inp))+ tests = [ ("", "a", "" )+ , ("a*b", "abc", "ab" )+ , ("a*", "bc", "" )+ , ("a+", "bc", "" )+ , ("a{2}", "aaa", "aa" )+ , ("a{2,}", "aaa", "aaa" )+ , ("a|b", "ab", "a" )+ , ("a|b*", "bbba", "bbb" )+ , ("abc", "abcd", "abc" )+ ] -- ------------------------------------------------------------ -simpleTokenTests :: Test+simpleTokenTests :: Test simpleTokenTests = TestLabel "simple token tests" $ TestList $ map tokenTest $ tests where tokenTest (re, inp, toks)- = TestCase $- assertEqual ("tokenize " ++ show re ++ " " ++ show inp ++ " = " ++ show toks)- toks- (tokenize re inp)- tests = [ ("", "", [] )- , ("a", "aba", ["a", "a"] )- , ("a", "b", [] )- , ("a", "ba", ["a"] )- , ("a*", "a", ["a"] )- , ("a*", "ba", ["","a"] )- , ("a*", "aba", ["a", "a"] )- , ("a*", "abba", ["a", "", "a"] )- , ("a+", "abba", ["a", "a"] )- , ("a*b", "abba", ["ab", "b"] )- , (".*", "a\n\nb", ["a", "", "b"] )- , (".*", "a\n\nb\n", ["a", "", "b"] )- , ("\\w+", "a\n\nb\n", ["a", "b"] )- , ("\\w|ab", "aaa\n\nabc\n", ["a", "a", "a", "ab", "c"] )- , ("\\w|ab", "aaa abc", ["a", "a", "a", "ab", "c"] )- ]+ = TestCase $+ assertEqual ("tokenize " ++ show re ++ " " ++ show inp ++ " = " ++ show toks)+ toks+ (tokenize re inp)+ tests = [ ("", "", [] )+ , ("a", "aba", ["a", "a"] )+ , ("a", "b", [] )+ , ("a", "ba", ["a"] )+ , ("a*", "a", ["a"] )+ , ("a*", "ba", ["","a"] )+ , ("a*", "aba", ["a", "a"] )+ , ("a*", "abba", ["a", "", "a"] )+ , ("a+", "abba", ["a", "a"] )+ , ("a*b", "abba", ["ab", "b"] )+ , (".*", "a\n\nb", ["a", "", "b"] )+ , (".*", "a\n\nb\n", ["a", "", "b"] )+ , ("\\w+", "a\n\nb\n", ["a", "b"] )+ , ("\\w|ab", "aaa\n\nabc\n", ["a", "a", "a", "ab", "c"] )+ , ("\\w|ab", "aaa abc", ["a", "a", "a", "ab", "c"] )+ ] -- ------------------------------------------------------------ -allTests :: Test+allTests :: Test allTests = TestList [ parseTests@@ -249,16 +249,16 @@ , simpleTokenTests ] -main :: IO ()+main :: IO () main = do c <- runTestTT allTests putStrLn $ show c let errs = errors c- fails = failures c+ fails = failures c System.exitWith (codeGet errs fails) -codeGet :: Int -> Int -> ExitCode+codeGet :: Int -> Int -> ExitCode codeGet errs fails | fails > 0 = ExitFailure 2 | errs > 0 = ExitFailure 1@@ -266,35 +266,35 @@ -- ------------------------------------------------------------ -deltaTrc :: Regex -> String -> [(String, Regex)]-deltaTrc re "" = [("", re)]-deltaTrc re s@(c:cs) = (s, re)- :- ( if isZero re'- then [("",re')]- else deltaTrc re' cs- )+deltaTrc :: Regex -> String -> [(String, Regex)]+deltaTrc re "" = [("", re)]+deltaTrc re s@(c:cs) = (s, re)+ :+ ( if isZero re'+ then [("",re')]+ else deltaTrc re' cs+ ) where- re' = delta1 re c+ re' = delta1 re c -matchTrc :: String -> String -> (Bool, [(String, Regex)])-matchTrc re = ( parseRegex >>> deltaTrc$ re )- >>>- ( (last >>> snd >>> nullable) &&& id )- - -trcMatch :: String -> String -> IO()-trcMatch re = putStrLn . showTrc . matchTrc re+matchTrc :: String -> String -> (Bool, [(String, Regex)])+matchTrc re = ( parseRegex >>> deltaTrc$ re )+ >>>+ ( (last >>> snd >>> nullable) &&& id )+++trcMatch :: String -> String -> IO()+trcMatch re = putStrLn . showTrc . matchTrc re where- showTrc =- ( (show >>> (++ "\n"))- ***- (concatMap ( ((++ "\t") *** (show >>> (++"\n")))- >>> uncurry (++)- )- )- )- >>>- uncurry (flip (++))+ showTrc =+ ( (show >>> (++ "\n"))+ ***+ (concatMap ( ((++ "\t") *** (show >>> (++"\n")))+ >>> uncurry (++)+ )+ )+ )+ >>>+ uncurry (flip (++)) -- ------------------------------------------------------------
regex-xmlschema.cabal view
@@ -1,5 +1,5 @@ Name: regex-xmlschema-Version: 0.1.4+Version: 0.1.5 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.
src/Text/Regex/XMLSchema/String.hs view
@@ -64,7 +64,7 @@ , isZero , errRegex - , parseRegex -- re-export of Text.Regex.XMLSchema.String.RegexParser+ , parseRegex -- re-export of Text.Regex.XMLSchema.String.RegexParser ) where @@ -83,11 +83,11 @@ -- @Nothing@ is returned in case there is no matching prefix, -- else the pair of prefix and rest is returned -splitRE :: (Eq l, Show l) => GenRegex l -> String -> Maybe (String, String)+splitRE :: (Eq l, Show l) => GenRegex l -> String -> Maybe (String, String) splitRE re input- = do- (sms, rest) <- splitWithRegex re input- return (snd . head $ sms, rest)+ = do+ (sms, rest) <- splitWithRegex re input+ return (snd . head $ sms, rest) -- | convenient function for 'splitRE' --@@ -98,8 +98,8 @@ -- > split "a+" "bc" = ("", "bc") -- > split "[" "abc" = ("", "abc") -split :: String -> String -> (String, String)-split re input = fromMaybe ("", input)+split :: String -> String -> (String, String)+split re input = fromMaybe ("", input) . (splitRE . parseRegex $ re) $ input -- ------------------------------------------------------------@@ -111,11 +111,11 @@ -- else the list of pairs of labels and submatches and the -- rest is returned -splitSubexRE :: (Eq l, Show l) => GenRegex l -> String -> Maybe ([(l, String)], String)+splitSubexRE :: (Eq l, Show l) => GenRegex l -> String -> Maybe ([(l, String)], String) splitSubexRE re input- = do- (sms, rest) <- splitWithRegex re input- return (map (first fromJust) . drop 1 $ sms, rest)+ = do+ (sms, rest) <- splitWithRegex re input+ return (map (first fromJust) . drop 1 $ sms, rest) -- | convenient function for 'splitSubex' --@@ -140,35 +140,35 @@ -- > splitSubex "[" "abc" = ([], "abc") -- syntax error -splitSubex :: String -> String -> ([(String,String)], String)+splitSubex :: String -> String -> ([(String,String)], String) splitSubex re inp- = fromMaybe ([], inp) . (splitSubexRE . parseRegex $ re) $ inp+ = fromMaybe ([], inp) . (splitSubexRE . parseRegex $ re) $ inp -- ------------------------------------------------------------ -- | The function, that does the real work for 'tokenize' -tokenizeRE :: (Eq l, Show l) => GenRegex l -> String -> [String]+tokenizeRE :: (Eq l, Show l) => GenRegex l -> String -> [String] tokenizeRE re = token'' where- re1 = mkDiff re mkUnit+ re1 = mkDiff re mkUnit token'' = token' re fcs- token1'' = token' re1 fcs+ token1'' = token' re1 fcs fcs = firstChars re - -- token' :: (Eq l, Show l) => GenRegex l -> CharSet -> String -> [String]+ -- token' :: (Eq l, Show l) => GenRegex l -> CharSet -> String -> [String] token' re' fcs' inp- | null inp = []- | otherwise = evalRes . splitWithRegexCS re' fcs' $ inp- where- evalRes Nothing = token'' (tail inp) -- re does not match any prefix- evalRes (Just (toks, rest))- | null tok = tok : token'' (tail rest) -- re is nullable and only the empty prefix matches- -- discard one char and try again- | otherwise = tok : token1'' rest -- real token found, next token must not be empty- where- tok = snd . head $ toks+ | null inp = []+ | otherwise = evalRes . splitWithRegexCS re' fcs' $ inp+ where+ evalRes Nothing = token'' (tail inp) -- re does not match any prefix+ evalRes (Just (toks, rest))+ | null tok = tok : token'' (tail rest) -- re is nullable and only the empty prefix matches+ -- discard one char and try again+ | otherwise = tok : token1'' rest -- real token found, next token must not be empty+ where+ tok = snd . head $ toks -- | split a string into tokens (words) by giving a regular expression -- which all tokens must match.@@ -208,8 +208,8 @@ -- > -- > tokenize "[^ \t\n\r]*" = words -tokenize :: String -> String -> [String]-tokenize = tokenizeRE . parseRegex+tokenize :: String -> String -> [String]+tokenize = tokenizeRE . parseRegex -- ------------------------------------------------------------ @@ -225,41 +225,41 @@ -- -- > concat . map (either id id) . tokenizeRE' re == id -tokenizeRE' :: (Eq l, Show l) => GenRegex l -> String -> [Either String String]+tokenizeRE' :: (Eq l, Show l) => GenRegex l -> String -> [Either String String] tokenizeRE' re = token'' "" where- re1 = mkDiff re mkUnit+ re1 = mkDiff re mkUnit token'' = token' re fcs- token1'' = token' re1 fcs+ token1'' = token' re1 fcs fcs = firstChars re - -- token' :: (Eq l, Show l) => GenRegex l -> CharSet -> String -> String -> [Either String String]+ -- token' :: (Eq l, Show l) => GenRegex l -> CharSet -> String -> String -> [Either String String] token' re' fcs' unmatched inp- | null inp = addUnmatched []- | otherwise = evalRes . splitWithRegexCS re' fcs' $ inp- where- addUnmatched- | null unmatched = id- | otherwise = ((Left . reverse $ unmatched) :)+ | null inp = addUnmatched []+ | otherwise = evalRes . splitWithRegexCS re' fcs' $ inp+ where+ addUnmatched+ | null unmatched = id+ | otherwise = ((Left . reverse $ unmatched) :) - addMatched t = addUnmatched . ((Right t) :)+ addMatched t = addUnmatched . ((Right t) :) - evalRes Nothing = token'' ((head inp) : unmatched) (tail inp) -- re does not match any prefix+ evalRes Nothing = token'' ((head inp) : unmatched) (tail inp) -- re does not match any prefix - evalRes (Just (toks, rest))- | null tok = addMatched tok $ token'' (take 1 rest) (tail rest) -- re is nullable and only the empty prefix matches- -- discard one char and try again- | otherwise = addMatched tok $ token1'' "" rest -- real token found, next token must not be empty- where- tok = snd . head $ toks+ evalRes (Just (toks, rest))+ | null tok = addMatched tok $ token'' (take 1 rest) (tail rest) -- re is nullable and only the empty prefix matches+ -- discard one char and try again+ | otherwise = addMatched tok $ token1'' "" rest -- real token found, next token must not be empty+ where+ tok = snd . head $ toks -- | convenient function for 'tokenizeRE'' -- -- When the regular expression parses as Zero, @[Left input]@ is returned, that means no tokens are found -tokenize' :: String -> String -> [Either String String]-tokenize' = tokenizeRE' . parseRegex+tokenize' :: String -> String -> [Either String String]+tokenize' = tokenizeRE' . parseRegex -- ------------------------------------------------------------ @@ -277,27 +277,27 @@ -- All none matching chars are discarded. If the given regex contains syntax errors, -- @Nothing@ is returned -tokenizeSubexRE :: (Eq l, Show l) => GenRegex l -> String -> [(l, String)]+tokenizeSubexRE :: (Eq l, Show l) => GenRegex l -> String -> [(l, String)] tokenizeSubexRE re = token'' where- re1 = mkDiff re mkUnit+ re1 = mkDiff re mkUnit token'' = token' re fcs- token1'' = token' re1 fcs+ token1'' = token' re1 fcs fcs = firstChars re - -- token' :: (Eq l, Show l) => GenRegex l -> CharSet -> String -> [(l,String)]+ -- token' :: (Eq l, Show l) => GenRegex l -> CharSet -> String -> [(l,String)] token' re' fcs' inp- | null inp = []- | otherwise = evalRes . splitWithRegexCS re' fcs' $ inp- where- evalRes Nothing = token'' (tail inp) -- re does not match any prefix- evalRes (Just (toks, rest))- | null tok = res ++ token'' (tail rest) -- re is nullable and only the empty prefix matches- | otherwise = res ++ token1'' rest -- token found, tokenize the rest- where- res = map (first fromJust) . tail $ toks- tok = snd . head $ toks+ | null inp = []+ | otherwise = evalRes . splitWithRegexCS re' fcs' $ inp+ where+ evalRes Nothing = token'' (tail inp) -- re does not match any prefix+ evalRes (Just (toks, rest))+ | null tok = res ++ token'' (tail rest) -- re is nullable and only the empty prefix matches+ | otherwise = res ++ token1'' rest -- token found, tokenize the rest+ where+ res = map (first fromJust) . tail $ toks+ tok = snd . head $ toks -- | convenient function for 'tokenizeSubexRE' a string --@@ -323,8 +323,8 @@ -- > "12 34.56" = [("real","12"),("n","12"),("f","") -- > ,("real","34.56"),("n","34"),("f","56")] -tokenizeSubex :: String -> String -> [(String,String)]-tokenizeSubex = tokenizeSubexRE . parseRegex+tokenizeSubex :: String -> String -> [(String,String)]+tokenizeSubex = tokenizeSubexRE . parseRegex -- ------------------------------------------------------------ @@ -333,8 +333,8 @@ -- All matching tokens are edited by the 1. argument, the editing function, -- all other chars remain as they are -sedRE :: (Eq l, Show l) => (String -> String) -> GenRegex l -> String -> String-sedRE edit re = concatMap (either id edit) . tokenizeRE' re+sedRE :: (Eq l, Show l) => (String -> String) -> GenRegex l -> String -> String+sedRE edit re = concatMap (either id edit) . tokenizeRE' re -- | convenient function for 'sedRE' --@@ -344,15 +344,15 @@ -- > sed (\ x -> x ++ x) "a" "xax" = "xaax" -- > sed undefined "[" "xxx" = "xxx" -sed :: (String -> String) -> String -> String -> String-sed edit = sedRE edit . parseRegex+sed :: (String -> String) -> String -> String -> String+sed edit = sedRE edit . parseRegex -- ------------------------------------------------------------ -- | match a string with a regular expression -matchRE :: (Eq l, Show l) => GenRegex l -> String -> Bool-matchRE = matchWithRegex+matchRE :: (Eq l, Show l) => GenRegex l -> String -> Bool+matchRE = matchWithRegex -- | convenient function for 'matchRE' --@@ -362,16 +362,16 @@ -- > match "x" "xxx" = False -- > match "[" "xxx" = False -match :: String -> String -> Bool-match = matchWithRegex . parseRegex+match :: String -> String -> Bool+match = matchWithRegex . parseRegex -- ------------------------------------------------------------ -- | match a string with a regular expression -- and extract subexpression matches -matchSubexRE :: (Eq l, Show l) => GenRegex l -> String -> [(l, String)]-matchSubexRE re = map (first fromJust) . fromMaybe [] . matchWithRegex' re+matchSubexRE :: (Eq l, Show l) => GenRegex l -> String -> [(l, String)]+matchSubexRE re = map (first fromJust) . fromMaybe [] . matchWithRegex' re -- | convenient function for 'matchRE' --@@ -382,8 +382,8 @@ -- > matchSubex "({w}[0-9]+)x({h}[0-9]+)" "800x600" = [("w","800"),("h","600")] -- > matchSubex "[" "xxx" = [] -matchSubex :: String -> String -> [(String, String)]-matchSubex = matchSubexRE . parseRegex+matchSubex :: String -> String -> [(String, String)]+matchSubex = matchSubexRE . parseRegex -- ------------------------------------------------------------ @@ -403,20 +403,20 @@ -- > grep "\\<a" ["x a b", " ax ", " xa ", "xab"] => ["x a b", " ax "] -- > grep "a\\>" ["x a b", " ax ", " xa ", "xab"] => ["x a b", " xa "] -grep :: String -> [String] -> [String]-grep re = filter (matchRE re')- where- re' = mkSeqs . concat $ [ startContext- , (:[]) . parseRegex $ re2- , endContext- ]- (startContext, re1)- | "^" `isPrefixOf` re = ([], tail re)- | "\\<" `isPrefixOf` re = ([parseRegex "(\\A\\W)?"], drop 2 re)- | otherwise = ([mkStar mkDot], re)- (endContext, re2)- | "$" `isSuffixOf` re1 = ([], init re1)- | "\\>" `isSuffixOf` re1 = ([parseRegex "(\\W\\A)?"], init . init $ re1)- | otherwise = ([mkStar mkDot], re1)+grep :: String -> [String] -> [String]+grep re = filter (matchRE re')+ where+ re' = mkSeqs . concat $ [ startContext+ , (:[]) . parseRegex $ re2+ , endContext+ ]+ (startContext, re1)+ | "^" `isPrefixOf` re = ([], tail re)+ | "\\<" `isPrefixOf` re = ([parseRegex "(\\A\\W)?"], drop 2 re)+ | otherwise = ([mkStar mkDot], re)+ (endContext, re2)+ | "$" `isSuffixOf` re1 = ([], init re1)+ | "\\>" `isSuffixOf` re1 = ([parseRegex "(\\W\\A)?"], init . init $ re1)+ | otherwise = ([mkStar mkDot], re1) -- ------------------------------------------------------------
src/Text/Regex/XMLSchema/String/Regex.hs view
@@ -64,7 +64,6 @@ ) where -import Data.Maybe import Data.List -- ( intercalate ) import Text.Regex.XMLSchema.String.CharSet
src/Text/Regex/XMLSchema/String/RegexParser.hs view
@@ -71,7 +71,7 @@ where branchList1 = do- char '|'+ _ <- char '|' orElseList orElseList :: Parser Regex@@ -84,7 +84,7 @@ where orElseList1 = do- try (string "{|}")+ _ <- try (string "{|}") interleaveList interleaveList :: Parser Regex@@ -97,7 +97,7 @@ where interleaveList1 = do- try (string "{:}")+ _ <- try (string "{:}") exorList exorList :: Parser Regex@@ -109,7 +109,7 @@ where exorList1 = do- try (string "{^}")+ _ <- try (string "{^}") diffList diffList :: Parser Regex@@ -121,7 +121,7 @@ where diffList1 = do- try (string "{\\}")+ _ <- try (string "{\\}") intersectList intersectList :: Parser Regex@@ -133,7 +133,7 @@ where intersectList1 = do- try (string "{&}")+ _ <- try (string "{&}") seqList seqList :: Parser Regex@@ -163,9 +163,9 @@ return $ mkRep 1 r ) <|> try ( do- char '{'+ _ <- char '{' res <- quantity r- char '}'+ _ <- char '}' return res ) <|>@@ -255,11 +255,11 @@ return $ mkSym . fromJust . lookup c $ pm ) <|> ( do -- extension: \a represents the whole alphabet inclusive newline chars: \a == .|\n|\r- char 'a'+ _ <- char 'a' return mkDot ) <|> ( do -- extension: \A represents all words: \A == \a* or \A == (.|\n|\r)*- char 'A'+ _ <- char 'A' return mkAll ) where es = map fst pm@@ -284,7 +284,7 @@ catEsc :: Parser Regex catEsc = do- char 'p'+ _ <- char 'p' s <- between (char '{') (char '}') charProp return $ mkSym s @@ -432,7 +432,7 @@ xmlCharIncDash :: Parser Regex xmlCharIncDash- = try ( do -- dash is only allowed if not followed by a [, else charGroup differences do not parse correctly+ = try ( do -- dash is only allowed if not followed by a [, else charGroup differences do not parse correctly _ <- char '-' notFollowedBy (char '[') return $ mkSym1 '-'@@ -453,7 +453,7 @@ wildCardEsc :: Parser Regex wildCardEsc = do- char '.'+ _ <- char '.' return . mkSym . compCS $ stringCS "\n\r"
src/Text/Regex/XMLSchema/String/Unicode/Blocks.hs view
@@ -25,203 +25,203 @@ codeBlocks :: [(String, (Char, Char))] codeBlocks =- [ ( "BasicLatin", ( '\x0000', '\x007F') )- , ( "Latin-1Supplement", ( '\x0080', '\x00FF') )- , ( "LatinExtended-A", ( '\x0100', '\x017F') )- , ( "LatinExtended-B", ( '\x0180', '\x024F') )- , ( "IPAExtensions", ( '\x0250', '\x02AF') )- , ( "SpacingModifierLetters", ( '\x02B0', '\x02FF') )- , ( "CombiningDiacriticalMarks", ( '\x0300', '\x036F') )- , ( "GreekandCoptic", ( '\x0370', '\x03FF') )- , ( "Cyrillic", ( '\x0400', '\x04FF') )- , ( "CyrillicSupplement", ( '\x0500', '\x052F') )- , ( "Armenian", ( '\x0530', '\x058F') )- , ( "Hebrew", ( '\x0590', '\x05FF') )- , ( "Arabic", ( '\x0600', '\x06FF') )- , ( "Syriac", ( '\x0700', '\x074F') )- , ( "ArabicSupplement", ( '\x0750', '\x077F') )- , ( "Thaana", ( '\x0780', '\x07BF') )- , ( "NKo", ( '\x07C0', '\x07FF') )- , ( "Samaritan", ( '\x0800', '\x083F') )- , ( "Devanagari", ( '\x0900', '\x097F') )- , ( "Bengali", ( '\x0980', '\x09FF') )- , ( "Gurmukhi", ( '\x0A00', '\x0A7F') )- , ( "Gujarati", ( '\x0A80', '\x0AFF') )- , ( "Oriya", ( '\x0B00', '\x0B7F') )- , ( "Tamil", ( '\x0B80', '\x0BFF') )- , ( "Telugu", ( '\x0C00', '\x0C7F') )- , ( "Kannada", ( '\x0C80', '\x0CFF') )- , ( "Malayalam", ( '\x0D00', '\x0D7F') )- , ( "Sinhala", ( '\x0D80', '\x0DFF') )- , ( "Thai", ( '\x0E00', '\x0E7F') )- , ( "Lao", ( '\x0E80', '\x0EFF') )- , ( "Tibetan", ( '\x0F00', '\x0FFF') )- , ( "Myanmar", ( '\x1000', '\x109F') )- , ( "Georgian", ( '\x10A0', '\x10FF') )- , ( "HangulJamo", ( '\x1100', '\x11FF') )- , ( "Ethiopic", ( '\x1200', '\x137F') )- , ( "EthiopicSupplement", ( '\x1380', '\x139F') )- , ( "Cherokee", ( '\x13A0', '\x13FF') )- , ( "UnifiedCanadianAboriginalSyllabics", ( '\x1400', '\x167F') )- , ( "Ogham", ( '\x1680', '\x169F') )- , ( "Runic", ( '\x16A0', '\x16FF') )- , ( "Tagalog", ( '\x1700', '\x171F') )- , ( "Hanunoo", ( '\x1720', '\x173F') )- , ( "Buhid", ( '\x1740', '\x175F') )- , ( "Tagbanwa", ( '\x1760', '\x177F') )- , ( "Khmer", ( '\x1780', '\x17FF') )- , ( "Mongolian", ( '\x1800', '\x18AF') )- , ( "UnifiedCanadianAboriginalSyllabicsExtended", ( '\x18B0', '\x18FF') )- , ( "Limbu", ( '\x1900', '\x194F') )- , ( "TaiLe", ( '\x1950', '\x197F') )- , ( "NewTaiLue", ( '\x1980', '\x19DF') )- , ( "KhmerSymbols", ( '\x19E0', '\x19FF') )- , ( "Buginese", ( '\x1A00', '\x1A1F') )- , ( "TaiTham", ( '\x1A20', '\x1AAF') )- , ( "Balinese", ( '\x1B00', '\x1B7F') )- , ( "Sundanese", ( '\x1B80', '\x1BBF') )- , ( "Lepcha", ( '\x1C00', '\x1C4F') )- , ( "OlChiki", ( '\x1C50', '\x1C7F') )- , ( "VedicExtensions", ( '\x1CD0', '\x1CFF') )- , ( "PhoneticExtensions", ( '\x1D00', '\x1D7F') )- , ( "PhoneticExtensionsSupplement", ( '\x1D80', '\x1DBF') )- , ( "CombiningDiacriticalMarksSupplement", ( '\x1DC0', '\x1DFF') )- , ( "LatinExtendedAdditional", ( '\x1E00', '\x1EFF') )- , ( "GreekExtended", ( '\x1F00', '\x1FFF') )- , ( "GeneralPunctuation", ( '\x2000', '\x206F') )- , ( "SuperscriptsandSubscripts", ( '\x2070', '\x209F') )- , ( "CurrencySymbols", ( '\x20A0', '\x20CF') )- , ( "CombiningDiacriticalMarksforSymbols", ( '\x20D0', '\x20FF') )- , ( "LetterlikeSymbols", ( '\x2100', '\x214F') )- , ( "NumberForms", ( '\x2150', '\x218F') )- , ( "Arrows", ( '\x2190', '\x21FF') )- , ( "MathematicalOperators", ( '\x2200', '\x22FF') )- , ( "MiscellaneousTechnical", ( '\x2300', '\x23FF') )- , ( "ControlPictures", ( '\x2400', '\x243F') )- , ( "OpticalCharacterRecognition", ( '\x2440', '\x245F') )- , ( "EnclosedAlphanumerics", ( '\x2460', '\x24FF') )- , ( "BoxDrawing", ( '\x2500', '\x257F') )- , ( "BlockElements", ( '\x2580', '\x259F') )- , ( "GeometricShapes", ( '\x25A0', '\x25FF') )- , ( "MiscellaneousSymbols", ( '\x2600', '\x26FF') )- , ( "Dingbats", ( '\x2700', '\x27BF') )- , ( "MiscellaneousMathematicalSymbols-A", ( '\x27C0', '\x27EF') )- , ( "SupplementalArrows-A", ( '\x27F0', '\x27FF') )- , ( "BraillePatterns", ( '\x2800', '\x28FF') )- , ( "SupplementalArrows-B", ( '\x2900', '\x297F') )- , ( "MiscellaneousMathematicalSymbols-B", ( '\x2980', '\x29FF') )- , ( "SupplementalMathematicalOperators", ( '\x2A00', '\x2AFF') )- , ( "MiscellaneousSymbolsandArrows", ( '\x2B00', '\x2BFF') )- , ( "Glagolitic", ( '\x2C00', '\x2C5F') )- , ( "LatinExtended-C", ( '\x2C60', '\x2C7F') )- , ( "Coptic", ( '\x2C80', '\x2CFF') )- , ( "GeorgianSupplement", ( '\x2D00', '\x2D2F') )- , ( "Tifinagh", ( '\x2D30', '\x2D7F') )- , ( "EthiopicExtended", ( '\x2D80', '\x2DDF') )- , ( "CyrillicExtended-A", ( '\x2DE0', '\x2DFF') )- , ( "SupplementalPunctuation", ( '\x2E00', '\x2E7F') )- , ( "CJKRadicalsSupplement", ( '\x2E80', '\x2EFF') )- , ( "KangxiRadicals", ( '\x2F00', '\x2FDF') )- , ( "IdeographicDescriptionCharacters", ( '\x2FF0', '\x2FFF') )- , ( "CJKSymbolsandPunctuation", ( '\x3000', '\x303F') )- , ( "Hiragana", ( '\x3040', '\x309F') )- , ( "Katakana", ( '\x30A0', '\x30FF') )- , ( "Bopomofo", ( '\x3100', '\x312F') )- , ( "HangulCompatibilityJamo", ( '\x3130', '\x318F') )- , ( "Kanbun", ( '\x3190', '\x319F') )- , ( "BopomofoExtended", ( '\x31A0', '\x31BF') )- , ( "CJKStrokes", ( '\x31C0', '\x31EF') )- , ( "KatakanaPhoneticExtensions", ( '\x31F0', '\x31FF') )- , ( "EnclosedCJKLettersandMonths", ( '\x3200', '\x32FF') )- , ( "CJKCompatibility", ( '\x3300', '\x33FF') )- , ( "CJKUnifiedIdeographsExtensionA", ( '\x3400', '\x4DBF') )- , ( "YijingHexagramSymbols", ( '\x4DC0', '\x4DFF') )- , ( "CJKUnifiedIdeographs", ( '\x4E00', '\x9FFF') )- , ( "YiSyllables", ( '\xA000', '\xA48F') )- , ( "YiRadicals", ( '\xA490', '\xA4CF') )- , ( "Lisu", ( '\xA4D0', '\xA4FF') )- , ( "Vai", ( '\xA500', '\xA63F') )- , ( "CyrillicExtended-B", ( '\xA640', '\xA69F') )- , ( "Bamum", ( '\xA6A0', '\xA6FF') )- , ( "ModifierToneLetters", ( '\xA700', '\xA71F') )- , ( "LatinExtended-D", ( '\xA720', '\xA7FF') )- , ( "SylotiNagri", ( '\xA800', '\xA82F') )- , ( "CommonIndicNumberForms", ( '\xA830', '\xA83F') )- , ( "Phags-pa", ( '\xA840', '\xA87F') )- , ( "Saurashtra", ( '\xA880', '\xA8DF') )- , ( "DevanagariExtended", ( '\xA8E0', '\xA8FF') )- , ( "KayahLi", ( '\xA900', '\xA92F') )- , ( "Rejang", ( '\xA930', '\xA95F') )- , ( "HangulJamoExtended-A", ( '\xA960', '\xA97F') )- , ( "Javanese", ( '\xA980', '\xA9DF') )- , ( "Cham", ( '\xAA00', '\xAA5F') )- , ( "MyanmarExtended-A", ( '\xAA60', '\xAA7F') )- , ( "TaiViet", ( '\xAA80', '\xAADF') )- , ( "MeeteiMayek", ( '\xABC0', '\xABFF') )- , ( "HangulSyllables", ( '\xAC00', '\xD7AF') )- , ( "HangulJamoExtended-B", ( '\xD7B0', '\xD7FF') )- , ( "HighSurrogates", ( '\xD800', '\xDB7F') )- , ( "HighPrivateUseSurrogates", ( '\xDB80', '\xDBFF') )- , ( "LowSurrogates", ( '\xDC00', '\xDFFF') )- , ( "PrivateUseArea", ( '\xE000', '\xF8FF') )- , ( "CJKCompatibilityIdeographs", ( '\xF900', '\xFAFF') )- , ( "AlphabeticPresentationForms", ( '\xFB00', '\xFB4F') )- , ( "ArabicPresentationForms-A", ( '\xFB50', '\xFDFF') )- , ( "VariationSelectors", ( '\xFE00', '\xFE0F') )- , ( "VerticalForms", ( '\xFE10', '\xFE1F') )- , ( "CombiningHalfMarks", ( '\xFE20', '\xFE2F') )- , ( "CJKCompatibilityForms", ( '\xFE30', '\xFE4F') )- , ( "SmallFormVariants", ( '\xFE50', '\xFE6F') )- , ( "ArabicPresentationForms-B", ( '\xFE70', '\xFEFF') )- , ( "HalfwidthandFullwidthForms", ( '\xFF00', '\xFFEF') )- , ( "Specials", ( '\xFFF0', '\xFFFF') )- , ( "LinearBSyllabary", ( '\x10000', '\x1007F') )- , ( "LinearBIdeograms", ( '\x10080', '\x100FF') )- , ( "AegeanNumbers", ( '\x10100', '\x1013F') )- , ( "AncientGreekNumbers", ( '\x10140', '\x1018F') )- , ( "AncientSymbols", ( '\x10190', '\x101CF') )- , ( "PhaistosDisc", ( '\x101D0', '\x101FF') )- , ( "Lycian", ( '\x10280', '\x1029F') )- , ( "Carian", ( '\x102A0', '\x102DF') )- , ( "OldItalic", ( '\x10300', '\x1032F') )- , ( "Gothic", ( '\x10330', '\x1034F') )- , ( "Ugaritic", ( '\x10380', '\x1039F') )- , ( "OldPersian", ( '\x103A0', '\x103DF') )- , ( "Deseret", ( '\x10400', '\x1044F') )- , ( "Shavian", ( '\x10450', '\x1047F') )- , ( "Osmanya", ( '\x10480', '\x104AF') )- , ( "CypriotSyllabary", ( '\x10800', '\x1083F') )- , ( "ImperialAramaic", ( '\x10840', '\x1085F') )- , ( "Phoenician", ( '\x10900', '\x1091F') )- , ( "Lydian", ( '\x10920', '\x1093F') )- , ( "Kharoshthi", ( '\x10A00', '\x10A5F') )- , ( "OldSouthArabian", ( '\x10A60', '\x10A7F') )- , ( "Avestan", ( '\x10B00', '\x10B3F') )- , ( "InscriptionalParthian", ( '\x10B40', '\x10B5F') )- , ( "InscriptionalPahlavi", ( '\x10B60', '\x10B7F') )- , ( "OldTurkic", ( '\x10C00', '\x10C4F') )- , ( "RumiNumeralSymbols", ( '\x10E60', '\x10E7F') )- , ( "Kaithi", ( '\x11080', '\x110CF') )- , ( "Cuneiform", ( '\x12000', '\x123FF') )- , ( "CuneiformNumbersandPunctuation", ( '\x12400', '\x1247F') )- , ( "EgyptianHieroglyphs", ( '\x13000', '\x1342F') )- , ( "ByzantineMusicalSymbols", ( '\x1D000', '\x1D0FF') )- , ( "MusicalSymbols", ( '\x1D100', '\x1D1FF') )- , ( "AncientGreekMusicalNotation", ( '\x1D200', '\x1D24F') )- , ( "TaiXuanJingSymbols", ( '\x1D300', '\x1D35F') )- , ( "CountingRodNumerals", ( '\x1D360', '\x1D37F') )- , ( "MathematicalAlphanumericSymbols", ( '\x1D400', '\x1D7FF') )- , ( "MahjongTiles", ( '\x1F000', '\x1F02F') )- , ( "DominoTiles", ( '\x1F030', '\x1F09F') )- , ( "EnclosedAlphanumericSupplement", ( '\x1F100', '\x1F1FF') )- , ( "EnclosedIdeographicSupplement", ( '\x1F200', '\x1F2FF') )- , ( "CJKUnifiedIdeographsExtensionB", ( '\x20000', '\x2A6DF') )- , ( "CJKUnifiedIdeographsExtensionC", ( '\x2A700', '\x2B73F') )- , ( "CJKCompatibilityIdeographsSupplement", ( '\x2F800', '\x2FA1F') )- , ( "Tags", ( '\xE0000', '\xE007F') )- , ( "VariationSelectorsSupplement", ( '\xE0100', '\xE01EF') )- , ( "SupplementaryPrivateUseArea-A", ( '\xF0000', '\xFFFFF') )- , ( "SupplementaryPrivateUseArea-B", ( '\x100000', '\x10FFFF') )+ [ ( "BasicLatin", ( '\x0000', '\x007F') )+ , ( "Latin-1Supplement", ( '\x0080', '\x00FF') )+ , ( "LatinExtended-A", ( '\x0100', '\x017F') )+ , ( "LatinExtended-B", ( '\x0180', '\x024F') )+ , ( "IPAExtensions", ( '\x0250', '\x02AF') )+ , ( "SpacingModifierLetters", ( '\x02B0', '\x02FF') )+ , ( "CombiningDiacriticalMarks", ( '\x0300', '\x036F') )+ , ( "GreekandCoptic", ( '\x0370', '\x03FF') )+ , ( "Cyrillic", ( '\x0400', '\x04FF') )+ , ( "CyrillicSupplement", ( '\x0500', '\x052F') )+ , ( "Armenian", ( '\x0530', '\x058F') )+ , ( "Hebrew", ( '\x0590', '\x05FF') )+ , ( "Arabic", ( '\x0600', '\x06FF') )+ , ( "Syriac", ( '\x0700', '\x074F') )+ , ( "ArabicSupplement", ( '\x0750', '\x077F') )+ , ( "Thaana", ( '\x0780', '\x07BF') )+ , ( "NKo", ( '\x07C0', '\x07FF') )+ , ( "Samaritan", ( '\x0800', '\x083F') )+ , ( "Devanagari", ( '\x0900', '\x097F') )+ , ( "Bengali", ( '\x0980', '\x09FF') )+ , ( "Gurmukhi", ( '\x0A00', '\x0A7F') )+ , ( "Gujarati", ( '\x0A80', '\x0AFF') )+ , ( "Oriya", ( '\x0B00', '\x0B7F') )+ , ( "Tamil", ( '\x0B80', '\x0BFF') )+ , ( "Telugu", ( '\x0C00', '\x0C7F') )+ , ( "Kannada", ( '\x0C80', '\x0CFF') )+ , ( "Malayalam", ( '\x0D00', '\x0D7F') )+ , ( "Sinhala", ( '\x0D80', '\x0DFF') )+ , ( "Thai", ( '\x0E00', '\x0E7F') )+ , ( "Lao", ( '\x0E80', '\x0EFF') )+ , ( "Tibetan", ( '\x0F00', '\x0FFF') )+ , ( "Myanmar", ( '\x1000', '\x109F') )+ , ( "Georgian", ( '\x10A0', '\x10FF') )+ , ( "HangulJamo", ( '\x1100', '\x11FF') )+ , ( "Ethiopic", ( '\x1200', '\x137F') )+ , ( "EthiopicSupplement", ( '\x1380', '\x139F') )+ , ( "Cherokee", ( '\x13A0', '\x13FF') )+ , ( "UnifiedCanadianAboriginalSyllabics", ( '\x1400', '\x167F') )+ , ( "Ogham", ( '\x1680', '\x169F') )+ , ( "Runic", ( '\x16A0', '\x16FF') )+ , ( "Tagalog", ( '\x1700', '\x171F') )+ , ( "Hanunoo", ( '\x1720', '\x173F') )+ , ( "Buhid", ( '\x1740', '\x175F') )+ , ( "Tagbanwa", ( '\x1760', '\x177F') )+ , ( "Khmer", ( '\x1780', '\x17FF') )+ , ( "Mongolian", ( '\x1800', '\x18AF') )+ , ( "UnifiedCanadianAboriginalSyllabicsExtended", ( '\x18B0', '\x18FF') )+ , ( "Limbu", ( '\x1900', '\x194F') )+ , ( "TaiLe", ( '\x1950', '\x197F') )+ , ( "NewTaiLue", ( '\x1980', '\x19DF') )+ , ( "KhmerSymbols", ( '\x19E0', '\x19FF') )+ , ( "Buginese", ( '\x1A00', '\x1A1F') )+ , ( "TaiTham", ( '\x1A20', '\x1AAF') )+ , ( "Balinese", ( '\x1B00', '\x1B7F') )+ , ( "Sundanese", ( '\x1B80', '\x1BBF') )+ , ( "Lepcha", ( '\x1C00', '\x1C4F') )+ , ( "OlChiki", ( '\x1C50', '\x1C7F') )+ , ( "VedicExtensions", ( '\x1CD0', '\x1CFF') )+ , ( "PhoneticExtensions", ( '\x1D00', '\x1D7F') )+ , ( "PhoneticExtensionsSupplement", ( '\x1D80', '\x1DBF') )+ , ( "CombiningDiacriticalMarksSupplement", ( '\x1DC0', '\x1DFF') )+ , ( "LatinExtendedAdditional", ( '\x1E00', '\x1EFF') )+ , ( "GreekExtended", ( '\x1F00', '\x1FFF') )+ , ( "GeneralPunctuation", ( '\x2000', '\x206F') )+ , ( "SuperscriptsandSubscripts", ( '\x2070', '\x209F') )+ , ( "CurrencySymbols", ( '\x20A0', '\x20CF') )+ , ( "CombiningDiacriticalMarksforSymbols", ( '\x20D0', '\x20FF') )+ , ( "LetterlikeSymbols", ( '\x2100', '\x214F') )+ , ( "NumberForms", ( '\x2150', '\x218F') )+ , ( "Arrows", ( '\x2190', '\x21FF') )+ , ( "MathematicalOperators", ( '\x2200', '\x22FF') )+ , ( "MiscellaneousTechnical", ( '\x2300', '\x23FF') )+ , ( "ControlPictures", ( '\x2400', '\x243F') )+ , ( "OpticalCharacterRecognition", ( '\x2440', '\x245F') )+ , ( "EnclosedAlphanumerics", ( '\x2460', '\x24FF') )+ , ( "BoxDrawing", ( '\x2500', '\x257F') )+ , ( "BlockElements", ( '\x2580', '\x259F') )+ , ( "GeometricShapes", ( '\x25A0', '\x25FF') )+ , ( "MiscellaneousSymbols", ( '\x2600', '\x26FF') )+ , ( "Dingbats", ( '\x2700', '\x27BF') )+ , ( "MiscellaneousMathematicalSymbols-A", ( '\x27C0', '\x27EF') )+ , ( "SupplementalArrows-A", ( '\x27F0', '\x27FF') )+ , ( "BraillePatterns", ( '\x2800', '\x28FF') )+ , ( "SupplementalArrows-B", ( '\x2900', '\x297F') )+ , ( "MiscellaneousMathematicalSymbols-B", ( '\x2980', '\x29FF') )+ , ( "SupplementalMathematicalOperators", ( '\x2A00', '\x2AFF') )+ , ( "MiscellaneousSymbolsandArrows", ( '\x2B00', '\x2BFF') )+ , ( "Glagolitic", ( '\x2C00', '\x2C5F') )+ , ( "LatinExtended-C", ( '\x2C60', '\x2C7F') )+ , ( "Coptic", ( '\x2C80', '\x2CFF') )+ , ( "GeorgianSupplement", ( '\x2D00', '\x2D2F') )+ , ( "Tifinagh", ( '\x2D30', '\x2D7F') )+ , ( "EthiopicExtended", ( '\x2D80', '\x2DDF') )+ , ( "CyrillicExtended-A", ( '\x2DE0', '\x2DFF') )+ , ( "SupplementalPunctuation", ( '\x2E00', '\x2E7F') )+ , ( "CJKRadicalsSupplement", ( '\x2E80', '\x2EFF') )+ , ( "KangxiRadicals", ( '\x2F00', '\x2FDF') )+ , ( "IdeographicDescriptionCharacters", ( '\x2FF0', '\x2FFF') )+ , ( "CJKSymbolsandPunctuation", ( '\x3000', '\x303F') )+ , ( "Hiragana", ( '\x3040', '\x309F') )+ , ( "Katakana", ( '\x30A0', '\x30FF') )+ , ( "Bopomofo", ( '\x3100', '\x312F') )+ , ( "HangulCompatibilityJamo", ( '\x3130', '\x318F') )+ , ( "Kanbun", ( '\x3190', '\x319F') )+ , ( "BopomofoExtended", ( '\x31A0', '\x31BF') )+ , ( "CJKStrokes", ( '\x31C0', '\x31EF') )+ , ( "KatakanaPhoneticExtensions", ( '\x31F0', '\x31FF') )+ , ( "EnclosedCJKLettersandMonths", ( '\x3200', '\x32FF') )+ , ( "CJKCompatibility", ( '\x3300', '\x33FF') )+ , ( "CJKUnifiedIdeographsExtensionA", ( '\x3400', '\x4DBF') )+ , ( "YijingHexagramSymbols", ( '\x4DC0', '\x4DFF') )+ , ( "CJKUnifiedIdeographs", ( '\x4E00', '\x9FFF') )+ , ( "YiSyllables", ( '\xA000', '\xA48F') )+ , ( "YiRadicals", ( '\xA490', '\xA4CF') )+ , ( "Lisu", ( '\xA4D0', '\xA4FF') )+ , ( "Vai", ( '\xA500', '\xA63F') )+ , ( "CyrillicExtended-B", ( '\xA640', '\xA69F') )+ , ( "Bamum", ( '\xA6A0', '\xA6FF') )+ , ( "ModifierToneLetters", ( '\xA700', '\xA71F') )+ , ( "LatinExtended-D", ( '\xA720', '\xA7FF') )+ , ( "SylotiNagri", ( '\xA800', '\xA82F') )+ , ( "CommonIndicNumberForms", ( '\xA830', '\xA83F') )+ , ( "Phags-pa", ( '\xA840', '\xA87F') )+ , ( "Saurashtra", ( '\xA880', '\xA8DF') )+ , ( "DevanagariExtended", ( '\xA8E0', '\xA8FF') )+ , ( "KayahLi", ( '\xA900', '\xA92F') )+ , ( "Rejang", ( '\xA930', '\xA95F') )+ , ( "HangulJamoExtended-A", ( '\xA960', '\xA97F') )+ , ( "Javanese", ( '\xA980', '\xA9DF') )+ , ( "Cham", ( '\xAA00', '\xAA5F') )+ , ( "MyanmarExtended-A", ( '\xAA60', '\xAA7F') )+ , ( "TaiViet", ( '\xAA80', '\xAADF') )+ , ( "MeeteiMayek", ( '\xABC0', '\xABFF') )+ , ( "HangulSyllables", ( '\xAC00', '\xD7AF') )+ , ( "HangulJamoExtended-B", ( '\xD7B0', '\xD7FF') )+ , ( "HighSurrogates", ( '\xD800', '\xDB7F') )+ , ( "HighPrivateUseSurrogates", ( '\xDB80', '\xDBFF') )+ , ( "LowSurrogates", ( '\xDC00', '\xDFFF') )+ , ( "PrivateUseArea", ( '\xE000', '\xF8FF') )+ , ( "CJKCompatibilityIdeographs", ( '\xF900', '\xFAFF') )+ , ( "AlphabeticPresentationForms", ( '\xFB00', '\xFB4F') )+ , ( "ArabicPresentationForms-A", ( '\xFB50', '\xFDFF') )+ , ( "VariationSelectors", ( '\xFE00', '\xFE0F') )+ , ( "VerticalForms", ( '\xFE10', '\xFE1F') )+ , ( "CombiningHalfMarks", ( '\xFE20', '\xFE2F') )+ , ( "CJKCompatibilityForms", ( '\xFE30', '\xFE4F') )+ , ( "SmallFormVariants", ( '\xFE50', '\xFE6F') )+ , ( "ArabicPresentationForms-B", ( '\xFE70', '\xFEFF') )+ , ( "HalfwidthandFullwidthForms", ( '\xFF00', '\xFFEF') )+ , ( "Specials", ( '\xFFF0', '\xFFFF') )+ , ( "LinearBSyllabary", ( '\x10000', '\x1007F') )+ , ( "LinearBIdeograms", ( '\x10080', '\x100FF') )+ , ( "AegeanNumbers", ( '\x10100', '\x1013F') )+ , ( "AncientGreekNumbers", ( '\x10140', '\x1018F') )+ , ( "AncientSymbols", ( '\x10190', '\x101CF') )+ , ( "PhaistosDisc", ( '\x101D0', '\x101FF') )+ , ( "Lycian", ( '\x10280', '\x1029F') )+ , ( "Carian", ( '\x102A0', '\x102DF') )+ , ( "OldItalic", ( '\x10300', '\x1032F') )+ , ( "Gothic", ( '\x10330', '\x1034F') )+ , ( "Ugaritic", ( '\x10380', '\x1039F') )+ , ( "OldPersian", ( '\x103A0', '\x103DF') )+ , ( "Deseret", ( '\x10400', '\x1044F') )+ , ( "Shavian", ( '\x10450', '\x1047F') )+ , ( "Osmanya", ( '\x10480', '\x104AF') )+ , ( "CypriotSyllabary", ( '\x10800', '\x1083F') )+ , ( "ImperialAramaic", ( '\x10840', '\x1085F') )+ , ( "Phoenician", ( '\x10900', '\x1091F') )+ , ( "Lydian", ( '\x10920', '\x1093F') )+ , ( "Kharoshthi", ( '\x10A00', '\x10A5F') )+ , ( "OldSouthArabian", ( '\x10A60', '\x10A7F') )+ , ( "Avestan", ( '\x10B00', '\x10B3F') )+ , ( "InscriptionalParthian", ( '\x10B40', '\x10B5F') )+ , ( "InscriptionalPahlavi", ( '\x10B60', '\x10B7F') )+ , ( "OldTurkic", ( '\x10C00', '\x10C4F') )+ , ( "RumiNumeralSymbols", ( '\x10E60', '\x10E7F') )+ , ( "Kaithi", ( '\x11080', '\x110CF') )+ , ( "Cuneiform", ( '\x12000', '\x123FF') )+ , ( "CuneiformNumbersandPunctuation", ( '\x12400', '\x1247F') )+ , ( "EgyptianHieroglyphs", ( '\x13000', '\x1342F') )+ , ( "ByzantineMusicalSymbols", ( '\x1D000', '\x1D0FF') )+ , ( "MusicalSymbols", ( '\x1D100', '\x1D1FF') )+ , ( "AncientGreekMusicalNotation", ( '\x1D200', '\x1D24F') )+ , ( "TaiXuanJingSymbols", ( '\x1D300', '\x1D35F') )+ , ( "CountingRodNumerals", ( '\x1D360', '\x1D37F') )+ , ( "MathematicalAlphanumericSymbols", ( '\x1D400', '\x1D7FF') )+ , ( "MahjongTiles", ( '\x1F000', '\x1F02F') )+ , ( "DominoTiles", ( '\x1F030', '\x1F09F') )+ , ( "EnclosedAlphanumericSupplement", ( '\x1F100', '\x1F1FF') )+ , ( "EnclosedIdeographicSupplement", ( '\x1F200', '\x1F2FF') )+ , ( "CJKUnifiedIdeographsExtensionB", ( '\x20000', '\x2A6DF') )+ , ( "CJKUnifiedIdeographsExtensionC", ( '\x2A700', '\x2B73F') )+ , ( "CJKCompatibilityIdeographsSupplement", ( '\x2F800', '\x2FA1F') )+ , ( "Tags", ( '\xE0000', '\xE007F') )+ , ( "VariationSelectorsSupplement", ( '\xE0100', '\xE01EF') )+ , ( "SupplementaryPrivateUseArea-A", ( '\xF0000', '\xFFFFF') )+ , ( "SupplementaryPrivateUseArea-B", ( '\x100000', '\x10FFFF') ) ] -- ------------------------------------------------------------
src/Text/Regex/XMLSchema/String/Unicode/Blocks.txt view
@@ -17,7 +17,7 @@ # Note: When comparing block names, casing, whitespace, hyphens, # and underbars are ignored. # For example, "Latin Extended-A" and "latin extended a" are equivalent.-# For more information on the comparison of property values, +# For more information on the comparison of property values, # see UAX #44: http://www.unicode.org/reports/tr44/ # # All code points not explicitly listed for Block
src/Text/Regex/XMLSchema/String/Unicode/CharProps.hs view
@@ -62,7 +62,7 @@ -- ------------------------------------------------------------ -isUnicodeC :: CharSet+isUnicodeC :: CharSet isUnicodeC = [ ('\NUL','\US') , ('\DEL','\159')@@ -94,7 +94,7 @@ -- ------------------------------------------------------------ -isUnicodeCc :: CharSet+isUnicodeCc :: CharSet isUnicodeCc = [ ('\NUL','\US') , ('\DEL','\159')@@ -102,7 +102,7 @@ -- ------------------------------------------------------------ -isUnicodeCf :: CharSet+isUnicodeCf :: CharSet isUnicodeCf = [ ('\173','\173') , ('\1536','\1539')@@ -123,7 +123,7 @@ -- ------------------------------------------------------------ -isUnicodeCo :: CharSet+isUnicodeCo :: CharSet isUnicodeCo = [ ('\57344','\57344') , ('\63743','\63743')@@ -135,7 +135,7 @@ -- ------------------------------------------------------------ -isUnicodeCs :: CharSet+isUnicodeCs :: CharSet isUnicodeCs = [ ('\55296','\55296') , ('\56191','\56192')@@ -145,7 +145,7 @@ -- ------------------------------------------------------------ -isUnicodeL :: CharSet+isUnicodeL :: CharSet isUnicodeL = [ ('A','Z') , ('a','z')@@ -578,7 +578,7 @@ -- ------------------------------------------------------------ -isUnicodeLl :: CharSet+isUnicodeLl :: CharSet isUnicodeLl = [ ('a','z') , ('\170','\170')@@ -1183,7 +1183,7 @@ -- ------------------------------------------------------------ -isUnicodeLm :: CharSet+isUnicodeLm :: CharSet isUnicodeLm = [ ('\688','\705') , ('\710','\721')@@ -1238,7 +1238,7 @@ -- ------------------------------------------------------------ -isUnicodeLo :: CharSet+isUnicodeLo :: CharSet isUnicodeLo = [ ('\443','\443') , ('\448','\451')@@ -1560,7 +1560,7 @@ -- ------------------------------------------------------------ -isUnicodeLt :: CharSet+isUnicodeLt :: CharSet isUnicodeLt = [ ('\453','\453') , ('\456','\456')@@ -1576,7 +1576,7 @@ -- ------------------------------------------------------------ -isUnicodeLu :: CharSet+isUnicodeLu :: CharSet isUnicodeLu = [ ('A','Z') , ('\192','\214')@@ -2176,7 +2176,7 @@ -- ------------------------------------------------------------ -isUnicodeM :: CharSet+isUnicodeM :: CharSet isUnicodeM = [ ('\768','\879') , ('\1155','\1161')@@ -2370,7 +2370,7 @@ -- ------------------------------------------------------------ -isUnicodeMc :: CharSet+isUnicodeMc :: CharSet isUnicodeMc = [ ('\2307','\2307') , ('\2366','\2368')@@ -2482,7 +2482,7 @@ -- ------------------------------------------------------------ -isUnicodeMe :: CharSet+isUnicodeMe :: CharSet isUnicodeMe = [ ('\1160','\1161') , ('\1758','\1758')@@ -2493,7 +2493,7 @@ -- ------------------------------------------------------------ -isUnicodeMn :: CharSet+isUnicodeMn :: CharSet isUnicodeMn = [ ('\768','\879') , ('\1155','\1159')@@ -2693,7 +2693,7 @@ -- ------------------------------------------------------------ -isUnicodeN :: CharSet+isUnicodeN :: CharSet isUnicodeN = [ ('0','9') , ('\178','\179')@@ -2780,7 +2780,7 @@ -- ------------------------------------------------------------ -isUnicodeNd :: CharSet+isUnicodeNd :: CharSet isUnicodeNd = [ ('0','9') , ('\1632','\1641')@@ -2823,7 +2823,7 @@ -- ------------------------------------------------------------ -isUnicodeNl :: CharSet+isUnicodeNl :: CharSet isUnicodeNl = [ ('\5870','\5872') , ('\8544','\8578')@@ -2841,7 +2841,7 @@ -- ------------------------------------------------------------ -isUnicodeNo :: CharSet+isUnicodeNo :: CharSet isUnicodeNo = [ ('\178','\179') , ('\185','\185')@@ -2885,7 +2885,7 @@ -- ------------------------------------------------------------ -isUnicodeP :: CharSet+isUnicodeP :: CharSet isUnicodeP = [ ('!','#') , ('%','*')@@ -3020,7 +3020,7 @@ -- ------------------------------------------------------------ -isUnicodePc :: CharSet+isUnicodePc :: CharSet isUnicodePc = [ ('_','_') , ('\8255','\8256')@@ -3032,7 +3032,7 @@ -- ------------------------------------------------------------ -isUnicodePd :: CharSet+isUnicodePd :: CharSet isUnicodePd = [ ('-','-') , ('\1418','\1418')@@ -3053,7 +3053,7 @@ -- ------------------------------------------------------------ -isUnicodePe :: CharSet+isUnicodePe :: CharSet isUnicodePe = [ (')',')') , (']',']')@@ -3129,7 +3129,7 @@ -- ------------------------------------------------------------ -isUnicodePf :: CharSet+isUnicodePf :: CharSet isUnicodePf = [ ('\187','\187') , ('\8217','\8217')@@ -3145,7 +3145,7 @@ -- ------------------------------------------------------------ -isUnicodePi :: CharSet+isUnicodePi :: CharSet isUnicodePi = [ ('\171','\171') , ('\8216','\8216')@@ -3162,7 +3162,7 @@ -- ------------------------------------------------------------ -isUnicodePo :: CharSet+isUnicodePo :: CharSet isUnicodePo = [ ('!','#') , ('%','\'')@@ -3292,7 +3292,7 @@ -- ------------------------------------------------------------ -isUnicodePs :: CharSet+isUnicodePs :: CharSet isUnicodePs = [ ('(','(') , ('[','[')@@ -3370,7 +3370,7 @@ -- ------------------------------------------------------------ -isUnicodeS :: CharSet+isUnicodeS :: CharSet isUnicodeS = [ ('$','$') , ('+','+')@@ -3574,7 +3574,7 @@ -- ------------------------------------------------------------ -isUnicodeSc :: CharSet+isUnicodeSc :: CharSet isUnicodeSc = [ ('$','$') , ('\162','\165')@@ -3596,7 +3596,7 @@ -- ------------------------------------------------------------ -isUnicodeSk :: CharSet+isUnicodeSk :: CharSet isUnicodeSk = [ ('^','^') , ('`','`')@@ -3628,7 +3628,7 @@ -- ------------------------------------------------------------ -isUnicodeSm :: CharSet+isUnicodeSm :: CharSet isUnicodeSm = [ ('+','+') , ('<','>')@@ -3699,7 +3699,7 @@ -- ------------------------------------------------------------ -isUnicodeSo :: CharSet+isUnicodeSo :: CharSet isUnicodeSo = [ ('\166','\167') , ('\169','\169')@@ -3859,7 +3859,7 @@ -- ------------------------------------------------------------ -isUnicodeZ :: CharSet+isUnicodeZ :: CharSet isUnicodeZ = [ (' ',' ') , ('\160','\160')@@ -3874,21 +3874,21 @@ -- ------------------------------------------------------------ -isUnicodeZl :: CharSet+isUnicodeZl :: CharSet isUnicodeZl = [ ('\8232','\8232') ] -- ------------------------------------------------------------ -isUnicodeZp :: CharSet+isUnicodeZp :: CharSet isUnicodeZp = [ ('\8233','\8233') ] -- ------------------------------------------------------------ -isUnicodeZs :: CharSet+isUnicodeZs :: CharSet isUnicodeZs = [ (' ',' ') , ('\160','\160')
src/Text/Regex/XMLSchema/String/Unicode/GenBlocks.hs view
@@ -89,6 +89,6 @@ 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || '-' == c- + cmt :: String cmt = "-- " ++ replicate 60 '-'
src/Text/Regex/XMLSchema/String/XML/CharProps.hs view
@@ -41,7 +41,7 @@ -- | -- checking for valid XML characters -isXmlChar :: CharSet+isXmlChar :: CharSet isXmlChar = [ ('\x0009', '\x000A') , ('\x000D', '\x000D')@@ -53,7 +53,7 @@ -- | -- checking for XML space character: \\\n, \\\r, \\\t and \" \" -isXmlSpaceChar :: CharSet+isXmlSpaceChar :: CharSet isXmlSpaceChar = stringCS ['\x20', '\x09', '\x0D', '\x0A'] @@ -62,22 +62,22 @@ -- -- see also : 'isXmlSpaceChar' -isXml11SpaceChar :: CharSet+isXml11SpaceChar :: CharSet isXml11SpaceChar = stringCS ['\x20', '\x09', '\x0D', '\x0A', '\x85', '\x2028'] -- | -- checking for XML name character -isXmlNameChar :: CharSet+isXmlNameChar :: CharSet isXmlNameChar = isXmlLetter `unionCS` isXmlDigit `unionCS`- (singleCS '\x2D' `unionCS` singleCS '\x2E') -- '-' | '.'+ (singleCS '\x2D' `unionCS` singleCS '\x2E') -- '-' | '.' `unionCS`- (singleCS '\x3A' `unionCS` singleCS '\x5F') -- Letter | ':' | '_'+ (singleCS '\x3A' `unionCS` singleCS '\x5F') -- Letter | ':' | '_' `unionCS` isXmlCombiningChar `unionCS`@@ -88,20 +88,20 @@ -- -- see also : 'isXmlNameChar' -isXmlNameStartChar :: CharSet+isXmlNameStartChar :: CharSet isXmlNameStartChar = isXmlLetter `unionCS` singleCS '\x3A' `unionCS`- singleCS '\x5F' -- Letter | ':' | '_'+ singleCS '\x5F' -- Letter | ':' | '_' -- | -- checking for XML NCName character: no \":\" allowed -- -- see also : 'isXmlNameChar' -isXmlNCNameChar :: CharSet+isXmlNCNameChar :: CharSet isXmlNCNameChar = isXmlNameChar `diffCS`@@ -112,7 +112,7 @@ -- -- see also : 'isXmlNameChar', 'isXmlNCNameChar' -isXmlNCNameStartChar :: CharSet+isXmlNCNameStartChar :: CharSet isXmlNCNameStartChar = isXmlNameStartChar `diffCS`@@ -121,7 +121,7 @@ -- | -- checking for XML public id character -isXmlPubidChar :: CharSet+isXmlPubidChar :: CharSet isXmlPubidChar = rangeCS '0' '9' `unionCS`@@ -134,7 +134,7 @@ -- | -- checking for XML letter -isXmlLetter :: CharSet+isXmlLetter :: CharSet isXmlLetter = isXmlBaseChar `unionCS`@@ -143,7 +143,7 @@ -- | -- checking for XML base charater -isXmlBaseChar :: CharSet+isXmlBaseChar :: CharSet isXmlBaseChar = [ ('\x0041', '\x005A') , ('\x0061', '\x007A')@@ -351,7 +351,7 @@ -- | -- checking for XML ideographic charater -isXmlIdeographicChar :: CharSet+isXmlIdeographicChar :: CharSet isXmlIdeographicChar = [ ('\x3007', '\x3007') , ('\x3021', '\x3029')@@ -361,7 +361,7 @@ -- | -- checking for XML combining charater -isXmlCombiningChar :: CharSet+isXmlCombiningChar :: CharSet isXmlCombiningChar = [ ('\x0300', '\x0345') , ('\x0360', '\x0361')@@ -463,7 +463,7 @@ -- | -- checking for XML digit -isXmlDigit :: CharSet+isXmlDigit :: CharSet isXmlDigit = [ ('\x0030', '\x0039') , ('\x0660', '\x0669')@@ -485,7 +485,7 @@ -- | -- checking for XML extender -isXmlExtender :: CharSet+isXmlExtender :: CharSet isXmlExtender = [ ('\x00B7', '\x00B7') , ('\x02D0', '\x02D0')@@ -511,7 +511,7 @@ -- They are either control characters or permanently undefined Unicode characters: -isXmlControlOrPermanentlyUndefined :: CharSet+isXmlControlOrPermanentlyUndefined :: CharSet isXmlControlOrPermanentlyUndefined = [ ('\x7F', '\x84') , ('\x86', '\x9F')