Commit Graph

219 Commits

Author SHA1 Message Date
mrkkrp
5c27c218b2 Add more safety to the ‘categoryName’ function 2017-06-22 22:08:56 +07:00
Mark Karpov
3ec48d12b9 Reorganize modules (#217) 2017-06-15 02:12:18 +07:00
Mark Karpov
d35cdd2e33 Drop per-stream type modules (#215) 2017-06-13 23:14:31 +07:00
mrkkrp
ce7228346a Improve the documentation 2017-05-25 19:52:34 +07:00
mrkkrp
e651e689c3 Update my email address
[skip ci]
2017-05-24 19:30:10 +07:00
Mark Karpov
9453b9eda4 Define ‘Semigroup’ and ‘Monoid’ for ‘ParsecT’ (#203) 2017-04-29 23:34:18 +03:00
Mark Karpov
15b645f08e Add ‘getNextTokenPosition’ (#202) 2017-04-29 16:40:04 +03:00
mrkkrp
e87c1e770e Change “rest of” to “the rest of” 2017-04-10 19:59:51 +03:00
mrkkrp
95f99774dc Various minor corrections to the docs 2017-04-02 21:52:04 +03:00
Vladislav Zavialov
ae19a87cbf Make () an error component (#193) 2017-03-05 17:06:47 +04:00
Mark Karpov
8ed11716e7 Add the ‘region’ combinator (#192)
Close #187.
2017-03-03 03:45:38 +04:00
mrkkrp
44b6b960a0 Clarify the result of ‘updatePos’
Close #189.
2017-02-26 14:42:17 +03:00
mrkkrp
f021a86a1f Clarify the example in docs for ‘try’
Close #186.
2017-02-16 17:55:31 +03:00
Mark Karpov
e809c56b45 Implement the ‘match’ combinator (#184) 2017-02-06 22:31:10 +04:00
Mark Karpov
cb978200d5 Fix subtle ‘indentBlock’ bugs, add new tests (#182) 2017-02-01 20:03:02 +04:00
Mark Karpov
b307ba2342 Implement counting of processed tokens (#180) 2017-01-31 15:17:54 +04:00
Mark Karpov
63dcf13c09 Performance tweaks (#179)
* Use default implementation of ‘many’
* Improve ‘count’ and ‘count'’
* Update the ‘CHANGELOG.md’ file
2017-01-29 19:39:21 +04:00
mrkkrp
9459c8038b Include 2017 into copyright years range 2017-01-01 14:38:59 +03:00
Tomáš Janoušek
4147b2b103 Make indentBlock/IndentNone work with many like IndentMany/Some does (#161)
Even though the haddock for ‘Text.Megaparsec.Lexer.space’ says that

    Parsing of white space is an important part of any parser. We
    propose a convention where every lexeme parser assumes no spaces
    before the lexeme and consumes all spaces after the lexeme;

all the indentation-sensitive parsing combinators assume/consume whitespace
_before_ the thing to be parsed. This would normally mean they can't be used
with combinators like ‘many’ and ‘some’ without using ‘try’ (and sacrificing
performance). Fortunately ‘indentBlock’ also consumes whitespace _after_,
but unfortunately it didn't do that in the ‘IndentNone’ case. Now it does
and it works with many and some without try!
2016-12-28 02:12:57 +04:00
Mark Karpov
08d1ae8e61 Allow ‘many’ run parsers that do not consume input (#160) 2016-12-26 16:49:48 +04:00
mrkkrp
7505174218 Minor improvements in the docs of ‘Text.Megaparsec.Lexer’ module 2016-12-11 13:23:01 +03:00
mrkkrp
86cca77cf5 Update docs for ‘charLiteral’ to mention ‘\&’
Close #154.
2016-11-24 20:08:54 +03:00
Mark Karpov
dd2386aafc Add ‘MonadParsec’ instance for ‘RWST’ (#152) 2016-11-21 19:18:27 +04:00
Erik de Castro Lopo
56b72c8a68 Remove un-needed unsafeCoerce (#149)
`Pos` is a newtype wrapper around `Word` and the `unsafePos` function
is marked `INLINE`, so `unsafeCoerce` is complete overkill.
2016-10-10 12:29:40 +04:00
mrkkrp
e6c5c2beed Fix building with QuickCheck older than 2.9.0 2016-10-06 22:37:40 +03:00
mrkkrp
97257f3c7f Add the ‘observing’ primitive
Close #145.
2016-10-02 19:38:50 +03:00
mrkkrp
01f828e5dd Add debugging primitive ‘dbg’ 2016-09-30 13:34:58 +03:00
mrkkrp
4bc14d6668 Improve descriptions of backtracking primitives
Close #143.
2016-09-27 10:03:43 +03:00
mrkkrp
6772b88e93 Make ‘try’ truly backtrack parser state
Close #142.

This seemingly has no effect on performance.
2016-09-27 09:41:23 +03:00
mrkkrp
bd07032795 Fix the build 2016-09-25 18:42:21 +03:00
mrkkrp
6da7f86350 Migrate the test suite to Hspec 2016-09-24 19:32:50 +03:00
mrkkrp
e8174d4700 Add some ‘Arbitrary’ instances 2016-09-04 16:44:24 +03:00
mrkkrp
badec4a9df Expose the ‘parseErrorTextPretty’ function
Close #137.
2016-09-04 14:48:40 +03:00
mrkkrp
82994e45d4 Allow line comments end with end of input
Close #119.
2016-08-13 20:00:49 +03:00
mrkkrp
c4e1259cb9 Add a couple of articles into the docs 2016-08-13 19:22:33 +03:00
mrkkrp
38dd2112e3 Mention how to deal with case described in #129
Close #130.
2016-08-01 22:00:36 +03:00
mrkkrp
33098be1ea Define ‘displayException’ for ‘ParseError’ 2016-07-29 21:27:52 +03:00
mrkkrp
2a98741aba Inline ‘initialPos’ 2016-07-11 21:35:57 +03:00
mrkkrp
efe14cfa5f Derive ‘Data’, ‘Typeable’, ‘NFData’, for ‘State’ 2016-07-11 21:35:24 +03:00
mrkkrp
e24a78093f Derive ‘NFData’ for all data types in the library
Close #124.
2016-07-11 17:03:30 +03:00
Devon Hollowood
a803e3c68c Clarify error message for many parser
Close #122.
2016-07-09 13:25:59 +04:00
Daniel S. McCain
62ee63918c Add missing "to" to documentation 2016-06-24 14:00:26 +02:00
mrkkrp
7d47a7b8f9 Derive more ‘Data’ and ‘Typeable’ instances
Close #112. Derive ‘Data’ instance for ‘ParseError’, ‘Data’ and
‘Typeable’ instances for ‘SourcePos’.
2016-06-23 22:52:29 +03:00
mrkkrp
2062354709 Various corrections in ‘README.md’ and docs 2016-05-14 16:59:18 +07:00
mrkkrp
2a07087766 Initial implementation of line folding
Close #87.
2016-05-10 22:50:22 +07:00
mrkkrp
34f1f95294 Fix a typo ‘ManyIndent’ → ‘IndentMany’ 2016-05-04 16:42:10 +07:00
mrkkrp
3af8d25407 Improve handling of custom streams
This improves position reporting/advancing for ‘eof’, ‘token’, and
‘tokens’ combinators. Previously it was slightly incorrect for streams
consisting of custom token as new tests demonstrated.
2016-05-04 01:24:02 +07:00
mrkkrp
ae9ed355aa Inline functions in ‘Text.Megaparsec.Char’
This gives a nice speed up — not too surprising given size of the
functions, although it would be nice if GHC could figure this out by
itself too…
2016-05-02 01:00:59 +07:00
mrkkrp
f4f66222ec Improve performance of ‘(<*>)’
This handwritten version has proved to be more efficient from benchmarks
and profiling.
2016-05-02 00:59:58 +07:00
mrkkrp
df3b3016d5 Make ‘pToken’ lazier (position updating)
Evaluation of ‘npos’ is not necessary when we are going to report an
error. Similarly, evaluation of current position is not necessary when
we just need to get incremented position. This seemingly minor change
has profound impact on performance because call to ‘token’ function is
at the base of significant part of parsing process.
2016-05-02 00:53:42 +07:00