Simon Michael
35799142dd
Merge pull request #914 from simonmichael/rule-tags
...
tags for matching rule-generated txns and postings
2019-07-17 18:38:14 +01:00
Caleb Maclennan
11d9e5eb6a
code: Strip extraneous trailing whitespace from Haskell sources
2019-07-15 16:40:49 +01:00
Simon Michael
45198d3faa
lib: debug helpers: add ptraceAtWith, dbgNWith
2019-06-02 08:48:41 -07:00
Simon Michael
573a13fc27
lib: expectParseStateOn helper
2019-01-18 16:40:35 -08:00
Simon Michael
b5df5fb5f0
lib: comment
2018-10-18 14:43:00 -07:00
Simon Michael
2c2d10f9c2
lib: plog, plogAt: add missing newline, note issue
2018-10-18 14:43:00 -07:00
Alex Chen
3d2584d869
lib: switch to megaparsec 7
2018-09-30 20:15:12 -06:00
Alex Chen
3e54fc77a4
lib: make 'includedirectivep' an 'ErroringJournalParser'
...
- Update tests as well, requiring test utilities in Utils/Test.hs
analogous to the those for 'JournalParser' but instead for
'ErroringJournalParser'
2018-09-29 22:34:52 -06:00
Alex Chen
855a8f1985
lib: Re-implement the 'ExceptT' layer of the parser
...
We previously had another parser type, 'type ErroringJournalParser =
ExceptT String ...' for throwing parse errors without the possibility of
backtracking. This parser type was removed under the assumption that it
would be possible to write our parser without this capability. However,
after a hairy backtracking bug, we would now prefer to have the option
to prevent backtracking.
- Define a 'FinalParseError' type specifically for the 'ExceptT' layer
- Any parse error can be raised as a "final" parse error
- Tracks the stack of include files for parser errors, anticipating the
removal of the tracking of stacks of include files in megaparsec 7
- Although a stack of include files is also tracked in the 'StateT
Journal' layer of the parser, it seems easier to guarantee correct
error messages in the 'ExceptT FinalParserError' layer
- This does not make the 'StateT Journal' stack redundant because the
'ExceptT FinalParseError' stack cannot be used to detect cycles of
include files
2018-09-29 22:33:34 -06:00
Simon Michael
91b111b60d
rename easytests_* to tests_*
2018-09-06 13:13:26 -07:00
Simon Michael
ce96001cfc
lib: keep Tests building with ghc 7.10
...
The doctests test suite fails to bulid with ghc 7.10, not fixed.
2018-09-04 14:27:10 -07:00
Simon Michael
4003264129
lib: drop HUnit helpers, rename expectEqPP
2018-09-04 13:52:36 -07:00
Simon Michael
51618adc37
tests: use is in a few more places
2018-09-04 13:39:21 -07:00
Simon Michael
dcc44d10a5
lib: export HasCallStack from Hledger.Utils.Test
2018-09-04 09:59: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
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
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
89357bb7b6
another parse test helper, use the IO variant always, port more tests
2018-08-19 19:02:59 +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
d778a92561
tests: export HUnit/EasyTest from Hledger.Utils.Test; more helpers
2018-08-18 15:19:59 +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
b1bbbf0d93
lib: expectParseEqIO helper
2018-08-17 12:42:05 +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
ab7dc3294e
lib: more informative failure output for amount tests ( #812 )
2018-08-15 11:24:52 +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
1e0a7ec8f1
remove some unneeded CPP pragmas
2018-08-02 08:25:49 +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
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
132f8706d7
lib: edit comments to satisfy doctest
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
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
Pavlo Kerestey
63d4c51dc4
Use quoteIfNeeded in quoteIfSpaced. Fix escapeDoubleQuotes to escape
2018-04-12 12:04:20 -07:00
Pavlo Kerestey
980210070a
Explicit exports of Hledger.Utils.Text
2018-04-12 12:04:20 -07: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