mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-27 04:13:11 +03:00
export Regexp types, disambiguate CsvReader's
This commit is contained in:
parent
f064ecf138
commit
bfedf367c4
@ -286,10 +286,10 @@ type CsvFieldIndex = Int
|
||||
type JournalFieldName = String
|
||||
type FieldTemplate = String
|
||||
type ConditionalBlock = ([RecordMatcher], [(JournalFieldName, FieldTemplate)]) -- block matches if all RecordMatchers match
|
||||
type RecordMatcher = [Regexp] -- match if any regexps match any of the csv fields
|
||||
-- type FieldMatcher = (CsvFieldName, [Regexp]) -- match if any regexps match this csv field
|
||||
type RecordMatcher = [RegexpPattern] -- match if any regexps match any of the csv fields
|
||||
-- type FieldMatcher = (CsvFieldName, [RegexpPattern]) -- match if any regexps match this csv field
|
||||
type DateFormat = String
|
||||
type Regexp = String
|
||||
type RegexpPattern = String
|
||||
|
||||
rules = CsvRules {
|
||||
rdirectives=[],
|
||||
@ -657,7 +657,7 @@ getEffectiveAssignment rules record f = lastMay $ assignmentsFor f
|
||||
-- matcherMatches pats = any patternMatches pats
|
||||
matcherMatches pats = patternMatches $ "(" ++ intercalate "|" pats ++ ")"
|
||||
where
|
||||
patternMatches :: Regexp -> Bool
|
||||
patternMatches :: RegexpPattern -> Bool
|
||||
patternMatches pat = regexMatchesCI pat csvline
|
||||
where
|
||||
csvline = intercalate "," record
|
||||
|
@ -22,9 +22,11 @@ Easy regular expression helpers, based on regex-tdfa and regexpr. These should
|
||||
-}
|
||||
|
||||
module Hledger.Utils.Regex (
|
||||
-- regexMatch
|
||||
Regexp
|
||||
,Replacement
|
||||
-- ,regexMatch
|
||||
-- ,regexMatchCI
|
||||
regexMatches
|
||||
,regexMatches
|
||||
,regexMatchesCI
|
||||
,containsRegex
|
||||
,regexReplace
|
||||
|
Loading…
Reference in New Issue
Block a user