packages feed

regex-genex 0.5.0 → 0.5.1

raw patch · 2 files changed

+13/−3 lines, 2 files

Files

Main.hs view
@@ -2,6 +2,7 @@ import Regex.Genex import System.IO import System.Environment+import Data.Char (isDigit)  defaultRegex :: String defaultRegex = "a(b|c)d{2,3}e*"@@ -15,7 +16,16 @@             prog <- getProgName             if prog == "<interactive>" then run defaultRegex else do                 fail $ "Usage: " ++ prog ++ " regex [regex...]"-        rx -> genexPrint rx+        rx | all isPure rx -> mapM_ ((putStr "0 " >>) . print) (genexPure rx)+           | otherwise     -> genexPrint rx+    where+    isPure [] = True+    isPure ('\\':'\\':cs) = isPure cs+    isPure ('\\':'b':_) = False+    isPure ('\\':c:cs)+        | isDigit c = False+        | otherwise = isPure cs+    isPure (_:cs) = isPure cs  run :: String -> IO () run regex = genexPrint [regex]
regex-genex.cabal view
@@ -1,9 +1,9 @@ Name            : regex-genex-Version         : 0.5.0+Version         : 0.5.1 license         : OtherLicense license-file    : LICENSE cabal-version   : >= 1.6-copyright       : 2011 Audrey Tang+copyright       : 2011-2012 Audrey Tang maintainer      : Audrey Tang <audreyt@audreyt.org> category        : Text, Regex stability       : experimental