1
1
mirror of https://github.com/mrkkrp/megaparsec.git synced 2024-12-28 02:33:07 +03:00
Commit Graph

567 Commits

Author SHA1 Message Date
mrkkrp
eedf69761e Remove redundant constraints from lexer module 2016-04-18 21:52:45 +07:00
mrkkrp
84038a4fab Export ‘parseErrorPretty’ from ‘Text.Megaparsec’ 2016-04-18 20:48:31 +07:00
mrkkrp
f3f0aef44e Improve docs of ‘Text.Megaparsec.Prim’ 2016-04-18 19:49:52 +07:00
mrkkrp
006900e257 Add missing ‘@since’ labels to new functions 2016-04-18 19:49:20 +07:00
mrkkrp
fee19134e8 Improve new version of ‘Text.Megaparsec.Error’
Compatibility and documentation improvements.
2016-04-18 19:05:34 +07:00
mrkkrp
641114a442 Improve new version of ‘Text.Megaparsec.Pos’
Documentation improvements. The commit also makes it compile with all
supported GHC versions.
2016-04-18 17:59:32 +07:00
mrkkrp
acbae63a21 First attempt to outline Megaparsec 5.0.0
This is rather a sketch, we need to work on documentation, tests, and
perhaps on performance, but it should show the direction Megaparsec
5.0.0 is taking.
2016-04-17 20:08:13 +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 .
2016-03-30 14:50:35 +06:00
mrkkrp
18d192ba70 Use ‘Scientific’ as target type for floats
Close .

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
Mark Karpov
cd7f12963c Merge pull request from mrkkrp/position-advancing
More flexible position-advancing function
2016-03-29 10:39:01 +07: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
0b4abd81ae Update the ‘CHANGELOG.md’ file 2016-03-28 21:23:23 +06:00
mrkkrp
39b9ffb083 Add “since 5.0.0” to haddocks of new functions 2016-03-28 21:10:00 +06:00
mrkkrp
0f7a2c180c Improve efficiency of the library 2016-03-28 15:43:03 +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
b0124d1ea2 Remove ‘parseFromFile’ and ‘StorableStream’
Removed ‘parseFromFile’ and ‘StorableStream’ type-class that was
necessary for it. The reason for removal is that reading from file and
then parsing its contents is trivial for every instance of ‘Stream’ and
this function provides no way to use newer methods for running a parser,
such as ‘runParser'’. So, simply put, it adds little value and was
included in 4.x versions for compatibility purposes.
2016-02-22 19:52:57 +06:00
mrkkrp
750adb7c70 A minor improvement in docs of ‘makeExprParser’ 2016-02-20 14:36:15 +06:00
mrkkrp
d086ff92dc Version bump 2016-02-19 18:28:51 +06:00
mrkkrp
c99c4fa8ed Merge branch 'improving-coverage' 2016-02-19 17:45:17 +06:00
mrkkrp
30fcbb64ef Fix the build for older GHCs 2016-02-19 17:01:08 +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
5a68665a90 Change collection of constraints for ‘MonadParsec’
Collection of constraints changed from ‘Alternative m, Monad m, Stream s
t’ to ‘MonadPlus m, Stream s t’. This is done to make it easier to write
more abstract code with older GHC where such primitives as ‘guard’ are
defined for instances of ‘MonadPlus’, not ‘Alternative’.
2016-02-19 16:02:52 +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
0987c55b2b Cosmetic whims 2016-02-18 15:59:58 +06:00
mrkkrp
52b41d4992 Add the ‘eitherP’ combinator
Close .
2016-02-18 14:46:55 +06:00
Mark Karpov
a8bb4d9e10 Merge pull request from mrkkrp/recovery-feature
Implement the recovery feature
2016-02-18 12:25:28 +05:00
mrkkrp
4f5d73f230 Remove statement about performance
More recent benchmarks made after all changes show no considerable
difference. It's faster than Parsec for sure, so…
2016-02-18 13:22:38 +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
4c5aae7098 Update ‘CHANGELOG.md’ and ‘README.md’ 2016-02-12 22:12:30 +06:00
mrkkrp
3edbe9f54a Implement the recovery feature
Close .
2016-02-09 13:59:21 +06:00
Mark Karpov
b6048d3ec3 Merge pull request from hvr/pr/ghc8-instances
Define MonadFail & Semigroup instances
2016-02-08 19:34:57 +05:00
Herbert Valerio Riedel
9cfb8e627a Add GHC 8.0 to test-matrix 2016-02-08 11:41:02 +01:00
Herbert Valerio Riedel
ba9bd6a25e Define MonadFail & Semigroup instances
This also enables the respective warnings flags in dev mode
to help megaparsec remain forward compatible.

The dependencies on `semigroup` and `fail` are conditional on
`impl(ghc >= 8)` and avoid CPP and conditionally defined instances
(which would result in an conditional API).
2016-02-08 11:38:10 +01:00
mrkkrp
174c02ce38 Add ‘< 0.6’ constraint to ‘transformers’ 2016-02-08 13:37:30 +06:00
mrkkrp
e1be100bd6 Cosmetic whims
Can't help it…
2016-02-08 13:36:39 +06:00
Mark Karpov
fe9e4d736e Merge pull request from mrkkrp/state-on-failure
Support getting actual parser state on failure
2016-02-08 11:49:17 +05:00
mrkkrp
2bfc724d8d Add tests for returned state on failure 2016-02-08 00:41:09 +06:00
mrkkrp
c2c33045cc Fix the build for older GHCs 2016-02-07 20:50:27 +06:00
mrkkrp
4ba5bd7df1 Update ‘CHANGELOG.md’ file 2016-02-07 19:58:41 +06:00
mrkkrp
7727821c2a Make some combinators more efficient 2016-02-07 19:42:11 +06:00
mrkkrp
4bde699b84 Support getting actual parser state on failure
Close .

This solution is mostly OK as it passes tests and almost all benchmarks
show that there is no performance degradation.

The only function that bothers me is ‘pPlus’ (or ‘mplus’, or
‘<|>’). Benchmarks ‘choice/match’, ‘choice/nomatch’, and ‘manyTill’ show
about 44 % worse performance with current implementation of the feature
— this is not acceptable. All these functions are defined via ‘mplus’,
so it's necessary to find a way to improve that function.

Also, ‘mplus’ is tricky in that it combines different branches of
parsing. Previously, all logic describing how to combine failing
branches into one ‘ParseError’ were in ‘mergeError’ function. Now we
have to have ‘longestMatch’ function to choose right state as well,
because it's natural to expect that state on failure would correspond to
‘ParseError’. This should be done elegantly.
2016-02-06 17:59:50 +06:00
mrkkrp
e5ad380832 Remove redundant mode annotations 2016-01-25 12:56:41 +06:00