Commit Graph

271 Commits

Author SHA1 Message Date
Simon Michael
0c3148ac7b add an --ignore-assertions flag
Can be helpful when reading Ledger files, where assertions may have
different semantics; or for getting some answers from your journal
to help you fix your assertions.

Could be called --no-assertions, but this might create surprise when it
has an effect contrary to --no-new-accounts.

I had to add another flag throughout the parsers & journal read
functions, ok for now.
2014-07-01 18:26:37 -07:00
Simon Michael
cf3d21afef csv and general reader fixes, cleanups
- The CSV reader no longer writes a "(stdin).rules" file when reading
  from stdin.

- Selection of reader(s) is now smarter when input is coming from stdin.
  Previously, all readers were considered applicable for stdin.  This
  meant that when reading a CSV file from stdin, the journal and timelog
  readers were always tried first, and if the CSV file was unparseable,
  you'd see the first (journal) reader's error instead of the CSV
  reader's.  Now, the readers do some basic content sniffing when
  reading stdin, so it generally tries only the one right reader and
  we'll see the right errors.

- The read system now has more debug output.
2014-05-09 17:55:32 -07:00
Simon Michael
70ad5b26ff journal: really don't parse + before an amount as part of the commodity (fixes #181 harder) 2014-04-30 11:28:47 -07:00
Simon Michael
8341b4a8d3 journal: don't parse + before an amount as part of the commodity (fixes #181) 2014-04-30 11:21:01 -07:00
Simon Michael
da0ce23144 don't let default commodity limit the max precision (fixes #169) 2014-03-26 17:25:59 -07:00
Simon Michael
4b4715ab76 parsing: don't accept . as a valid amount 2014-03-01 10:26:20 -08:00
Simon Michael
762a1b4d74 parsing: comments can also start with # in col 0 2014-02-27 11:47:36 -08:00
Simon Michael
5223bc5c41 lib: rename and expose more journal file parsers 2014-02-05 18:55:38 -08:00
Simon Michael
dc8b687056 extra: hledger-rewrite script 2014-02-05 13:03:06 -08:00
Simon Michael
f9656a21af print: comment positions (same line or next line) are now preserved 2013-09-10 10:32:49 -07:00
Simon Michael
56a37aabcf small cleanup 2013-05-30 15:17:21 -07:00
Simon Michael
0be986fcb9 parsing: actually parse balance assertions
Parser unit test is commented out until HTF tests are fixed.
2013-05-28 16:22:30 -07:00
Simon Michael
af5c0e80e0 parsing: read files in universal newline mode
Line endings other than the unix style, are now accepted in journal and rules files.
2013-03-29 18:46:10 +00:00
Simon Michael
7b6a59123d eolof parser matches end of line or end of file 2013-03-29 18:42:00 +00:00
Simon Michael
69f2491224 export journal file code parser 2013-02-24 21:07:54 +00:00
Simon Michael
621a91807e rename actual/effective dates to primary/secondary
The command-line flag is now --date2. Alternate spellings --effective and --aux-date
are accepted for compatibility.
2012-12-06 04:43:41 +00:00
Simon Michael
869ff2528a accept normal simple date syntax in posting dates, give an error on bad date syntax here 2012-12-06 03:23:56 +00:00
Simon Michael
20e68f23a8 support effective dates on postings as well
We now preserve all dates while reporting, instead of overwriting one with the other.
2012-12-06 02:41:37 +00:00
Simon Michael
e75abc4625 parse posting dates, better comment/tag handling, begin using HTF for unit testing 2012-12-06 00:28:23 +00:00
Joachim Breitner
f0372bdd93 Also parse ! as a modifier, like * 2012-12-03 21:38:05 +00:00
Simon Michael
1c6a7d8a6f rename the commodityless amount constructor to num 2012-11-20 02:22:20 +00:00
Simon Michael
45d4a38cc7 refactor: setAmountPrecision -> withPrecision 2012-11-19 23:24:04 +00:00
Simon Michael
64180b18ef refactor: clarify that price amounts have only a single commodity 2012-11-19 23:17:55 +00:00
Simon Michael
8c06553e3b refactor: make amount price a non-maybe, reducing noise 2012-11-19 22:39:08 +00:00
Simon Michael
4567e91409 refactor: move amount display settings out of commodity, simplify amount construction 2012-11-19 21:20:10 +00:00
Simon Michael
1c1058be4e 70: ignore ledger's fixed lot price declarations 2012-11-17 02:40:27 +00:00
Simon Michael
28baf926f7 parsing: ignore ledger-style balance assertions ("= BAL" after a posting's amount) 2012-11-02 16:50:36 +00:00
Simon Michael
5b9c5459be web: make hledger[-lib] compatible with all of yesod's language extensions
Useful when building all of hledger-web at once.
2012-11-14 17:25:02 +00:00
Simon Michael
0b96a767b4 support tilde (~) in journal and rules file paths 2012-05-30 08:36:01 +00:00
Simon Michael
34318906d8 register, print: fix reverse ordering of same-day transactions 2012-06-29 18:06:58 +00:00
Simon Michael
33b7c91e20 combine journal updates with foldl' instead of foldr
on general principles, even though it makes no measurable difference
2012-05-30 10:19:08 +00:00
Simon Michael
9a239789fa apply journal updates in the order they were parsed, not the reverse (!)
Fixes the order of include files in stats command.
2012-05-30 10:16:37 +00:00
Simon Michael
50068221c3 fix build warnings in all GHC versions 2012-03-29 21:19:35 +00:00
Simon Michael
b77ba66fb1 haddock fix 2012-05-15 01:51:14 +00:00
Simon Michael
9524e6d927 more metadata -> tag renaming in the parser 2012-05-28 00:24:49 +00:00
Simon Michael
1062e2f9a4 clean up reader selection, don't write a csv rules file on journal parse error 2012-05-28 18:40:36 +00:00
Simon Michael
cb905a741c new query by tag implementation 2012-05-28 00:27:55 +00:00
Simon Michael
2fb2aea056 rename metadata fields to tags 2012-05-27 22:59:06 +00:00
Simon Michael
3ee6a351f3 big query/tests/show refactoring
- use new query system for command line too, filterspec is no more
- move unit tests near the code they test, run them in bottom up order, add more
- more precise Show instances, used for debugging not ui
2012-05-27 18:14:20 +00:00
Simon Michael
56cf9b21cb fix txn & posting comment parsing & printing; better unit tests 2012-05-15 01:49:05 +00:00
Simon Michael
a58a5f96ad more robust comments & metadata, on postings too, and document as "tags" 2012-05-14 18:52:22 +00:00
Simon Michael
88212f26e8 simplify journal parser names 2012-05-09 15:34:05 +00:00
xiaoruoruo
ce83876700 metadata parse and show for transaction 2012-04-08 19:13:56 +00:00
Simon Michael
8492f6cae4 fix unicode handling on GHC >= 7.2, unify utf8 IO compatibility layer
tests pass again from GHC 6.12.3 to 7.4.1
2012-03-29 19:06:31 +00:00
Simon Michael
d4451ce5e3 read system cleanup, require conversion rules from a file to simplify API 2012-03-24 18:08:11 +00:00
Simon Michael
e396c0dc8d push csv rule and format string types down 2012-03-24 01:58:34 +00:00
Simon Michael
381ebea35c show correct line number for posting parse errors (#67) 2011-10-04 23:39:53 +00:00
Simon Michael
8d62452260 parsing: historical price directives may contain a numeric time zone, like ledger; note that the time is ignored 2011-06-01 01:50:04 +00:00
Simon Michael
946e5ffcbc parsing: parse time of day more carefully 2011-05-31 22:45:54 +00:00
Simon Michael
1f24e025da parsing: make bad date parse error more reliable 2011-05-31 19:49:37 +00:00
Simon Michael
a44aa8d7d2 refactor: remove unnecessary LANGUAGE CPP pragmas 2011-07-17 23:29:57 +00:00
Simon Michael
957c349780 --alias command-line option 2011-08-05 00:05:39 +00:00
Simon Michael
30b7448f45 parsing: alias/end aliases directives, like ledger's but a bit more powerful 2011-08-04 08:45:18 +00:00
Simon Michael
4015e02097 account directive should preserve virtual/balanced virtual posting type 2011-08-02 23:29:13 +00:00
Simon Michael
345c2343b6 refactor ledgerDirective 2011-08-04 07:49:10 +00:00
Johann Klähn
8e7d20e4d5 parsing: support pop as well as end tag 2011-05-31 17:41:12 +00:00
Simon Michael
75f0886ad4 parsing: make the leading ! in directives optional, like ledger 2011-08-02 23:28:53 +00:00
Simon Michael
5084280879 imports, api cleanup 2011-05-28 04:11:44 +00:00
Simon Michael
8980dd9336 parser cleanup 2011-01-19 23:27:44 +00:00
Simon Michael
6a845eb5e4 i18n: always read and write UTF-8, ignoring current locale (#34)
Also remove a bunch of CPP conditions.
Uses the GHC-version-independent UTF-8 layer from pandoc.
2011-01-21 01:24:51 +00:00
Simon Michael
1c7ad7f421 parsing: more careful validation of eg leap years in transaction dates (only) 2011-04-22 13:55:42 +00:00
Simon Michael
d3663b818e parsing: better international number format support (#32)
This allows period and comma to be used for decimal point and digit group
separator or vice versa, and also flexible digit groups.  See
http://en.wikipedia.org/wiki/Decimal_separator .  Digit group separators
are possibly not worth the trouble and might not stay.
2011-01-19 12:32:18 +00:00
Simon Michael
dd9e78a67a reorganize tests 2010-12-27 20:26:22 +00:00
Simon Michael
e03ada3bd3 parsing: support @@ syntax specifying total price 2011-01-15 02:04:53 +00:00
Simon Michael
631215d5d7 parsing: accept (but ignore) c++ ledger's C commodity conversion directive 2010-11-12 23:55:40 +00:00
Simon Michael
d7617fe154 parsing: ignore cleared flags at the start of postings, parse account name correctly 2010-11-13 20:20:04 +00:00
Simon Michael
811e71aba7 price precisions don't influence display precision; balancing is based on display precision (#23)
Like ledger, price amounts are now "unobserved", ie their precision does
not affect the canonical display precisions used when displaying amounts,
and transaction balancing is done based on display precision, ie amounts
are considered to balance if their sum appears to be zero when using the
canonical display precision.
2010-11-14 22:44:37 +00:00
Simon Michael
77519e2c1d remove debug code breaking reports 2010-11-14 18:10:48 +00:00
Simon Michael
e707f97847 parsing: parse transaction and posting metadata, though we don't use it yet 2010-11-13 22:17:32 +00:00
Simon Michael
17d5acf64b refactor: more reader cleanups 2010-11-15 07:18:35 +00:00
Simon Michael
a3a7a346ac uniquify reader module names 2010-11-15 07:01:46 +00:00