More generic matching, done in one step, unlike FilterSpec and filterJournal*. Currently used only by hledger-web.
- data Matcher
- data QueryOpt
- inAccount :: [QueryOpt] -> Maybe (AccountName, Bool)
- inAccountMatcher :: [QueryOpt] -> Maybe Matcher
- parseQuery :: Day -> String -> (Matcher, [QueryOpt])
- words'' :: [String] -> String -> [String]
- parseMatcher :: Day -> String -> Either Matcher QueryOpt
- parseStatus :: String -> Bool
- parseBool :: String -> Bool
- truestrings :: [String]
- negateMatcher :: Matcher -> Matcher
- matchesPosting :: Matcher -> Posting -> Bool
- matchesTransaction :: Matcher -> Transaction -> Bool
- postingEffectiveDate :: Posting -> Maybe Day
- transactionEffectiveDate :: Transaction -> Day
- matchesAccount :: Matcher -> AccountName -> Bool
- matcherStartDate :: Bool -> Matcher -> Maybe Day
- matcherIsStartDateOnly :: Bool -> Matcher -> Bool
- earliestMaybeDate :: [Maybe Day] -> Maybe Day
- latestMaybeDate :: [Maybe Day] -> Maybe Day
- compareMaybeDates :: Maybe Day -> Maybe Day -> Ordering
- tests_Hledger_Data_Matching :: Test
A matcher is a single, or boolean composition of, search criteria, which can be used to match postings, transactions, accounts and more. Currently used by hledger-web, will likely replace FilterSpec at some point.
negate this match
match if any of these match
match if all of these match
match if description matches this regexp
match postings whose account matches this regexp
match if actual date in this date span
match if effective date in this date span
match if cleared status has this value
match if realness (involves a real non-virtual account ?) has this value
match if emptiness (from the --empty command-line flag) has this value. Currently this means a posting with zero amount.
match if account depth is less than or equal to this value
A query option changes a query's/report's behaviour and output in some way.
show an account register focussed on this account
as above but include sub-accounts in the account register | QueryOptCostBasis -- ^ show amounts converted to cost where possible | QueryOptEffectiveDate -- ^ show effective dates instead of actual dates
The account we are currently focussed on, if any, and whether subaccounts are included. Just looks at the first query option.
A matcher for the account(s) we are currently focussed on, if any. Just looks at the first query option.
Convert a query expression containing zero or more space-separated terms to a matcher and zero or more query options. A query term is either:
- a search criteria, used to match transactions. This is usually a prefixed pattern such as: acct:REGEXP date:PERIODEXP not:desc:REGEXP
- a query option, which changes behaviour in some way. There is currently one of these: inacct:FULLACCTNAME - should appear only once
Multiple search criteria are AND'ed together. When a pattern contains spaces, it or the whole term should be enclosed in single or double quotes. A reference date is required to interpret relative dates in period expressions.
Quote-and-prefix-aware version of words - don't split on spaces which are inside quotes, including quotes which may have one of the specified prefixes in front, and maybe an additional not: prefix in front of that.
Parse a single query term as either a matcher or a query option.
Does the match expression match this transaction ?
Does the match expression match this account ? A matching in: clause is also considered a match.
What start date does this matcher specify, if any ? If the matcher is an OR expression, returns the earliest of the alternatives. When the flag is true, look for a starting effective date instead.
Does this matcher specify a start date and nothing else (that would filter postings prior to the date) ? When the flag is true, look for a starting effective date instead.
Does this matcher match everything ?
What is the earliest of these dates, where Nothing is earliest ?
What is the latest of these dates, where Nothing is earliest ?
Compare two maybe dates, Nothing is earliest.