drop regex-compat/regex-posix dependency
This commit is contained in:
parent
96fd2142aa
commit
e91560989c
@ -182,8 +182,7 @@ matchpats pats str =
|
|||||||
where
|
where
|
||||||
(negatives,positives) = partition isnegativepat pats
|
(negatives,positives) = partition isnegativepat pats
|
||||||
match "" = True
|
match "" = True
|
||||||
match pat = matchregex (abspat pat) str
|
match pat = containsRegex (abspat pat) str
|
||||||
negateprefix = "not:"
|
negateprefix = "not:"
|
||||||
isnegativepat pat = negateprefix `isPrefixOf` pat
|
isnegativepat pat = negateprefix `isPrefixOf` pat
|
||||||
abspat pat = if isnegativepat pat then drop (length negateprefix) pat else pat
|
abspat pat = if isnegativepat pat then drop (length negateprefix) pat else pat
|
||||||
matchregex pat str = null pat || containsRegex (mkRegexWithOpts pat True False) str
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ module Data.Time.LocalTime,
|
|||||||
module Debug.Trace,
|
module Debug.Trace,
|
||||||
module Ledger.Utils,
|
module Ledger.Utils,
|
||||||
module Text.Printf,
|
module Text.Printf,
|
||||||
module Text.Regex,
|
module Text.RegexPR,
|
||||||
module Test.HUnit,
|
module Test.HUnit,
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
@ -39,7 +39,7 @@ import Debug.Trace
|
|||||||
import System.IO.UTF8
|
import System.IO.UTF8
|
||||||
import Test.HUnit
|
import Test.HUnit
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
import Text.Regex
|
import Text.RegexPR
|
||||||
import Text.ParserCombinators.Parsec
|
import Text.ParserCombinators.Parsec
|
||||||
|
|
||||||
|
|
||||||
@ -147,10 +147,8 @@ difforzero a b = maximum [(a - b), 0]
|
|||||||
|
|
||||||
-- regexps
|
-- regexps
|
||||||
|
|
||||||
instance Show Regex where show r = "a Regex"
|
containsRegex :: String -> String -> Bool
|
||||||
|
containsRegex r s = case matchRegexPR ("(?i)"++r) s of
|
||||||
containsRegex :: Regex -> String -> Bool
|
|
||||||
containsRegex r s = case matchRegex r s of
|
|
||||||
Just _ -> True
|
Just _ -> True
|
||||||
otherwise -> False
|
otherwise -> False
|
||||||
|
|
||||||
@ -215,7 +213,7 @@ treeany f t = (f $ root t) || (any (treeany f) $ branches t)
|
|||||||
|
|
||||||
-- | show a compact ascii representation of a tree
|
-- | show a compact ascii representation of a tree
|
||||||
showtree :: Show a => Tree a -> String
|
showtree :: Show a => Tree a -> String
|
||||||
showtree = unlines . filter (containsRegex (mkRegex "[^ |]")) . lines . drawTree . treemap show
|
showtree = unlines . filter (containsRegex "[^ |]") . lines . drawTree . treemap show
|
||||||
|
|
||||||
-- | show a compact ascii representation of a forest
|
-- | show a compact ascii representation of a forest
|
||||||
showforest :: Show a => Forest a -> String
|
showforest :: Show a => Forest a -> String
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import System
|
|||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
import Text.RegexPR (gsubRegexPRBy)
|
|
||||||
import Data.Char (toLower)
|
import Data.Char (toLower)
|
||||||
import Ledger.IO (IOArgs,
|
import Ledger.IO (IOArgs,
|
||||||
ledgerenvvar,myLedgerPath,
|
ledgerenvvar,myLedgerPath,
|
||||||
|
|||||||
@ -109,7 +109,6 @@ executable hledger
|
|||||||
,mtl
|
,mtl
|
||||||
,parsec
|
,parsec
|
||||||
,process
|
,process
|
||||||
,regex-compat
|
|
||||||
,regexpr >= 0.5.1
|
,regexpr >= 0.5.1
|
||||||
,split
|
,split
|
||||||
,testpack
|
,testpack
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user