wcwidth 0.0.1 → 0.0.2
raw patch · 3 files changed
+39/−19 lines, 3 filesdep +attoparsecdep −bytestringparser-temporarydep ~base
Dependencies added: attoparsec
Dependencies removed: bytestringparser-temporary
Dependency ranges changed: base
Files
- CompileRanges.hs +12/−9
- WCWidthTableaux.hs +1/−3
- wcwidth.cabal +26/−7
CompileRanges.hs view
@@ -1,18 +1,21 @@ #!/usr/bin/env runhaskell+{-# LANGUAGE OverloadedStrings+ #-} module CompileRanges where -import Prelude hiding (lines, unlines)+import Prelude hiding (concat, lines, unlines, takeWhile) import Data.List (foldl')-import Data.Char+import Data.Char hiding (isDigit) import Data.Maybe import Data.Either import Control.Applicative hiding (empty) import System.IO (stdin, stdout, stderr)-import Data.ByteString.Lazy.Char8 hiding (count, foldl', reverse)+import Data.ByteString.Char8 hiding (takeWhile, count, foldl', reverse) -import Data.ParserCombinators.Attoparsec.Char8+import Data.Attoparsec (parseOnly)+import Data.Attoparsec.Char8 @@ -27,7 +30,7 @@ (sequence_ . (hPut o . compile <$>) . collate) ranges hPut o postamble where- parse' = (snd . parse range <$>)+ parse' = (parseOnly range <$>) display ((a,z),w) = a `append` pack ".." `append` z `snoc` '\n' compile ((a,z),w) = guard `append` eq `append` w `snoc` '\n' where@@ -59,17 +62,17 @@ short_hex :: Parser ByteString short_hex = do- ox <- match (string "0x")+ ox <- string "0x" count 4 (char '0')- append ox <$> match (count 4 (satisfy isHexDigit))+ append ox . pack <$> count 4 (satisfy isHexDigit) little_int :: Parser ByteString little_int = do sign <- maybe empty id <$> optional minus- digits <- match (satisfy isDigit)+ digits <- takeWhile isDigit return (append sign digits) where- minus = match (char '-')+ minus = string "-"
WCWidthTableaux.hs view
@@ -1,6 +1,4 @@ #!/usr/bin/env runhaskell-- {-# LANGUAGE StandaloneDeriving #-} @@ -49,7 +47,7 @@ hPutStrLn stderr usage' exitFailure where- rolling_print f = sequence_ . fmap (UTF8.putStrLn . f)+ rolling_print f = sequence_ . fmap (putStrLn . f) range_entry ((a,b),w) = printf fmt a' b' w count s where count = 1 + fromEnum b - fromEnum a
wcwidth.cabal view
@@ -1,10 +1,10 @@ name : wcwidth-version : 0.0.1+version : 0.0.2 category : Text license : BSD3 license-file : LICENSE author : Jason Dusek-maintainer : wcwidth@solidsnack.be +maintainer : oss@solidsnack.be homepage : http://github.com/solidsnack/wcwidth/ synopsis : Native wcwidth. description :@@ -18,23 +18,42 @@ extra-source-files : CompileRanges.hs +flag split-base++flag cli+ description : Enable command line tool.+ default : False++ library- build-depends : base >= 2 && < 4- , containers+ if flag(split-base)+ build-depends : base >= 4 && < 5+ else+ build-depends : base < 4+ build-depends : containers exposed-modules : Data.Char.WCWidth extensions : StandaloneDeriving ForeignFunctionInterface+ OverloadedStrings executable wcwidth-tools main-is : WCWidthTableaux.hs- build-depends : base >= 2 && < 4- , containers+ if flag(cli)+ buildable : True+ else+ buildable : False+ if flag(split-base)+ build-depends : base >= 4 && < 5+ else+ build-depends : base < 4+ build-depends : containers , bytestring , setlocale >= 0.0.3 , utf8-string >= 0.3- , bytestringparser-temporary >= 0.4.1+ , attoparsec >= 0.8.5 extensions : StandaloneDeriving ForeignFunctionInterface+ OverloadedStrings