Commit Graph

438 Commits

Author SHA1 Message Date
mrkkrp
71c5033394 Fix a bug about indentation level of first item with ‘IndentSome’ 2017-07-26 14:48:29 +07:00
mrkkrp
2549544401 Fix a bug in ‘selectLine’ 2017-07-26 13:52:59 +07:00
mrkkrp
2a559aab34 Ensure that space consuming parser is hidden in ‘space’ (lexer) 2017-07-25 20:35:00 +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
9a38f8318e Minor corrections
[skip ci]
2017-07-05 17:58:32 +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
394d3fa456 Fix a bug in ‘char'’ 2017-07-04 13:23:33 +07:00
mrkkrp
dfdabe54e1 Add ‘takeP’, ‘takeRest’, and ‘atEnd’ 2017-07-03 23:10:22 +07:00
Mark Karpov
3b9812bf76 Char and byte modules (#230) 2017-07-03 18:34:00 +07:00
Mark Karpov
45f30ae7e1 Extending stream (#229) 2017-07-02 23:56:01 +07:00
Mark Karpov
785d006f02 Documentation improvements (#228)
[skip ci]
2017-06-30 00:16:24 +07:00
Roman Cheplyaka
0919338c4b Add a MonadFix ParsecT instance (#225) 2017-06-29 20:23:03 +07:00
Mark Karpov
bda5fc822a Move error construction helpers into the library (#224) 2017-06-29 18:33:47 +07:00
Mark Karpov
cec0987264 Separate trivial and fancy parse errors (#223) 2017-06-29 12:13:22 +07:00
Mark Karpov
5ed815fde4 Refactor pos and error modules (#222) 2017-06-28 14:08:26 +07:00
Mark Karpov
ca564d1113 Display control characters in strings nicely (#221) 2017-06-26 23:23:53 +07:00
mrkkrp
432d1722ce Link more functions in ‘Text.Megaparsec.Char’ 2017-06-22 22:37:19 +07:00
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
5a8d8f181a Update location of the tutorials 2017-06-08 17:33:14 +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
5aff6e3986 Mention ambiguous type variables and type signatures
Close #157.
2016-12-26 13:45:31 +03: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
d1649b63ad Export ‘observing’ from ‘Text.Megaparsec’ 2016-10-04 10:07:06 +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
Mark Karpov
735776519c Merge pull request #138 from mrkkrp/migrate-to-hspec
Re-write the tests with Hspec and more
2016-09-25 22:07:52 +04: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
be4478b840 Clarify behavior of ‘many’ and ‘some’
See #141.
2016-09-18 14:34:27 +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
Albert Krewinkel
c234586435 Reflect renaming of alphaNum in docs (#136)
The `alphaNum` parser was renamed to `alphaNumChar`, yet the docs
weren't full updated to reflect this change.
2016-08-27 16:44:55 +04: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
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
be3c1fe987 Derive ‘Read’ instance for ‘Dec’ 2016-04-24 20:19:48 +07:00
mrkkrp
495aa1bb87 Add ‘incorrectIndent’, improve indentation errors
Close #90.
2016-04-24 15:09:52 +07:00
mrkkrp
1ba128521f Make ‘tokens’ use “canonicalized” token streams
And introduce the notion in docs of ‘MessageItem’.
2016-04-23 22:31:09 +07:00
mrkkrp
dd0cf0fe4a Add one more argument to ‘token’
The new argument allows to specify what to report as expected token when
input stream happens to be empty.
2016-04-22 19:51:14 +07:00
mrkkrp
c0c9b836dd Fix a bug (hints assymetry with ‘<|>’) 2016-04-22 19:48:55 +07:00
mrkkrp
17a6bb2baa Remove ‘MonadThrow’ instance, add ‘Dec’
‘Dec’ stands for “default error component”. We need this because
‘String’ looses information and thus we cannot write good enough tests
with it.
2016-04-22 19:48:34 +07:00
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 #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
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
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
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
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 #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
3baa263eab Auto-backtracking for ‘tokens’ and friends 2016-02-17 23:32:48 +06:00
mrkkrp
3edbe9f54a Implement the recovery feature
Close #80.
2016-02-09 13:59:21 +06: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
e1be100bd6 Cosmetic whims
Can't help it…
2016-02-08 13:36:39 +06:00
mrkkrp
c2c33045cc Fix the build for older GHCs 2016-02-07 20:50:27 +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 #81.

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
9918dd5ad9 Add missing per-argument descriptions 2016-01-22 20:20:36 +06:00
mrkkrp
24b8e41af0 Remove non-informative phrases from docs
Parsec's legacy.
2016-01-22 13:00:58 +06:00
mrkkrp
c2f5504725 Fix a typo ‘ParserT’ → ‘ParsecT’ 2016-01-22 12:47:15 +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
6f102ce1fe Fix signature of ‘indentBlock’ 2016-01-09 23:21:04 +06:00
mrkkrp
e9bf0e1773 Specify in which version some functions were added 2016-01-09 19:12:22 +06:00
mrkkrp
e5508941c8 Add year 2016 to copyright notices 2016-01-09 18:56:33 +06:00
mrkkrp
bd85deb38c Finish new indentation-sensitive combinators 2016-01-09 17:38:31 +06:00
mrkkrp
8984f5823a Improved indentation-sensitive combinators
Close #54.

These should be good enough (according to manual testing). We'll need to
add automated testing to make sure, though.
2016-01-02 20:30:36 +06:00
mrkkrp
718b0f358a Don't use hints with custom error messages
Close #75.

Now accumulated hints are not used with ‘ParseError’ records that have
only custom messages in them (created with ‘Message’ constructor, as
opposed to ‘Unexpected’ or ‘Expected’). This strips “expected” line from
custom error messages where it's unlikely to be relevant anyway.
2016-01-02 20:19:40 +06:00
mrkkrp
028b775885 Use ‘const’ 2016-01-02 20:18:55 +06:00
mrkkrp
c73a2239b9 ‘readFromFile’ → ‘parseFromFile’ 2016-01-02 20:18:18 +06:00
mrkkrp
e94b39fc0d Initial design of new indentation-sensitive helpers 2016-01-01 23:00:38 +06:00
mrkkrp
f317936613 Cosmetic whims in ‘Text.Megaparsec.Lexer’ 2016-01-01 23:00:38 +06:00
mrkkrp
8ea4ebe606 improve rendering of ‘Message’s
Arbitrary messages created with ‘Message’ constructor should not be
rendered as “or”-separated list. This commit makes every such message be
displayed on new line.
2015-12-11 12:18:11 +06:00
Herbert Valerio Riedel
bc54b46d07 Canonicalise Applicative/Monad instances
This avoids subtle performance issues and makes the code more
future proof.
2015-11-22 19:03:46 +01:00
mrkkrp
c202151150 minor documentation improvements 2015-11-10 14:28:28 +06:00
mrkkrp
3bc781d270 minor improvements in ‘Text.Megaparsec.Combinator’ 2015-11-09 13:19:34 +06:00
mrkkrp
3d66a02eaf make source name in ‘SourcePos’ strict 2015-11-07 18:36:44 +06:00
mrkkrp
ac62addce8 cosmetic improvements 2015-11-07 16:24:45 +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
73042c28f3 fix build once again for older GHCs 2015-11-03 01:59:30 +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
9f6fc4844c correct error message signalled by ‘many’
Close #69.

Although previously used syntax is correct Haskell syntax for multi-line
string literals, CPP extension that we need to use for compatibility
reasons obviously makes ‘\’ symbol escape following newline character
that leads to ‘\t’ being interpreted as tab character.

The proposed solution just concatenates result error message from list
of strings — the most lightweight and reliable solution in our case.
2015-10-31 18:03:33 +06:00
mrkkrp
8c7de12ab7 rather fail loudly instead of silent correction 2015-10-30 21:40:22 +06:00
mrkkrp
c7ed5fe909 after some consulting, it should be “FreeBSD”
What Parsec used is called “FreeBSD” or “BSD 2 clause”. Addition of the
third clause may require contacting all the authors. To hell with it,
let it be “FreeBSD” (which is anyway better than “BSD-like”), I'm a
hacker, not a lawyer (tm).
2015-10-30 17:26:45 +06:00
mrkkrp
503a1db4be clarify used license and add missing clause
This commit clarifies license of the software replacing “BSD3” with more
conventional “BSD 3 clause”.

Another change is addition of the third clause originally missing in
license of Parsec (which is licensed under BSD 2 clause license). The
addition of the third clause in form:

* Neither the names of the copyright holders nor the names of
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

does not violate original BSD 2 clause license effectively making it BSD
3 clause license (which I find preferable).
2015-10-30 13:52:30 +06:00
mrkkrp
92d28bb7e8 allow ‘number’ be used with ‘signed’
Close #67.
2015-10-28 13:46:32 +06:00
mrkkrp
6aedfdbc79 removed deprecated combinators
Expression parser should be improved a bit now before 4.2.0 is released,
see #64.
2015-10-26 18:54:02 +06:00
mrkkrp
4e6dffd785 fix build for older GHCs 2015-10-26 14:06:15 +06:00
mrkkrp
354760202e introduced ‘failure’ method of ‘MonadParsec’
Close #43.

The method allows to fail with arbitrary collection of
messages. ‘unexpected’ is not defined in terms of ‘failure’. One
consequence of this design decision is that ‘failure’ is now method of
‘MonadParsec’, while ‘unexpected’ is not.
2015-10-26 13:52:21 +06:00
mrkkrp
c548226a1c map monad with ‘liftM’ for older GHCs 2015-10-26 02:20:25 +06:00
mrkkrp
a5819c6d00 allow to supply and extract parser state
Close #47, close #57.

This commit introduces ‘runParser'’ and ‘runParserT'’ functions that
take and return parser state. This makes it possible to partially parse
input, resume parsing, specify non-standard initial textual position,
etc.

Internal changes involve some refactoring to make ‘Reply’ more
readable and facilitate extraction of complete parser state on failure
as well as success.

The commit adds basic tests for the new functionality as well.
2015-10-26 02:13:39 +06:00
mrkkrp
ec6098c7ac various whims 2015-10-25 22:20:05 +06:00
mrkkrp
05177a6c3c make ‘ParseError’ instance of ‘Exception’
Close #66.
2015-10-24 11:24:13 +06:00