Commit Graph

450 Commits

Author SHA1 Message Date
mrkkrp
b8e3029041 Tests for new combinators and some refactoring 2016-01-09 17:55:54 +06:00
mrkkrp
bd85deb38c Finish new indentation-sensitive combinators 2016-01-09 17:38:31 +06:00
mrkkrp
618f5dbcb6 Updated ‘CHANGELOG.md’ to reflect changes in 4.3.0 2016-01-07 19:30:37 +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
25cfeefd07 Fix some typos in ‘README.md’ 2015-12-30 15:23:13 +06:00
mrkkrp
27f0b706b7 only use ‘-Werror’ on travis 2015-12-23 18:42:00 +06:00
mrkkrp
f699958d12 add ‘-Werror’ GHC option 2015-12-22 12:55:05 +06:00
mrkkrp
b6774d6d29 test newer GHC and container-based infrastructure 2015-12-17 00:11:10 +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
mrkkrp
3348d314cd fix a typo in ‘README.md’ 2015-11-24 15:02:17 +06:00
Mark Karpov
674be75746 Merge pull request #73 from hvr/pr/canonical-amp-instances
Canonicalise Applicative/Monad instances
2015-11-23 18:51:37 +05: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
fff87d05e8 include ‘README.md’ file in distribution 2015-11-04 13:19:21 +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
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
dd27063c03 added test to check how ‘newPos’ throws exceptions 2015-11-01 22:28:50 +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
1ce2a807d8 give Cabal something it can understand 2015-10-30 21:41:21 +06:00
mrkkrp
8c7de12ab7 rather fail loudly instead of silent correction 2015-10-30 21:40:22 +06:00
mrkkrp
f7f3b02e45 uppercase disclaimer in license
Otherwise it may look like “fine print” for some. Crazy…
2015-10-30 19:43:34 +06:00
mrkkrp
a54eab124a add “stackage nightly” badge 2015-10-30 17:53:04 +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
04634fdf10 restore Cabal's ability to parse ‘license’ field 2015-10-30 14:16:44 +06:00
mrkkrp
e374a7cc6a minor cosmetic corrections 2015-10-30 14:03:19 +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
aa11968514 tests: various improvements and corrections
Some cosmetic whims as well as new tests.
2015-10-28 17:51:35 +06:00
mrkkrp
92d28bb7e8 allow ‘number’ be used with ‘signed’
Close #67.
2015-10-28 13:46:32 +06:00
mrkkrp
5ad588710d remove ‘language: c’ from ‘.travis.yml’ 2015-10-27 14:56:57 +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
0472ab6ae5 bump version in Cabal file 2015-10-26 14:32:11 +06:00
mrkkrp
3807a5d56b minor corrections 2015-10-26 14:29:26 +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
a839a21ce4 more tests for ‘Text.Megaparsec.Prim’ module 2015-10-25 22:20:30 +06:00
mrkkrp
ec6098c7ac various whims 2015-10-25 22:20:05 +06:00
mrkkrp
5a7340f5bb a minor correction in test for ‘between’ 2015-10-24 15:29:48 +06:00
mrkkrp
05177a6c3c make ‘ParseError’ instance of ‘Exception’
Close #66.
2015-10-24 11:24:13 +06:00