Commit Graph

74 Commits

Author SHA1 Message Date
Simon Michael
581d02162c resolve all current build warnings with the supported GHC versions
If I'm lucky.
2018-05-17 20:43:55 -07:00
Alex Chen
67ed2d6cbf lib: superficial changes to comment parsers 2018-05-17 18:15:06 -07:00
Alex Chen
188583e232 lib: cleanup: remove redundant comment parsing alternatives 2018-05-17 18:15:06 -07:00
Alex Chen
892a1c6434 lib: refactor: make the bracketed date tags parser a SimpleTextParser 2018-05-17 18:15:06 -07:00
Alex Chen
0cff1634be lib: refactor: make the bracketed datetags parser a SimpleTextParser in all but type 2018-05-17 18:15:06 -07:00
Alex Chen
b3a91a49d8 lib: refactor: factor out a TextParser from datep 2018-05-17 18:15:06 -07:00
Alex Chen
09fd8132b7 lib: refactor: weaken types of comment parsers 2018-05-17 18:15:06 -07:00
Alex Chen
31b72f0415 lib: replace notChar for backwards compatibility with megaparsec 5 2018-05-16 22:35:22 -07:00
Alex Chen
99e457f1da lib: fix performance regression introduced in 30ae9914 2018-05-15 19:29:59 -07:00
Alex Chen
12ddcb1784 lib: extend export list of Read/Common.hs 2018-05-15 11:52:29 -07:00
Alex Chen
17b11aaf1e lib: refactor parsing of bracketed posting dates 2018-05-15 11:52:29 -07:00
Alex Chen
fcc10f018d lib: merge parsing of date-tags with that of tags 2018-05-15 11:52:29 -07:00
Alex Chen
ec85271a0b lib: refactor tags parser: be more efficient, save SourcePos for later 2018-05-15 11:52:29 -07:00
Mykola Orliuk
64c7eb78f4 GHC 8.0 compatibility 2018-05-13 14:41:08 -07:00
Stephen Morgan
5bc5bb5533 Fix doctest error introduced by 49c8c093ac. 2018-05-11 07:25:17 -07:00
Simon Michael
7040289d54 add some exports to fix warnings (#762) 2018-05-11 07:17:38 -07:00
Alex Chen
3aa72bdf16 lib: Clean up new code introduced for #655 2018-05-11 06:41:13 -07:00
Alex Chen
30ae991484 lib: Strip comment before parsing tags (#655) 2018-05-11 06:41:13 -07:00
Alex Chen
09ec6041bd lib: Report source positions from internal comment parsers 2018-05-11 06:41:13 -07:00
Alex Chen
b06d22a418 lib: Refactor common comment parsers 2018-05-11 06:41:13 -07:00
Alex Chen
c2199b1125 lib: Add explicit export list to Common.hs 2018-05-11 06:41:13 -07:00
Simon Michael
49c8c093ac lib: clarify rawnumberp doc
[ci skip]
2018-05-09 10:22:39 -07:00
Simon Michael
3f2827424c refactor: number parsing docs 2018-04-20 21:39:06 -07:00
Dmitry Astapov
ecf49b1e4b lib: auto postings generated before amount inference and balance checks (#729) 2018-04-17 14:33:32 -07:00
Simon Michael
4ff3a749c6 lib: note an oddity with runJournalParser 2018-03-31 02:44:31 +01:00
Mykola Orliuk
b377bff90a lib: support scientific number notation (#704, #706)
closes simonmichael/hledger#704
2018-03-31 01:49:46 +01:00
Moritz Kiefer
d7b68fbd7d Use skipMany/skipSome for parsing spacenonewline
This avoids allocating the list of space characters only to then
discard it.
2018-03-25 22:59:05 +01:00
Simon Michael
84579bb1b4 silence redundant import warnings with ghc 8.4 2018-03-24 22:51:56 +00:00
Simon Michael
d420a8b534 journal: account directive: parse and store a numeric account code also 2018-01-23 11:33:23 -08:00
Mykola Orliuk
47766ea9d4 journal: support space as digits sep
Resolves simonmichael/hledger#330
2017-11-29 17:20:18 +01:00
Mykola Orliuk
e58272f28f journal: use groups sep and prec for decimal hint
Use whole AmountStyle in process of resolving decimal/groups separator
ambiguity.

Resolve simonmichael/hledger#399
2017-11-27 15:47:56 -08:00
Mykola Orliuk
7cbdeb40a4 journal: get decimal hint from default commodity
If appropriate commodity directive is missing fallback to default
commodity directive to get number representation style.
2017-11-27 15:47:56 -08:00
Mykola Orliuk
b7dbe044b0 journal: use decimal sep hint for amount parser
Make use of commodity format directive as a hint for parsing amount.

Kinda resolves simonmichael/hledger#487
2017-11-27 15:47:56 -08:00
Mykola Orliuk
dafdaec1ca journal: factor out rawnumberp 2017-11-27 15:47:56 -08:00
Mykola Orliuk
bcf7a1add5 journal: make numbers parsing more strict
- Hunt down adjacent punctuations with altering char.
- Add some tests dedicated to parsing amounts.
2017-11-27 15:47:56 -08:00
Simon Michael
4ab71f0d0a journal: clarify that txn/posting comments must start with semicolon 2017-11-01 08:04:25 -07:00
jeevcat
3a9ea65b99 Rewrite of BalanceAssertion type to track its source position.
Fixes #481.
2017-10-16 13:25:03 -07:00
Simon Michael
7edacdf443 cli: import command! hledger import *.csv adds new txns to main file 2017-09-17 18:57:51 -07:00
Simon Michael
669fa706c0 print: --new shows only transactions added since last time
First cut, error messages could be refined etc.
2017-09-15 09:55:17 -07:00
Simon Michael
e3c4a76119 add & use simpler readJournalFilesWithOpts/InputOpts api 2017-09-14 17:43:32 -07:00
Simon Michael
d7d5f8a064 add support for megaparsec 6 (fixes #594)
Older megaparsec is still supported.
Also cleans up our custom parser types,
and some text (un)packing is done in different places
(possible performance impact).
2017-07-27 19:20:46 -07:00
Simon Michael
dcc58d4a2b lib: rename ClearedStatus type to Status
(and fix hard-coded enum count)
2017-06-15 19:16:39 -07:00
Simon Michael
e119941648 rename "uncleared" status to "unmarked" and --uncleared to --unmarked (#564)
See the issue and linked mail list discussion. Ambiguity between the
uncleared state, and the "not cleared" --uncleared flag causes confusion
and friction. At this point it seems best to break with Ledger and
past hledger, pick a new name and drop --uncleared to put an end to it.
2017-06-15 19:16:39 -07:00
Christian G. Warden
d39040c634 Add Support for Rewriting Multipler Postings Into Different Commodities (#557)
When generating a new posting as a multiple of an existing posting,
support conversion to a different commodity.  For example, postings in
hours can be used to generate postings in USD.

Automatic transactions generated from rewrite rules use the commodity,
amount style, and transaction price if the rewrite defines a commodity.
2017-05-30 07:30:15 -07:00
Mykola Orliuk
7437c96ff6 Make hledger-rewrite tool suitable for re-factoring original journals (#490)
* cli: fix bug in pivot for postings without tag

Without this fix for postings without tag query checked effective
account which is always empty text ("").

* rewrite: inherit dates, change application order

For budgeting it is important to inherit actual date of posting if it
differs from date of transaction. These dates will be added
as a separate line of comment.

More natural order of rewrites is when result of first defined one is
available for all next rewrites.

* rewrite: factor out Hledger.Data.AutoTransaction

* rewrite: add diff output

With this option you can modify your original files without loosing
inter-transaction comments etc. I.e. you can run:

hledger-rewrite --diff Agency \
  --add-posting 'Expenses:Taxes  *0.17' \
  | patch

As result multiple files should be updated.
Also it is nice to review your changes using colordiff instead of
patch.

* lib: track source lines range for journal

* doc: auto entries and diff output for rewrite
2017-01-20 07:33:24 -08:00
Johannes Gerer
45401e538e Balance Assignments and accounts resetting (#438)
* Changed behavior of `readJournalFiles` to be identical to `readJournalFile` for singleton lists

* Balance Assertions have to be simple Amounts

* Add 'isAssignment' and 'assignmentPostings' to Hledger.Data.Posting and Transaction

* Implemented 'balanceTransactionUpdate', a more general version of 'balanceTransaction' that takes an update function

* Fixed test cases.

* Implemented balance assignment ("resetting a balance")

* Add assertions to show function

* updated the comments

* numbering is not needed in journalCheckBalanceAssertions

* remove prices before balance checks

* rename functions
2016-12-10 07:04:48 -08:00
Johannes Gerer
74502f7e50 more general parser types enabling reuse outside of IO (#439) 2016-12-09 15:57:17 -08:00
Simon Michael
c8650e0d10 comment 2016-11-12 13:54:48 -08:00
Simon Michael
9396bc6711 lib: fix ghc 8 warnings in Read.Common 2016-09-05 14:31:56 -07:00
Simon Michael
72c39470d6 lib: non-journal formats now produce transaction ids #394
Transactions are now numbered consistently during journal finalisation,
rather than just in the journal reader. Also transaction knot-tying has been
moved out of journalBalanceTransactions.
2016-08-14 12:44:19 -07:00