Commit Graph

115 Commits

Author SHA1 Message Date
mrkkrp
7beca0c585 Fix the build with ‘QuickCheck-2.9’ and later 2016-07-24 13:06:52 +03:00
mrkkrp
e39fd663ca Minor corrections and add test for ‘lineFold’ 2016-05-10 22:51:40 +07:00
mrkkrp
a74bcd1499 Add ‘checkCase’ (rename old one to ‘checkCase'’) 2016-05-10 22:51:23 +07:00
mrkkrp
dc63a8f893 Add tests to cover new API for position advancing
Close #102.
2016-05-04 00:53:09 +07:00
mrkkrp
59c01cba67 Improve some existing tests to increase coverage 2016-05-02 21:51:06 +07:00
mrkkrp
2385cf5867 Add a test for ‘parseMaybe’ 2016-04-30 19:02:26 +07:00
mrkkrp
49303f18c4 Add a trivial test for ‘MonadIO’ instance 2016-04-30 18:32:50 +07:00
mrkkrp
2eddd78f0f Tests for ‘updatePos’ (different types of streams) 2016-04-30 18:22:00 +07:00
mrkkrp
3195a97776 Add new tests for ‘showTokens’ and pretty-printing 2016-04-30 17:31:52 +07:00
mrkkrp
1094408b96 Add ‘pushPosition’ and ‘popPosition’
Close #83.
2016-04-27 00:04:56 +07:00
mrkkrp
8e095bab8c A correction to ‘getPosition’ and ‘setPosition’
Make ‘getPosition’ and ‘setPosition’ work with current file, not with
the whole stack.
2016-04-26 23:01:09 +07:00
mrkkrp
f22cd69ff7 Cosmetic polishing 2016-04-26 00:37:06 +07:00
mrkkrp
13578590da Adjustments for compatibility 2016-04-25 19:51:13 +07:00
mrkkrp
f576945a4a Update tests for ‘Text.Megaparsec.Lexer’ 2016-04-24 21:56:45 +07:00
mrkkrp
e11066f07a Update tests for ‘Text.Megaparsec.Expr’ 2016-04-24 21:56:45 +07:00
mrkkrp
98b08b752a Update tests for ‘Text.Megaparsec.Prim’ 2016-04-24 21:56:45 +07:00
mrkkrp
643842ac1e Update tests for ‘Text.Megaparsec.Perm’ 2016-04-24 21:56:45 +07:00
mrkkrp
9089ed3325 Update tests for ‘Text.Megaparsec.Combinator’ 2016-04-24 21:56:45 +07:00
mrkkrp
6f69306515 Update tests for ‘Text.Megaparsec.Char’ 2016-04-24 21:56:45 +07:00
mrkkrp
35dc3a4469 Write tests for the new ‘Text.Megaparsec.Error’ 2016-04-24 21:56:40 +07:00
mrkkrp
14b1aeea8a Write tests for the new ‘Text.Megaparsec.Pos’ 2016-04-24 20:21:36 +07:00
mrkkrp
a1df59221b Update ‘Util’ module in test suite 2016-04-24 20:21:07 +07:00
mrkkrp
a3254f5371 Move language extensions to files
This turns out that it's easier for readers to lookup the list of
extensions in current file than go to Cabal file.
2016-04-10 19:26:54 +07:00
mrkkrp
747993e0bb Add ‘skipBlockCommentNested’ function
Close #96.
2016-03-30 14:50:35 +06:00
mrkkrp
18d192ba70 Use ‘Scientific’ as target type for floats
Close #95.

Here we introduce ‘scientific’ parser that can parse arbitrary big
numbers without error or memory overflow. ‘float’ still returns
‘Double’, but it's defined in terms of ‘scientific’ now. Since
‘Scientific’ type can reliably represent integer values as well as
floating point values, ‘number’ now returns ‘Scientific’ instead of
‘Either Integer Double’ (‘Integer’ or ‘Double’ can be extracted from
‘Scientific’ value anyway). This in turn makes ‘signed’ parser more
natural and general, because we do not need ad-hoc ‘Signed’ type class
anymore.
2016-03-29 16:42:51 +06:00
mrkkrp
aa805864af Add simple tests for ‘Text’ and ‘ByteString’
These are primitive tests, but nevertheless they check ‘uncons’ and
‘updatePos’ — everything we need.
2016-03-29 09:19:50 +06:00
mrkkrp
00ae88a8e7 Add a test to check that ‘tokens’ never consumes 2016-03-28 22:51:07 +06:00
mrkkrp
ac99fc0fac More flexible position-advancing function
This should improve experience of users who use Megaparsec with Alex and
Happy. The commit also introduces some minor changes in
‘Text.Megaparsec.Pos’ module (improving argument order).
2016-03-24 18:12:25 +06:00
recursion-ninja
dccfc82152 Replace ‘String’ with ‘Foldable f => f Char’
The commit also deals with GHC 8 warnings about redundant constraints.
2016-03-11 15:52:55 +06:00
mrkkrp
eef1fa7ea9 Further improve coverage 2016-02-19 16:15:32 +06:00
mrkkrp
75512ddde5 Use ‘mzero’ to fail (tests) 2016-02-19 16:04:49 +06:00
mrkkrp
bfe173ff07 Improve coverage of primitive combinators 2016-02-19 15:16:26 +06:00
mrkkrp
4c34c488cc Remove ‘Enum’ instance of ‘Message’
This was Parsec's legacy that we should eliminate now. ‘Message’ does
not constitute enumeration, ‘toEnum’ was never properly defined for
it. The idea to use ‘fromEnum’ to determine type of ‘Message’ is also
ugly, for this purpose new functions ‘isUnexpected’, ‘isExpected’, and
‘isMessage’ are defined in ‘Text.Megaparsec.Error’.
2016-02-18 16:26:29 +06:00
mrkkrp
52b41d4992 Add the ‘eitherP’ combinator
Close #85.
2016-02-18 14:46:55 +06:00
mrkkrp
e9df1ba30a Correct ‘withRecovery’ so that it passes the tests 2016-02-18 13:09:19 +06:00
mrkkrp
4ff95dd2a8 Add tests for ‘withRecovery’ primitive 2016-02-18 02:07:08 +06:00
mrkkrp
1285699b74 Improve coverage of older primitives 2016-02-18 00:12:27 +06:00
mrkkrp
3baa263eab Auto-backtracking for ‘tokens’ and friends 2016-02-17 23:32:48 +06:00
mrkkrp
e1be100bd6 Cosmetic whims
Can't help it…
2016-02-08 13:36:39 +06:00
mrkkrp
2bfc724d8d Add tests for returned state on failure 2016-02-08 00:41:09 +06:00
mrkkrp
e5ad380832 Remove redundant mode annotations 2016-01-25 12:56:41 +06:00
mrkkrp
611f2a4e7e Minor improvements for new combinators
In particular, if input has no newline at the end, we need to treat it
specially, because otherwise we will get confusing “incorrect
indentation” message.
2016-01-10 23:23:26 +06:00
mrkkrp
e5508941c8 Add year 2016 to copyright notices 2016-01-09 18:56:33 +06:00
mrkkrp
b8e3029041 Tests for new combinators and some refactoring 2016-01-09 17:55:54 +06:00
mrkkrp
ac62addce8 cosmetic improvements 2015-11-07 16:24:45 +06:00
mrkkrp
f129683dca new tests for ‘Text.Megaparsec.Expr’
These check error messages in some cases.
2015-11-03 17:42:01 +06:00
mrkkrp
60910b520f don't parse row of prefix/postfix operators
After some thinking I decided that this may be not desirable in some
cases, so we should not enable it by default. I've edited documentation
of ‘makeExprParser’ to explain why this doesn't work by default and how
to make it work.
2015-11-03 16:09:35 +06:00
mrkkrp
d595562e88 allow to parse rows of prefix/postfix operators
Close #64.

‘makeExprParser’ now generates parser that can handle several
occurrences of the same prefix or postfix operator in a row. This allows
to parse something like C pointers (for example ‘**i’) without resorting
to hacks.

The feature is experimental, I'm not entirely sure it's not
buggy. Upcoming additional tests for ‘Text.Megaparsec.Expr’ will show
whether it behaves correctly in all cases and doesn't have adverse
effects. For now, I've edited existing test to generate data with
repeating prefix negations and postfix factorials. Current code-base
passes the test.
2015-11-03 01:55:18 +06:00
mrkkrp
dd27063c03 added test to check how ‘newPos’ throws exceptions 2015-11-01 22:28:50 +06:00
mrkkrp
8c7de12ab7 rather fail loudly instead of silent correction 2015-10-30 21:40:22 +06:00