Commit Graph

567 Commits

Author SHA1 Message Date
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
mrkkrp
258dd2a0d4 add documentation for ‘StorableStream’ type class 2015-10-22 16:56:51 +06:00
mrkkrp
7043a6fbc0 move ‘parseFromFile’ to ‘Text.Megaparsec.Prim’
Close #65.

Previously we had 5 nearly identical definitions of the function,
varying only in type-specific ‘readFile’ function. Now the problem is
solved by introduction of ‘StorableStream’ type class. All supported
stream types are instances of the class out of box and thus we have
polymorphic version of ‘parseFromFile’.
2015-10-22 15:32:33 +06:00
mrkkrp
aad1702589 use ‘if’ instead of ‘bool’
This should make maintenance a bit easier. After all ‘if’ looks even
better than ‘bool’ in many cases.
2015-10-22 14:34:25 +06:00
mrkkrp
6cf7e918ce fix build for older versions of ‘base’ 2015-10-21 19:57:23 +06:00
mrkkrp
48528af655 various changes in ‘Text.Megaparsec.Error’
Close #62.

Apart from some refactoring, the following important changes were
introduced:

* ‘ParseError’ is now a monoid.

* Added functions ‘addErrorMessages’ and ‘newErrorMessages’.
2015-10-21 19:36:43 +06:00
mrkkrp
8356a05919 made interface of ‘Text.Megaparsec.Pos’ smarter
Now it's impossible to create ‘SourcePos’ with non-positive line number
or column number. Unfortunately we cannot use ‘Numeric.Natural’ because
we need to support older versions of ‘base’.
2015-10-21 17:33:29 +06:00
mrkkrp
bedad01d98 cosmetic improvements 2015-10-20 22:10:52 +06:00
mrkkrp
706e267295 run 1000 tests when testing locally 2015-10-20 17:09:08 +06:00
mrkkrp
84223f2947 fix failing tests for ‘sepEndBy’ and ‘sepEndBy1’ 2015-10-20 16:50:33 +06:00
mrkkrp
8dce9cdc5d bump version 2015-10-20 16:40:41 +06:00
mrkkrp
f3be336ebe fix implementation of ‘sepEndBy’ and ‘sepEndBy1’
Fixes #63.

Deprecation notes were removed and new tests written.
2015-10-20 16:37:24 +06:00
mrkkrp
a27dfa6229 minor cosmetic correction 2015-10-18 16:39:07 +06:00
mrkkrp
ef3223dc8a travis: fail if some functions are undocumented 2015-10-18 14:58:21 +06:00
mrkkrp
4d60e82be8 updated ‘README.md’ file
It seems like there won't be official Megaparsec tutorial for a
while. Also, the text is now written in such manner so it can be used on
Megaparsec site without any additional corrections.
2015-10-18 14:37:19 +06:00
mrkkrp
e6affc5a1c stack support 2015-10-17 19:25:10 +06:00
mrkkrp
cc22bc40a9 minor cosmetic corrections
Got a whim to re-indent text with Emacs ‘fill-paragraph’.
2015-10-17 14:06:10 +06:00
Mark Karpov
b93bedccf2 Merge pull request #60 from bkaestner/master
Improve README
2015-10-17 10:08:32 +05:00
Benjamin Kästner
8586ebf653 Add missing articles and fix some grammar
This commit mainly adds missing "a", "an" or "the", whenever something is used in singular, for example:

- user will see the label in error message
+ the user will see the label in the error message

In some cases, I've removed a word, for example "module" after `Text.Megaparsec.Char`, since it's clear you're talking about a module (otherwise "the" before the module name would be necessary).

This should provide a more fluid reading experience.
2015-10-16 22:44:36 +02:00
mrkkrp
3e5dc6d5a4 improve wording in doc-string for ‘charLiteral’ 2015-10-16 16:31:22 +06:00
mrkkrp
81b0081028 add missing ‘L.’ in doc-string of ‘signed’ 2015-10-16 15:57:46 +06:00
mrkkrp
9e1cac87b8 removed redundant labels in ‘Text.Megaparsec.Char’
This is handled by ‘showToken’ in ‘char’ anyway, so there is no need to
label these things manually.
2015-10-16 15:01:35 +06:00
mrkkrp
2b6df377ef a minor cosmetic change in ‘tests/Expr.hs’ 2015-10-16 00:01:15 +06:00
mrkkrp
79ceb7962f eliminate indentation in error messages
Indented text returned by ‘showMessages’ may be undesirable, but we
cannot add indentation outside of the function (edge case: strings
including newline are displayed in the messages).
2015-10-15 15:12:28 +06:00
mrkkrp
69eabcca37 bump version 4.1.0 2015-10-14 18:18:50 +06:00
mrkkrp
b062a397ee made format of error messages conventional
Closes #56.

In particular, file name and textual position are represented like this:

  filename.hs:5:6:
    error message

This format should be more conventional, so various tools will be able
to parse it and provide some support (for example, Emacs can work with
this format).
2015-10-14 17:48:44 +06:00
mrkkrp
fd56f0c82c shorten description of Megaparsec in ‘.cabal’ file 2015-10-10 20:48:23 +06:00
mrkkrp
a9421728d6 typos and corrections 2015-10-10 20:45:27 +06:00
mrkkrp
e954316804 updated ‘README.md’ file 2015-10-10 20:14:48 +06:00
mrkkrp
a70e07a408 do not export ‘Consumed’ and ‘Reply’
‘Text.Megaparsec’ and ‘Text.Megaparsec.Prim’ do not export these data
types and their constructors anymore. These data types are rather
low-level implementation detail that should not be visible to
end-user. They are also subject to certain changes in future.
2015-10-06 22:36:59 +06:00
mrkkrp
f0874ae8ad a couple of cosmetic corrections 2015-10-05 00:27:34 +06:00
mrkkrp
1d0e390593 fixed test for ‘Text.Megaparsec.Char.string'’
Closes #52.

Also added one new test for that function. The test is courtesy of
Benjamin Kästner (@bkaestner).
2015-10-05 00:10:59 +06:00
mrkkrp
17ba4fb4ee update changelog (GHC 7.6 is supported now) 2015-10-04 21:09:01 +06:00
mrkkrp
5f83b40631 make Travis CI build Megaparsec with GHC 7.6.x
There are some problems with HPC in GHC 7.6.x, so we don't measure code
coverage.
2015-10-04 20:49:42 +06:00