drop regex-compat/regex-posix dependency
This commit is contained in:
parent
96fd2142aa
commit
e91560989c
@ -182,8 +182,7 @@ matchpats pats str =
|
||||
where
|
||||
(negatives,positives) = partition isnegativepat pats
|
||||
match "" = True
|
||||
match pat = matchregex (abspat pat) str
|
||||
match pat = containsRegex (abspat pat) str
|
||||
negateprefix = "not:"
|
||||
isnegativepat pat = negateprefix `isPrefixOf` 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 Ledger.Utils,
|
||||
module Text.Printf,
|
||||
module Text.Regex,
|
||||
module Text.RegexPR,
|
||||
module Test.HUnit,
|
||||
)
|
||||
where
|
||||
@ -39,7 +39,7 @@ import Debug.Trace
|
||||
import System.IO.UTF8
|
||||
import Test.HUnit
|
||||
import Text.Printf
|
||||
import Text.Regex
|
||||
import Text.RegexPR
|
||||
import Text.ParserCombinators.Parsec
|
||||
|
||||
|
||||
@ -147,10 +147,8 @@ difforzero a b = maximum [(a - b), 0]
|
||||
|
||||
-- regexps
|
||||
|
||||
instance Show Regex where show r = "a Regex"
|
||||
|
||||
containsRegex :: Regex -> String -> Bool
|
||||
containsRegex r s = case matchRegex r s of
|
||||
containsRegex :: String -> String -> Bool
|
||||
containsRegex r s = case matchRegexPR ("(?i)"++r) s of
|
||||
Just _ -> True
|
||||
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
|
||||
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
|
||||
showforest :: Show a => Forest a -> String
|
||||
|
||||
@ -9,7 +9,6 @@ import System
|
||||
import System.Console.GetOpt
|
||||
import System.Environment
|
||||
import Text.Printf
|
||||
import Text.RegexPR (gsubRegexPRBy)
|
||||
import Data.Char (toLower)
|
||||
import Ledger.IO (IOArgs,
|
||||
ledgerenvvar,myLedgerPath,
|
||||
|
||||
@ -109,7 +109,6 @@ executable hledger
|
||||
,mtl
|
||||
,parsec
|
||||
,process
|
||||
,regex-compat
|
||||
,regexpr >= 0.5.1
|
||||
,split
|
||||
,testpack
|
||||
|
||||
Loading…
Reference in New Issue
Block a user