Simon Michael
54db19e857
tests: convert & re-enable StringFormat tests
2018-09-04 13:51:08 -07:00
Simon Michael
51618adc37
tests: use is in a few more places
2018-09-04 13:39:21 -07:00
Simon Michael
7370f2a553
tests: Hledger -> easytest
2018-09-04 12:25:52 -07:00
Simon Michael
09d9fbf487
tests: Reports -> easytest
2018-09-04 12:23:07 -07:00
Simon Michael
241d0dbebd
tests: ReportOptions -> easytest
2018-09-04 11:54:40 -07:00
Simon Michael
3b63c2ff2f
tests: Transaction, Data -> easytest
2018-09-04 11:54:15 -07:00
Simon Michael
a8175d8b14
tests: Timeclock -> easytest
2018-09-04 11:30:48 -07:00
Simon Michael
8d1506a4a4
tests: Posting -> easytest
2018-09-04 10:26:22 -07:00
Simon Michael
c5cd0dc648
tests: Ledger -> easytest
2018-09-04 10:24:07 -07:00
Simon Michael
d5c756e6c8
tests: Journal -> easytest
2018-09-04 10:10:10 -07:00
Simon Michael
0499b3f7e5
tests: Amount -> easytest
2018-09-04 10:01:26 -07:00
Simon Michael
dcc44d10a5
lib: export HasCallStack from Hledger.Utils.Test
2018-09-04 09:59:48 -07:00
Simon Michael
c3755f9a52
tests: AccountName -> easytest
2018-09-04 07:40:27 -07:00
Simon Michael
5de679ce62
tests: Query -> easytest
2018-09-04 07:29:48 -07:00
Simon Michael
bbecb28cae
tests: Utils -> easytest
2018-09-03 15:54:53 -07:00
Simon Michael
f713a413ff
clarify expectEq' arguments
2018-09-03 15:54:13 -07:00
Simon Michael
f3709f241d
tests: port Read tests to easytest
2018-09-03 15:42:24 -07:00
Simon Michael
d1cff46ba7
tests: port CsvReader tests to easytest
2018-09-03 15:30:52 -07:00
Simon Michael
1fced57c81
lib: export expectEq' helper
2018-09-03 15:30:27 -07:00
Simon Michael
cd67f8ea68
tests: clear out old boilerplate
2018-08-31 18:12:17 -07:00
Simon Michael
d1a7cc1c09
port remaining Read.Common tests
2018-08-31 18:12:17 -07:00
Simon Michael
f124007acf
tests: dehyphenate test names
2018-08-31 18:12:17 -07:00
Simon Michael
be7866da59
tests: parsedate -> fromGregorian
2018-08-31 18:12:17 -07:00
Simon Michael
f108b56e61
uniquify modules' easytests, simplify imports
2018-08-20 14:31:31 +01:00
Simon Michael
6568784bf6
port remaining JournalReader tests
2018-08-20 14:31:31 +01:00
Simon Michael
9733e0378e
journal: restore/port more old unit tests
2018-08-20 10:38:51 +01:00
Simon Michael
776d575610
test helpers: more line breaks, clarify monadic behaviour
2018-08-20 10:38:02 +01:00
Simon Michael
d6fb96cb4c
tests: expectParse, expectParseError helpers; parse to end of input
2018-08-20 08:59:06 +01:00
Simon Michael
5d9d9a8edb
tests: drop obsolete helpers
2018-08-20 08:25:03 +01:00
Simon Michael
9c0483fef2
tests: port another to easytest
2018-08-20 08:22:31 +01:00
Simon Michael
1a38beaad1
drop old transactionp hunit tests
2018-08-19 19:12:26 +01:00
Simon Michael
7706f8498e
tests: comment
2018-08-19 19:05:59 +01:00
Simon Michael
89357bb7b6
another parse test helper, use the IO variant always, port more tests
2018-08-19 19:02:59 +01:00
Simon Michael
3e6159e632
replace a bunch of custom Show instances for easier troubleshooting
...
Custom Show instances were obscuring important details in test failure
output again. The best policy seems to be: stick with default derived
Show instances as far as possible, but when necessary customize them
to conform to haskell syntax so pretty-show can do its thing (eg when
they contain Day values, cf https://github.com/haskell/time/issues/101 ).
2018-08-19 18:17:49 +01:00
Simon Michael
2778f6cf8f
lib: restore some old unit tests
...
Also change nullsourcepos, tests prefer JournalSourcePos for some reason.
2018-08-19 18:13:01 +01:00
Simon Michael
150b40e465
tests: remove empty scope
2018-08-19 18:07:33 +01:00
Simon Michael
bdcfba4eaa
whitespace
2018-08-18 20:31:47 +01:00
Simon Michael
fc11b5130f
journal: another failing test from #807
2018-08-18 19:50:15 +01:00
Simon Michael
7ab8bc2685
tests: import cleanups
2018-08-18 19:47:52 +01:00
Simon Michael
a8031de729
tests: fix build error with GHC < 8.4
2018-08-18 19:26:07 +01:00
Simon Michael
6081fead11
lib: clarify package test suites, run all easytests
2018-08-18 15:20:15 +01:00
Simon Michael
582e088325
lib: tests/ -> test/
2018-08-18 15:20:15 +01:00
Simon Michael
d778a92561
tests: export HUnit/EasyTest from Hledger.Utils.Test; more helpers
2018-08-18 15:19:59 +01:00
Simon Michael
4d578c008f
typo
2018-08-18 13:40:01 +01:00
Simon Michael
e0e21a2c6c
lib: note
2018-08-18 07:30:23 +01:00
Simon Michael
9c3a57f615
lib: some test fixes ( #823 )
2018-08-17 14:18:24 +01:00
Simon Michael
b4c336c874
test/_test/it/_it helpers; refactor easytests
...
This makes skipping/unskipping tests easier, and improves readability
a bit.
Note it's also possible to just write the test name with no preceding
function, when the type is constrained (see Journal.hs).
2018-08-17 13:40:37 +01:00
Simon Michael
626247bacd
journal: unit tests (2 skipped) for periodtransactionp ( #823 )
2018-08-17 12:42:43 +01:00
Simon Michael
b1bbbf0d93
lib: expectParseEqIO helper
2018-08-17 12:42:05 +01:00
Simon Michael
43d973e8ab
lib: more verbose show instance for PeriodicTransaction
2018-08-17 12:41:45 +01:00
Simon Michael
1d775a7a9c
lib: D should not affect automated posting multiplier amounts ( fix #860 )
2018-08-17 07:39:17 +01:00
Simon Michael
13436637c6
lib: "decimal point" -> "decimal separator" in error message
2018-08-17 07:37:26 +01:00
Simon Michael
e35dd19cc8
lib: refactor: tighten up amountwithoutpricep
2018-08-17 06:51:07 +01:00
Simon Michael
e9c5d13ac1
lib: update old failing amountp/postingp tests, at last ( #812 )
2018-08-16 06:42:52 +01:00
Simon Michael
dab75d98c8
lib: expectEq', expectParseEq: pretty-print compared values ( #812 )
2018-08-16 06:31:37 +01:00
Simon Michael
536eadb809
lib: improve expectParseEq ( #812 )
...
Show a pretty parse error, and avoid sequenced scopes
which are confusing (you can't run only the second).
2018-08-16 06:03:44 +01:00
Simon Michael
09d8e302db
lib: use unspaced scopes to simplify command lines ( #812 )
2018-08-16 05:58:17 +01:00
Simon Michael
50d666d5a0
test: refactor, document, organise easytests, port amountp tests ( #812 )
2018-08-15 19:58:07 +01:00
Simon Michael
69325da110
comment out failing tests to fix CI ( #812 )
2018-08-15 11:30:53 +01:00
Simon Michael
ab7dc3294e
lib: more informative failure output for amount tests ( #812 )
2018-08-15 11:24:52 +01:00
Simon Michael
e6181efe95
lib: more compact show instance for Amounts ( #812 )
...
Amount's default show instance hid important details, making eg test
failures hard to understand. Showing full detail required increasing
the debug level which was inconvenient.
Now it has a single show instance which shows more information, is
fairly compact, and is pretty-printable with pretty-show.
Ellipses (..) in the output indicate where fields are
- not shown in full detail, and/or
- shown in pseudo syntax (double quoted) to work with pretty-show.
ghci> usd 1
OLD:
Amount {acommodity="$", aquantity=1.00, ..}
NEW:
Amount {acommodity = "$", aquantity = 1.00, aprice = NoPrice, astyle = AmountStyle "L False 2 Just '.' Nothing..", amultiplier = False}
MixedAmount's show instance is unchanged, but showMixedAmountDebug
is affected by this change:
ghci> putStrLn $ showMixedAmountDebug $ Mixed [usd 1]
OLD:
Mixed [Amount {acommodity="$", aquantity=1.00, aprice=, astyle=AmountStyle {ascommodityside = L, ascommodityspaced = False, asprecision = 2, asdecimalpoint = Just '.', asdigitgroups = Nothing}}]
NEW:
Mixed [Amount {acommodity="$", aquantity=1.00, aprice=, astyle=AmountStyle "L False 2 Just '.' Nothing.."}]
2018-08-15 11:18:55 +01:00
Simon Michael
4c268f4a93
doc: journal: fix Transaction Modifiers formatting
...
[ci skip]
2018-08-14 16:07:26 +01:00
Simon Michael
681039b387
doc: journal: fix Transaction Modifiers heading
...
[ci skip]
2018-08-14 16:05:06 +01:00
Simon Michael
27d464f344
lib: some helpers for setting Amount internals ( #812 )
2018-08-14 16:05:06 +01:00
Simon Michael
efae8f8f2a
lib: comment
2018-08-14 16:05:06 +01:00
Simon Michael
e077aeff5f
lib: more informative test failure message ( #812 )
2018-08-14 16:05:06 +01:00
Simon Michael
321635274c
lib: move assertParseEqual' ( #812 )
2018-08-14 16:05:06 +01:00
Simon Michael
b03584dbce
lib: parse helper haddocks
2018-08-14 16:05:06 +01:00
Simon Michael
cfaa0501e6
lib: update some journal parser tests ( #812 )
2018-08-14 16:05:06 +01:00
Jakub Zárybnický
c67404c73d
lib: Fix compile errors in tests
2018-08-14 16:05:06 +01:00
Simon Michael
e88a9c4a5f
lib: followingcomment: parse no comment as "", not "\n"
...
Same-line & next-line comments of transactions, postings, etc.
are now parsed a bit more precisely. Previously parsing no comment
gave the same result as an empty comment (a single newline); now
it gives an empty string.
Also, and perhaps as a consequence of the above, when there's no
same-line comment but there is a next-line comment, we'll insert an
empty first line, otherwise next-line comments would get moved up to
the same line when rendered.
Some doctests have been added.
2018-08-03 19:38:55 +01:00
Simon Michael
46d6971da7
lib: doctests: file pattern arguments, more informative output
...
Limiting to just the file(s) you're interested can make doctest start
much quicker. With a big caveat: you can limit the starting files,
but it will also test all other local files those import.
2018-08-03 19:06:17 +01:00
Simon Michael
df430e5eb0
lib: AccountName: set OverloadedStrings for doctests
2018-08-03 19:05:14 +01:00
Simon Michael
ed93807ee5
lib: doctests: add --verbose and --slow flags to executable
...
--slow turns off doctest's --fast flag, which skips reloading between
tests.
--verbose shows progress output as tests are run, if doctest 0.16.0+
is installed (and I believe will be harmless otherwise)
2018-08-03 19:05:14 +01:00
Simon Michael
0135f8c863
tools: make doctest: use default snapshot/ghc 8.4, mention mac workaround
2018-08-03 19:05:11 +01:00
Joseph Weston
40d70ad10b
lib: fail when file to include is in stack of 'include' files
2018-08-02 18:43:00 +01:00
Joseph Weston
1d91ea43a5
lib: add whitespace around '$' operator
2018-08-02 18:43:00 +01:00
Simon Michael
86c36c1dcc
update embedded manuals
2018-08-02 08:25:49 +01:00
Simon Michael
481e2061d7
doc: journal: tweak mnemonics
2018-08-02 08:25:49 +01:00
Simon Michael
64bd88dd80
doc: journal: rename topic to Transaction Modifiers
2018-08-02 08:25:49 +01:00
Simon Michael
d685d1aa9b
lib,rewrite: simplify transactionModifierToFunction
...
This removes transactionModifierToFunction's extra query parameter;
the rewrite command sets it in the TransactionModifier instead, which
I think is equivalent. I had to change one functional test, but it
seems correct now, so perhaps it wasn't working right before ?
2018-08-02 08:25:49 +01:00
Simon Michael
72acb86299
cabal: bump tested-with declarations
2018-08-02 08:25:49 +01:00
Simon Michael
1e0a7ec8f1
remove some unneeded CPP pragmas
2018-08-02 08:25:49 +01:00
Simon Michael
eae9d78bb1
lib: generateAutomaticPostings -> applyTransactionModifiers
2018-08-02 08:25:49 +01:00
Simon Michael
bb36693155
lib: refactor, txnTieKnot automatically
2018-08-02 08:25:49 +01:00
Simon Michael
572f5a4b31
lib: drop parseAndFinaliseJournal', seems unused (api change)
2018-08-02 08:25:49 +01:00
Simon Michael
a49b1cd3bb
lib: AutoTransaction.hs -> TransactionModifier.hs, PeriodicTransaction.hs
2018-07-30 20:22:39 +01:00
Simon Michael
efc54c4c25
lib: ModifierTransaction -> TransactionModifier; try to clarify a bit
2018-07-30 19:38:21 +01:00
Simon Michael
007b9f8caa
lib: capitalised month names broke some period expressions ( fix #852 )
...
This was a regression in hledger 1.10.
mon[th]Index are now case insensitive.
2018-07-30 11:08:23 +01:00
Simon Michael
daa37a9993
lib: nthdayof(month|year)containing now validate input a bit ( #852 )
2018-07-30 11:08:14 +01:00
Simon Michael
0f3a030a40
lib: whitespace
2018-07-30 11:05:02 +01:00
Simon Michael
eb6baac6e7
lib: make applyN more robust ( #852 )
2018-07-30 11:04:33 +01:00
Simon Michael
d9d94e2cf6
journal: fix breakage in auto posting rule parser ( #745 )
...
I was negligent and did not test enough. This should ignore
transaction comments in auto posting rules more safely.
It also adds support for trailing comments on the first line of auto
posting rules, which previously were misparsed as part of the query.
2018-07-26 15:54:21 +01:00
Simon Michael
e2f5e98926
lib: clarify account name parsing rules
2018-07-26 08:30:32 +01:00
Simon Michael
41c985b5fb
journal: ignore transaction comments in auto posting rules ( #745 )
...
Previously they were misparsed as account names.
2018-07-26 08:29:02 +01:00
Joseph Weston
e23160059e
lib: add generated man files
2018-07-26 06:12:31 +01:00
Joseph Weston
1fca47cf18
lib: update documentation for globs in 'include' directive
2018-07-26 06:12:31 +01:00
Joseph Weston
f2c1586238
lib: sort the matched include files lexicographically
...
Now the files are included in the same order as they would be
listed by 'ls'.
2018-07-26 06:12:31 +01:00
Joseph Weston
1ec16c2dc0
lib: explicitly specify that the 'Glob' package should be used
...
Without this there are conflicts with the 'filemanip' package,
which itself exports a module 'System.FilePath.Glob'.
2018-07-26 06:12:31 +01:00
Joseph Weston
c69b16d826
lib: prefer use of 'parseErrorAt' to generic 'fail'
...
'fail' will just terminate the current parse branch, whereas here
we have encountered a definite error. Also bring the code to
get the current working directory inside 'getFilePaths', as it
logically belongs there.
2018-07-26 06:12:31 +01:00
Joseph Weston
5077443a84
lib: add tests and code for nonexistant files and malformed globs
2018-07-26 06:12:31 +01:00
Joseph Weston
2c4d0c0acd
lib: factor out logic for obtaining a list of files to include
2018-07-26 06:12:31 +01:00
Joseph Weston
2d420a33a4
lib: update cabal file with 'Glob' library depdendency
2018-07-26 06:12:31 +01:00
Joseph Weston
0ade323d2a
lib: use glob matching if filename in 'include' directive is a glob pattern
2018-07-26 06:12:31 +01:00
Joseph Weston
96f7a03487
lib: factor out parsing child journal into separate function
2018-07-26 06:12:31 +01:00
Joseph Weston
52da073828
lib: expand current directory separately from filepath
...
We will need the current directory as an absolute path when
adding glob patterns in a few commits time.
2018-07-26 06:12:31 +01:00
Joseph Weston
9e56ad24e2
lib: reorder code for reading include files
...
This should be before all journal and parser state manipulations,
so that those can be readily factored in a few commits time.
2018-07-26 06:12:31 +01:00
Simon Michael
aab7d2d964
lib: fix error triggered by upper-case day in period expression ( #847 )
2018-07-24 14:36:45 +01:00
Simon Michael
da8047d286
lib: type signatures
2018-07-24 14:24:45 +01:00
Simon Michael
fe73f2a6b5
csv: interpolated field names in values are now case insensitive
...
Field names are supposed to be case insensitive, but a field assignment like
fields ...,Transaction_Date,...
date %Transaction_Date
was failing, because of the capitalised letters. Fixed now.
2018-07-22 22:26:24 +01:00
Simon Michael
aebd6c50d6
smooth: smoothes out irregular transactions (experimental addon)
2018-07-16 23:36:06 +01:00
Simon Michael
d5430e7ddf
clean up debug helpers (api change)
2018-07-16 15:28:58 +01:00
Simon Michael
9d2e80aa2c
lib: Debug: simplify pprint, export ppShow as pshow (api change)
2018-07-16 12:51:50 +01:00
Simon Michael
92404bb847
prices: allow filtering by query, clarify docs
...
Query arguments are allowed, prices can be filtered by date, and
postings providing transaction prices can be filtered by anything.
2018-07-15 09:21:10 +01:00
Simon Michael
91e5baf617
lib: clean up queryDateSpan, queryDateSpan' (api change)
...
These now intersect date AND'ed date spans, instead of unioning them,
and docs are clearer.
2018-07-15 08:35:39 +01:00
Simon Michael
d461e96c34
doc: update manuals harder, they should say 1.10.99
...
[ci skip]
2018-07-04 15:09:57 +01:00
Simon Michael
4f40467d86
update embedded manuals
2018-07-04 13:33:27 +01:00
Simon Michael
d62f082bce
bump version to 1.10.99 (dev)
2018-07-04 13:32:42 +01:00
Simon Michael
91c487d4c2
doc: manuals: update version strings
2018-07-04 12:52:29 +01:00
Simon Michael
8d6667f698
lib: doc: forecast transaction dates tweak ( #835 )
...
[ci skip]
2018-07-04 09:48:32 +01:00
Simon Michael
0322638cf5
lib: doc: clarify how forecast transaction dates work ( #835 )
...
[ci skip]
2018-07-04 09:41:12 +01:00
Simon Michael
22f2e90a4b
update embedded manuals
2018-06-30 22:08:48 +01:00
Simon Michael
6242b1d784
bump version to 1.10
2018-06-30 22:08:02 +01:00
Simon Michael
6b8fcd7205
changelogs
2018-06-30 21:57:06 +01:00
Simon Michael
937333c2c1
doc: journal: more account codes limitations
...
[ci skip]
2018-06-27 12:42:05 +01:00
Simon Michael
2959356bd9
doc: journal: note another account codes limitation, in flat mode
...
[ci skip]
2018-06-27 12:19:25 +01:00
Simon Michael
35e68e23c5
doc: journal: clarify account aliases doc
...
[ci skip]
2018-06-27 11:44:26 +01:00
Simon Michael
6d215945b6
doc: journal: clarify account aliases doc
...
[ci skip]
2018-06-27 11:41:11 +01:00
Simon Michael
6924e8390c
lib: journal: let alias/apply account affect account directives ( #825 )
2018-06-27 11:33:12 +01:00
Simon Michael
422f1084c9
doc: journal: note that non-regex alias directive is case sensitive
...
[ci skip]
2018-06-27 11:15:46 +01:00
Alex Chen
e82b01bcf8
lib: refine parse errors and parser labels
2018-06-20 23:24:39 -06:00
Alex Chen
9674f2a8cc
lib: tweak whitespace parsing for better parse errors
...
- expands the set of expected tokens when e.g. parsing the invalid
posting `account $1 a`
- whitespace can affect parse errors because of the longest match rule
where errors that occur later take precedence over those that occur
earlier
2018-06-20 23:24:39 -06:00
Alex Chen
ed0106b209
lib: reduce backtracking of various parsers
2018-06-20 23:24:39 -06:00
Alex Chen
e3a755b5b1
lib: refactor amount parsers to minimize backtracking
...
- inline `spaceamountormissingp` into `postingp`
- combine `rightsymbolamountp` and `nosymbolamountp`
- the multiplier symbol '*' for an amount must now always preceed a sign '-'
[breaking change]
- make amount parser labels more generic to simplify error messages
2018-06-20 23:24:39 -06:00
Alex Chen
89b1fd7de3
lib: refactor date-time parser, add error messages
...
- also removed commented-out time-zone code
2018-06-20 23:24:39 -06:00
Simon Michael
bc9375e4e5
lib: doc: journal: describe current directive semantics, finally
...
It's amazing how you can build, document, support and fix a thing for
years and not know what exactly it does. Directives are tricky.
Here is a pretty accurate description of their current behaviour,
determined by testing.
2018-06-20 19:41:28 -07:00
Simon Michael
26489765ef
lib: manual updates
...
[ci skip]
2018-06-20 18:44:34 -07:00
Simon Michael
816ba0f89d
consistent comment wording
2018-06-18 17:54:25 -07:00
Simon Michael
b04dc82125
lib: doc: journal: clarify periodic transactions
...
[ci skip]
2018-06-18 17:54:07 -07:00
Simon Michael
c4d45cffc4
lib: journal: require a space between period expr. and other fields
2018-06-12 16:41:36 -07:00
Simon Michael
eb23504906
lib: periodexprp: don't consume trailing whitespace
2018-06-12 16:41:36 -07:00
Alex Chen
c6bfd92dd3
removing "re-parsing" for pull 807
...
For Data/Dates.hs in particular:
- Changed `SimpleTextParser` to `TextParser m` for all parsers
- Changed `string` to the case-insensitive `string'` to match the
behaviour of `T.toLower` found in `parsePeriodExpr`
- export `periodexprp` for "direct" use
2018-06-12 16:41:36 -07:00
Simon Michael
57f41697ba
update embedded manuals
2018-06-12 16:41:36 -07:00
Simon Michael
e3507ad944
lib: journal: allow descriptions/comments in periodic transactions
...
Also period expressions relative to today's date can now be used,
for what it's worth.
2018-06-12 16:41:36 -07:00
Simon Michael
dfcafc2cdf
lib: refactor some journal, period expression parsers
2018-06-12 16:41:36 -07:00
Simon Michael
1287081ffd
tools: doctest: slight cleanup
2018-06-12 16:41:36 -07:00
Simon Michael
7a4c3eea65
lib: doc: periodic/auto rule cleanups
2018-06-12 16:41:36 -07:00
Alex Chen
0fb737bc39
lib: reduce backtracking in commoditydirectiveonelinep
2018-06-11 14:29:18 -06:00
Alex Chen
0382bb5cd4
lib: move custom parse errors to Text.Megaparsec.Custom
2018-06-11 13:58:56 -06:00
Alex Chen
846a38139d
lib: add license to the code copied from megaparsec
2018-06-11 13:58:56 -06:00
Alex Chen
2b22f857ac
lib: make the parse errors module backwards compatible
2018-06-11 13:58:56 -06:00
Alex Chen
ff2b042c7e
lib: remove the ErroringJournalParser type
2018-06-11 13:58:56 -06:00
Alex Chen
39e7ef0311
lib: refine date parser error messages
2018-06-11 13:58:55 -06:00
Alex Chen
132f8706d7
lib: edit comments to satisfy doctest
2018-06-11 13:57:30 -06:00
Alex Chen
5f87e7cd5d
lib: enable the custom parse errors
2018-06-11 13:57:30 -06:00
Alex Chen
2d21ec0174
lib: weaken parser types
2018-06-11 13:57:30 -06:00
Alex Chen
4a9e418b7a
lib: refactor includedirectivep to avoid "re-parsing"
2018-06-11 13:57:30 -06:00
Alex Chen
b034fa7ca9
lib: weaken parser types
2018-06-11 13:57:30 -06:00
Alex Chen
9b6558401f
lib: rewrite comment parsers [API]
...
- avoid the "re-parsing" of comments using the `match` parser combinator
2018-06-11 13:57:30 -06:00
Alex Chen
d707b351cc
lib: switch to custom parse errors for parserErrorAt
...
Also weaken the types of the parsers that use it
2018-06-11 13:57:30 -06:00
Alex Chen
c5561f25f1
lib: switch parsers to the custom error type
...
Also add an explicit export list to `hledger-lib/Hledger/Utils/Parse.hs`
in order to re-export the custom error type (for convenience).
2018-06-11 13:57:30 -06:00
Alex Chen
ca201e4618
lib: add a module for custom parse errors
...
... for displaying the source line on which parse errors occured
Over the following set of commits, I will to refactor the parsers to
obviate the `ExceptT String` layer of the `ErroringJournalParser` type
so that all parse errors go through Megaparsec's parse error machinery.
2018-06-11 13:57:22 -06:00
Simon Michael
42f47e2b6b
update embedded manuals
...
[ci skip]
2018-06-08 17:27:04 -07:00
trevorriles
9b1343d0b9
Add fast flag to doctests.
...
Fixes #802
2018-06-07 10:41:09 -05:00
Simon Michael
061aad0431
remove some CPP that's obsolete since we require base 4.8+
2018-06-04 17:33:21 -07:00
Simon Michael
7ebecb1ab8
use newer hashtables to fix an instance warning with doctests/ghc 7 ( #794 )
2018-06-04 17:33:17 -07:00
Simon Michael
0ce9c5728a
switch to base-compat-batteries to fix ghc 7.10 support ( #794 )
...
base-compat-batteries provides the same API across more ghc versions
than base-compat does, at the cost of more dependencies. Eg it exports
Prelude.Compat ((<>)) with ghc 7.10/base 4.8, which we expect.
My belief is that several of our deps already require it so the added
cost is not too great. We should probably go back to base-compat when
possible though, eg when we stop supporting ghc 7.10.
2018-06-04 17:32:42 -07:00
Simon Michael
328b2dabfe
require latest base-compat, might as well ( #794 )
2018-06-04 17:32:32 -07:00
Peter Simons
6db7f800ee
hledger-lib: fix doctest suite after recent package updates
...
The new version of our package set apparently contains both base-compat and
base-compat-batteries in its transitive closure. This breaks the doctest suite,
which just imports everything into scope when the tests are run, thereby making
module names like Prelude.Compat ambiguous.
2018-06-04 21:41:15 +02:00
Peter Simons
8c0c168cd6
Fix the build of hledger-lib with ghc 8.0.x and base-compat 0.10.x.
...
We don't need to import Data.Monoid because Prelude.Compat exports "<>"
already. In fact, importing that module causes build failures:
Hledger/Read/Common.hs:725:62: error:
Ambiguous occurrence ‘<>’
It could refer to either ‘Sem.<>’,
imported from ‘Prelude.Compat’ at Hledger/Read/Common.hs:97:1-39
(and originally defined in ‘Data.Semigroup’)
or ‘Data.Monoid.<>’,
imported from ‘Data.Monoid’ at Hledger/Read/Common.hs:110:1-18
Fixes https://github.com/simonmichael/hledger/issues/794 .
2018-06-04 20:58:58 +02:00
Simon Michael
66fbdc5d61
lib: enable doctests on mac again, note workaround, fix link
...
[ci skip]
2018-06-01 07:18:12 -07:00
Alex Chen
1116261f5a
lib: simplify fromRawNumber
2018-05-27 07:50:26 -07:00
Alex Chen
c3f5659d75
lib: add some strictness annotations to the parser
...
This was done to reverse minor performance regressions introduced in the
previous commits
2018-05-27 07:50:26 -07:00
Alex Chen
d79e707485
lib: remove redundant check in accountnamep
2018-05-27 07:50:26 -07:00
Alex Chen
43aa3d479e
lib: fix up runJournalParser
2018-05-27 07:50:26 -07:00
Alex Chen
d56fca1ba2
lib: superficial parser cleanups
2018-05-27 07:50:26 -07:00
Alex Chen
2a492696a9
lib: prevent the parsing of prices of prices
2018-05-27 07:50:26 -07:00
Alex Chen
edf9cc2366
lib: move handling of exponentials into fromRawNumber [API]
...
- Rationale:
- The information necessary for applying exponents to a number is more
explicitly represented in the inputs to `fromRawNumber` than in the outputs
- This way, `exponentp` may simply return an `Int`
2018-05-27 07:50:26 -07:00
Alex Chen
f7fd6e6525
lib: refactor the raw number parser [API]
...
- Purpose: to reduce the verbosity of the previous implementation
- Split off `AmbiguousNumber` into its own type
- Introduce a function `AmbiguousNumber -> RawNumber` explicitly capturing the
disambiguation logic
- Reduce the number of remaining constructors in `RawNumber` to just two,
`WithSeparator` and `NoSeparator`
- The choice to distinguish by the presence of digit separators is motivated
by the need for this information later on when disallowing exponents on
numbers with digit separators
2018-05-27 07:50:26 -07:00
Alex Chen
6ffa9cb3cd
lib: rename pdigitgroup to digitgroupp for consistency
2018-05-27 07:50:26 -07:00
Alex Chen
cf9b2001e7
lib: refactor sign parser
...
- Extracts the handling of signs out of `fromRawNumber` and into `signp` itself
- Rationale: The sign can be applied independently from the logic in
`fromRawNumber`
2018-05-27 07:50:26 -07:00
Alex Chen
84c7e2c403
lib: superficial changes to parsers
2018-05-24 09:35:27 -07:00
Alex Chen
121ba92ade
lib: refactor the raw number parser [API change]
2018-05-24 09:35:27 -07:00
Alex Chen
93fbac99d3
lib: refactor date parser
2018-05-24 09:35:27 -07:00
Alex Chen
12e8d0e282
lib: change some parsers to use takeWhileP
2018-05-22 12:16:46 -07:00
Alex Chen
558c11596f
lib: refactor the account name parser
2018-05-22 12:16:46 -07:00
Alex Chen
b245ec7b3d
lib: remove the megaparsec compatability module
2018-05-22 12:16:46 -07:00
Alex Chen
c4ba7542d7
lib: use megaparsec 6 for all supported ghc versions
2018-05-22 12:16:46 -07:00
Alex Chen
676ea912b3
lib: fix issue where spaces were allowed as decimal points
...
- Fixes #749
- Also enabling the tests prepared for #749
2018-05-20 20:17:57 -07:00
awjchen
46aae19a54
lib: fix parsing of amounts with a whitespace digits separator
2018-05-20 16:02:59 -06:00
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
Simon Michael
1c6702d598
budget: note some todos
...
[ci skip]
2018-05-17 08:12:14 -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