Commit Graph

425 Commits

Author SHA1 Message Date
mrkkrp
e1be100bd6 Cosmetic whims
Can't help it…
2016-02-08 13:36:39 +06:00
Mark Karpov
fe9e4d736e Merge pull request #82 from mrkkrp/state-on-failure
Support getting actual parser state on failure
2016-02-08 11:49:17 +05:00
mrkkrp
2bfc724d8d Add tests for returned state on failure 2016-02-08 00:41:09 +06:00
mrkkrp
c2c33045cc Fix the build for older GHCs 2016-02-07 20:50:27 +06:00
mrkkrp
4ba5bd7df1 Update ‘CHANGELOG.md’ file 2016-02-07 19:58:41 +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
e5ad380832 Remove redundant mode annotations 2016-01-25 12:56:41 +06:00
mrkkrp
f0e11c3be4 Add section “Related packages” to ‘README.md’ 2016-01-24 20:57:04 +06:00
mrkkrp
9918dd5ad9 Add missing per-argument descriptions 2016-01-22 20:20:36 +06:00
mrkkrp
6830477a8d Add “Stackage LTS” badge 2016-01-22 13:12:22 +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
f69661a930 Drop some upper bounds (‘transformers’ and ‘text’) 2016-01-13 15:00: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
a8bd0e4b10 Add direct link to tutorials from ‘README.md’ 2016-01-10 13:54:33 +06:00
Mark Karpov
0cc4565dfb Merge pull request #77 from stackbuilders/update-stack-lts-4.0
Update stack to latest LTS 4.0
2016-01-10 00:29:28 +05:00
mrkkrp
6f102ce1fe Fix signature of ‘indentBlock’ 2016-01-09 23:21:04 +06:00
Justin Leitgeb
dfb119d2f9 Update stack to latest LTS 4.0 2016-01-09 09:13:36 -08:00
mrkkrp
c4b2489d77 Disable Haddock build for Cabal 1.16 2016-01-09 20:20:23 +06:00
mrkkrp
7f505384df Version bump (4.3.0) 2016-01-09 19:15:12 +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
108cf2e6ff Add Herbert Valerio Riedel to list of authors 2016-01-09 18:51:01 +06:00
Mark Karpov
61dc477eea Merge pull request #76 from mrkkrp/advanced-indent
Advanced combinators for indentation-sensitive parsing
2016-01-09 17:42:03 +05:00
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