mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 18:29:36 +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 JournalFieldName = String
|
||||||
type FieldTemplate = String
|
type FieldTemplate = String
|
||||||
type ConditionalBlock = ([RecordMatcher], [(JournalFieldName, FieldTemplate)]) -- block matches if all RecordMatchers match
|
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 RecordMatcher = [RegexpPattern] -- match if any regexps match any of the csv fields
|
||||||
-- type FieldMatcher = (CsvFieldName, [Regexp]) -- match if any regexps match this csv field
|
-- type FieldMatcher = (CsvFieldName, [RegexpPattern]) -- match if any regexps match this csv field
|
||||||
type DateFormat = String
|
type DateFormat = String
|
||||||
type Regexp = String
|
type RegexpPattern = String
|
||||||
|
|
||||||
rules = CsvRules {
|
rules = CsvRules {
|
||||||
rdirectives=[],
|
rdirectives=[],
|
||||||
@ -657,7 +657,7 @@ getEffectiveAssignment rules record f = lastMay $ assignmentsFor f
|
|||||||
-- matcherMatches pats = any patternMatches pats
|
-- matcherMatches pats = any patternMatches pats
|
||||||
matcherMatches pats = patternMatches $ "(" ++ intercalate "|" pats ++ ")"
|
matcherMatches pats = patternMatches $ "(" ++ intercalate "|" pats ++ ")"
|
||||||
where
|
where
|
||||||
patternMatches :: Regexp -> Bool
|
patternMatches :: RegexpPattern -> Bool
|
||||||
patternMatches pat = regexMatchesCI pat csvline
|
patternMatches pat = regexMatchesCI pat csvline
|
||||||
where
|
where
|
||||||
csvline = intercalate "," record
|
csvline = intercalate "," record
|
||||||
|
@ -22,9 +22,11 @@ Easy regular expression helpers, based on regex-tdfa and regexpr. These should
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
module Hledger.Utils.Regex (
|
module Hledger.Utils.Regex (
|
||||||
-- regexMatch
|
Regexp
|
||||||
|
,Replacement
|
||||||
|
-- ,regexMatch
|
||||||
-- ,regexMatchCI
|
-- ,regexMatchCI
|
||||||
regexMatches
|
,regexMatches
|
||||||
,regexMatchesCI
|
,regexMatchesCI
|
||||||
,containsRegex
|
,containsRegex
|
||||||
,regexReplace
|
,regexReplace
|
||||||
|
Loading…
Reference in New Issue
Block a user