Safe Haskell | None |
---|
A reader for hledger's journal file format (http://hledger.org/MANUAL.html#the-journal-file). hledger's journal format is a compatible subset of c++ ledger's (http://ledger-cli.org/3.0/doc/ledger3.html#Journal-Format), so this reader should handle many ledger files as well. Example:
2012/3/24 gift expenses:gifts $10 assets:cash
- reader :: Reader
- parseJournalWith :: GenParser Char JournalContext (JournalUpdate, JournalContext) -> FilePath -> String -> ErrorT String IO Journal
- getParentAccount :: GenParser tok JournalContext String
- journal :: GenParser Char JournalContext (JournalUpdate, JournalContext)
- directive :: GenParser Char JournalContext JournalUpdate
- defaultyeardirective :: GenParser Char JournalContext JournalUpdate
- historicalpricedirective :: GenParser Char JournalContext HistoricalPrice
- datetime :: GenParser Char JournalContext LocalTime
- accountname :: GenParser Char st AccountName
- amount :: GenParser Char JournalContext MixedAmount
- amount' :: String -> MixedAmount
- emptyline :: GenParser Char JournalContext ()
- tests_Hledger_Read_JournalReader :: Test
Reader
Parsers used elsewhere
parseJournalWith :: GenParser Char JournalContext (JournalUpdate, JournalContext) -> FilePath -> String -> ErrorT String IO JournalSource
Given a JournalUpdate-generating parsec parser, file path and data string, parse and post-process a Journal so that it's ready to use, or give an error.
journal :: GenParser Char JournalContext (JournalUpdate, JournalContext)Source
Top-level journal parser. Returns a single composite, I/O performing, error-raising JournalUpdate (and final JournalContext) which can be applied to an empty journal to get the final result.
datetime :: GenParser Char JournalContext LocalTimeSource
Parse a date and time in YYYYMMDD HH:MM[:SS][+-ZZZZ] format. Any timezone will be ignored; the time is treated as local time. Fewer digits are allowed, except in the timezone. The year may be omitted if a default year has already been set.
accountname :: GenParser Char st AccountNameSource
Parse an account name. Account names may have single spaces inside them, and are terminated by two or more spaces. They should have one or more components of at least one character, separated by the account separator char.
amount :: GenParser Char JournalContext MixedAmountSource
Parse an amount, optionally with a left or right currency symbol, price, and/or (ignored) ledger-style balance assertion.
amount' :: String -> MixedAmountSource
Run the amount parser on a string to get the result or an error.