Commit Graph

113 Commits

Author SHA1 Message Date
Mark Karpov
889c9f3446
Fix a typo 2022-10-21 20:26:14 +02:00
Mark Karpov
ed6fdf71d9 Improve the writing 2021-04-25 16:03:52 +02:00
Mark Karpov
040a1be79e
Add a performance note to the dos of ‘satisfy’
Close #434.
2020-12-14 12:08:57 +01:00
mlugg
ccf314b0b9 Add Safe Haskell support
Remove dependence on GeneralizedNewtypeDeriving and add Safe Haskell
extensions to every file.
2020-10-17 18:53:15 +02:00
1computer1
34b34c3d93 Decouple the error reporting-related methods from ‘Stream’
Split the ‘Stream’ type class. The methods ‘showTokens’ and ‘tokensLength’
have been put into a separate type class ‘VisualStream’, while ‘reachOffset’
and ‘reachOffsetNoLine’ are now in ‘TraversableStream’. This should make
defining ‘Stream’ instances for custom streams easier.

Defined ‘Stream’ instances for lists and ‘Seq’s.
2020-09-02 19:50:45 +02:00
Mark Karpov
99e640ec39
Format the source code with Ormolu 2020-04-23 22:05:36 +02:00
mrkkrp
20811826ca
Update the links to the tutorial 2019-11-22 23:16:51 +01:00
mrkkrp
31b917b129 Allow registration of delayed parse errors
Megaparsec now supports registration of “delayed” parse errors. On lower
level we added a new field called ‘stateParseErrors’ to the ‘State’ record.
The type also had to change from ‘State s’ to ‘State s e’. This field
contains the list of registered ‘ParseErrors’ that do not end parsing
immediately but still will cause failure in the end if the list is not
empty. Users are expected to register parse errors using the three
functions: ‘registerParseError’, ‘registerFailure’, and
‘registerFancyFailure’. These functions are analogous to those without the
‘register’ prefix, except that they have “delayed” effect.
2019-11-07 12:48:56 +01:00
mrkkrp
f8ef95c025 Re-organize error reporting functions
The methods ‘failure’ and ‘fancyFailure’ of ‘MonadParsec’ are now ordinary
functions and live in ‘Text.Megaparsec’. They are defined in terms of the
new ‘parseError’ method of ‘MonadParsec’. This method allows us to signal
parse errors at a given offset without manipulating parser state manually.
2019-11-05 14:18:55 +01:00
mrkkrp
87d425759a Simplify type signatures of ‘reachOffset’ and ‘reachOffsetNoLine’
Changed type signatures of ‘reachOffset’ and ‘reachOffsetNoLine’ methods of
the ‘Stream’ type class. Instead of three-tuple ‘reachOffset’ now returns
two-tuple because ‘SourcePos’ is already contained in the returned
‘PosState’ record.
2019-07-13 17:37:46 +02:00
mrkkrp
de4fddad7a
Use the word “present” instead of current year in copyright notes
[skip ci]
2019-07-02 21:41:24 +02:00
mrkkrp
b83f1b1e34
Update copyright years
[skip ci]
2019-01-01 12:50:48 +07:00
mrkkrp
b200b09830
Numerous documentation corrections 2018-11-07 12:21:00 +07:00
mrkkrp
e556853725
Drop ‘liftM’ 2018-10-26 20:07:46 +07:00
mrkkrp
b0335b6946
Misc improvements in the docs 2018-09-05 02:24:28 +07:00
Mark Karpov
e3072661ad
Optimize ‘reachOffset’, introduce ‘reachOffsetNoLine’ (#318)
Fetching line makes for a major slow-down, we cannot afford this.
2018-08-31 22:20:35 +07:00
Mark Karpov
573bacf721
Use offset in parse errors (#313)
The change allows to speed-up parsers in most cases and re-use the fact that
we're traversing input stream on pretty-printing ‘ParseError’s anyway.
2018-08-20 23:35:10 +07:00
Mark Karpov
4ea6a01896
Introduce parse error bundle (#306)
* Introduce parse error bundle

* Update the changelog (parse error bundle)
2018-07-15 20:01:35 +07:00
mrkkrp
3d4c22a71c
Inline more 2018-05-01 14:23:52 +07:00
mrkkrp
a2175ea6db
Apply hlint recommendations 2018-04-30 21:32:58 +07:00
mrkkrp
7120bae9b2
Drop stacks of source positions 2018-04-20 19:24:05 +07:00
mrkkrp
cdbbe5c3d0
Move ‘dbg’ into a separate module 2018-04-20 14:20:43 +07:00
mrkkrp
2d175cd706
Drop support for GHC 7.8 2018-04-20 13:07:16 +07:00
mrkkrp
370f869d64 Add a note about monadic vs applicative combinators 2018-03-27 22:21:31 +07:00
Mark Karpov
e3ce90bd73 Add ‘Text.Megaparsec.Internal’ (#288) 2018-03-27 22:02:24 +07:00
Mark Karpov
fd7f214e54
Enable more warnings (#285) 2018-03-21 17:25:26 +07:00
Mark Karpov
adce847803 Fix backtracking of exponent and fractional parts in numeric helpers (#279)
‘scientific’ now correctly backtracks after attempting to parse fractional
and exponent parts of a number. ‘float’ correctly backtracks after
attempting to parse optional exponent part (when it comes after fractional
part, otherwise it's obligatory).
2018-03-04 20:34:48 +07:00
Mark Karpov
4fac009b48
Move general-enough combinators to ‘Text.Megaparsec’ (#267) 2018-01-08 22:39:39 +07:00
mrkkrp
cb762351d0 Include 2018 into the copyright years range
[skip ci]
2018-01-01 14:04:07 +07:00
mrkkrp
966768acbe Promote ‘Control.Monad.Combinators.NonEmpty’ in the docs
[skip ci]
2017-12-31 16:05:56 +07:00
Mark Karpov
c776fc16fb Use parser combinators 0.4.0 (#269) 2017-12-31 16:02:03 +07:00
Mark Karpov
d3e29619cc
Simplify the type of the ‘token’ primitive (#266) 2017-12-17 22:03:03 +07:00
Mark Karpov
aee96cd519
Make ‘atEnd’ not produce hints (#264) 2017-12-17 13:03:56 +07:00
mrkkrp
3c0d961a7d Add ‘since’ notes to some instance declarations 2017-12-14 12:06:20 +07:00
mrkkrp
9ef762fef8 Minor corrections and a test for the last PR 2017-12-14 11:35:36 +07:00
Vladislav Zavialov
58ab67759f Add the 'customFailure' combinator (#260) 2017-12-14 11:20:04 +07:00
Vladislav Zavialov
576c29aefd Add an IsString instance and tests for it (#259) 2017-12-13 22:14:22 +07:00
mrkkrp
a69f955f75 Adjust documentation for the ‘Hints’ type 2017-12-09 11:40:34 +07:00
Mark Karpov
b99174d7f1 Make ‘sconcat’ more efficient on ‘ParsecT’ (#253)
* Make ‘sconcat’ more efficient on ‘ParsecT’

* Do the same thing for ‘mconcat’
2017-10-15 16:26:28 +07:00
mrkkrp
10c3d7b6cf Update per-argument docs of ‘tokens’
[skip ci]
2017-08-26 20:57:05 +07:00
Mark Karpov
e2abc9ee5d Use ‘eok’ continuation in ‘tokens’ when matching empty chunk (#246) 2017-08-14 17:46:59 +07:00
Mark Karpov
aac10c8bee Add hint erasing when try backtracks consuming (#243) 2017-08-08 16:36:47 +07:00
Profpatsch
c8ed8d0112 Clarify the difference between ‘pure’ and ‘empty’ 2017-08-08 15:05:38 +07:00
mrkkrp
390560f177 Add a note about ‘Control.Applicative.Combinators.NonEmpty’ 2017-07-30 23:14:08 +07:00
mrkkrp
dbc7f52daa Add a note about the ‘ParseError’ type 2017-07-28 11:28:16 +07:00
mrkkrp
a745b27f36 Documentation corrections and improvements 2017-07-25 16:45:15 +07:00
Mark Karpov
7cbab7c2ea Implement rendering of parse error context (#236) 2017-07-25 14:36:40 +07:00
Mark Karpov
214d1f2c18 Speed-up numeric parsers (#232) 2017-07-10 00:12:23 +07:00
mrkkrp
9e7b9aa7d5 Rename ‘Text.Megaparsec.Lexer’ to ‘Text.Megaparsec.Char.Lexer’
Also numerous documentation improvements and some inlineable pragmas.
2017-07-04 17:12:35 +07:00
mrkkrp
dfdabe54e1 Add ‘takeP’, ‘takeRest’, and ‘atEnd’ 2017-07-03 23:10:22 +07:00