Commit Graph

136 Commits

Author SHA1 Message Date
mrkkrp
c5bcdfb220 rewritten parsing of numbers, fixes #2 and #3
Changed how numbers are parsed because they were parsed in a naïf and
hairy way. Added tests for #2 and #3 (in old Parsec project these are
number 35 and 39 respectively).

* Since Haskell report doesn't say anything about sign, I've made
  ‘integer’ and ‘float’ parse numbers without sign.

* Removed ‘natural’ parser, it's equal to new ‘integer’ now.

* Renamed ‘naturalOrFloat’ → ‘number’ — this doesn't parse sign too.

* Added new combinator ‘signed’ to parse all sorts of signed numbers.

* For the sake of convenience I've added ‘integer'’, ‘float'’, and
 ‘number'’ combinators that also can parse signed numbers out of box.
2015-07-31 17:30:38 +06:00
mrkkrp
b19dae4315 improve efficiency of applicative interface 2015-07-31 01:50:36 +06:00
mrkkrp
b936e3c3a9 improved documentation, fixes #1 2015-07-31 00:36:54 +06:00
mrkkrp
773e9ccabe cosmetic changes in copyright (headers) 2015-07-30 22:20:37 +06:00
mrkkrp
e6f2379b22 refactoring, phase 3 2015-07-30 21:45:06 +06:00
mrkkrp
137ce0a521 refactoring, phase 2 2015-07-29 14:44:58 +06:00
mrkkrp
227667f829 refactoring, phase 1 2015-07-28 19:32:19 +06:00
Ben Pence
dd14602877 Fixes minor documentation inconsistency 2015-05-17 11:18:05 -07:00
Simon Vandel Sillesen
4aeaede85d Fix documentation for emptyDef not rendering 2015-04-15 19:01:53 +02:00
Antoine Latter
19a62ae80a Remove split-base conditional compilation option. 2015-03-21 20:40:02 -05:00
Antoine Latter
03242e474c Export 'runP' from Text.Parsec
Fixes #27.
2015-03-19 10:30:21 -04:00
Joel Williamson
6382eeec38 Fixed type of argument to char in examples
The examples for identStart and identLetter were calling `char "_"`. char should take a character literal, not a string.
2015-03-07 13:16:49 -05:00
Tal Walter
2b74642d7d Fixed a mistake (Applicative to Alternative) in the parserZero comments 2015-01-24 09:07:01 +02:00
cdepillabout
640cbdd306 Fixing spelling mistake in doc for chain function
Fix a small spelling mistake in the haskell doc for chainr1, chainl1, chainr, and chainl.
2015-01-11 01:32:00 +09:00
Antoine Latter
37d34b23eb Merge branch 'master' into 3.1.7_maint
Conflicts:
	parsec.cabal
2015-01-09 20:44:02 -06:00
Antoine Latter
355d8f2fc6 Fix module exports for Stream, Consumed, Reply, and State. 2015-01-09 20:33:05 -06:00
Daniel Gorin
3fb40aaa68 Add an Eq instance for ParseError 2014-11-03 16:30:21 +00:00
Slava Shklyaev
22ee53e06d Fix a typo 2014-10-29 19:36:12 +02:00
Emil Skoeldberg
ed944b4a96 Spelling fix. ('seperate' -> 'separate'). 2014-10-29 11:21:46 +00:00
Marios Titas
f7faa2a1af lookAhead: reset error messages on success 2014-09-24 20:33:15 -05:00
Antoine Latter
f4601acddf Revert "Track current position in the 'tokens' function"
This reverts commit 860764939c.

This fixes #9.
2014-09-24 19:43:08 -05:00
Antoine Latter
fd8ecf5d03 Fix off-by-one error in Token charControl.
Fixes #2.
2014-09-09 20:17:49 -05:00
Daniel Díaz
d98a576f5a Renamed 'anyNewline' to 'endOfLine' as suggested in #3 by @aslatter. 2014-05-19 13:48:37 +02:00
Daniel Díaz
9d962cc8fa Added parser for CRLF line breaks and a parser combining LF and CRLF line breaks. 2014-05-12 19:09:26 +02:00
Antoine Latter
0860144eff No more orphan 'Stream' instances.
The ByteString and Text instances for Stream now live in the
Prim module.
2014-04-09 15:01:24 -04:00
Roman Cheplyaka
860764939c Track current position in the 'tokens' function
Example

Before:

  Prelude Text.Parsec> parseTest (string "abcd") "abbe"
  parse error at (line 1, column 1):
  unexpected "b"
  expecting "abcd"

After:

  *Main> parseTest (string "abcd") "abbe"
  parse error at (line 1, column 3):
  unexpected "b"
  expecting "cd"

Before this patch, 'b' was reported to be found at 1:1, which is clearly not the
case. After this patch, we correctly report the location of the wrong token, and
also report missing tokens starting from that position.
2014-04-04 01:28:21 +03:00
Rogan Creswick
ec7d750987 moved Stream instance for lists from Text.Parsec.String into Text.Parsec.Prim and removed -fno-warn-orphans from String.hs pragma 2014-03-24 07:53:21 -07:00
Antoine Latter
b08ea2c40d Module 'prim' is now 'not home' for haddock links. 2014-03-23 20:08:26 -05:00
Antoine Latter
c3ff212653 Explicitly export symbols from 'Combinator' and 'Prim' from the main
module.
2014-03-23 20:07:39 -05:00
Antoine Latter
595f274140 Export 'text' instances from 'Text.Parsec'. 2014-03-23 20:07:14 -05:00
Antoine Latter
dac01599dd Fix some haddocks. 2014-03-23 20:06:48 -05:00
Bjorn Buckwalter
143e57454e Fix haddock module links. 2013-08-21 09:57:13 +00:00
Roman Cheplyaka
b8990ab042 When merging error messages, prefer known messages to unknown ones
This fixes a regression introduced by:

Sun Feb 20 18:24:22 EET 2011  Roman Cheplyaka <roma@ro-che.info>
  * Choose the longest match when merging error messages

The source of the regression is that parsec sometimes generates dummy (aka
"unknown") error messages when no actual error has occurred.

So, when merging errors, before simply looking at the positions we should check
if one of them is unknown and just ignore it.

Reported by Matthias Hörmann.
2012-05-30 22:38:09 +00:00
Roman Cheplyaka
1bac97f3b5 Documentation fix 2011-12-28 22:29:53 +00:00
Antoine Latter
b7fed21061 add Stream Text instances 2011-10-08 18:17:18 +00:00
Antoine Latter
43087fead0 Fix reserved name recognition for case-insensitive languages. 2011-10-08 18:04:54 +00:00
Roman Cheplyaka
383963979d lookAhead: do not consume input on success; update documentation 2011-02-20 16:29:20 +00:00
Roman Cheplyaka
eaf3a6de71 try: do not reset the error position 2011-02-20 16:24:49 +00:00
Roman Cheplyaka
0a10e27db4 Choose the longest match when merging error messages 2011-02-20 16:24:22 +00:00
Derek Elkins
eef48c8c17 Minor fix to the CPP and bump version. 2011-01-08 17:28:44 +00:00
Antoine Latter
32f608c83a remove dependency on package 'syb' 2010-09-08 05:37:47 +00:00
Antoine Latter
f234bc7353 Carry forward error messages when parsers don't consume input 2010-10-03 22:55:54 +00:00
Derek Elkins
2f4f4dba4a Fixing typos. 2010-09-27 23:19:05 +00:00
Derek Elkins
751ae41170 Generalize notFollowedBy 2010-03-04 03:45:53 +00:00
Antoine Latter
84e000211a add explicit export list to .Prim
This was derived from the haddock docs on Hackage.
2010-03-04 03:03:44 +00:00
Antoine Latter
5d6b3fabaa add documentation to new functions in .Prim 2010-03-04 03:03:27 +00:00
Antoine Latter
6e69c37546 another fix for many
allow many to return error-empty
2009-11-23 18:06:31 +00:00
Antoine Latter
299c257fa1 fix 'many'
Previously 'many' was not returning the last successful parse
2009-11-22 17:15:01 +00:00
Antoine Latter
a98a3ccbca move core data type over to CPS 2009-03-02 00:20:00 +00:00
Derek Elkins
200492f57c Documentation fix: typo in chainl1 2009-10-24 18:38:37 +00:00
kramer
e97a1f707f Make parsec syb friendly. 2008-12-26 08:29:54 +00:00
Derek Elkins
684cda921e Remove strictness in the return value. This violates the monad laws. Add note about user state strictness. 2009-02-14 22:28:22 +00:00
Derek Elkins
9b5b6d3bbe Add missing Postfix constructor in compatibility module. 2008-07-26 19:54:35 +00:00
Derek Elkins
79905e57bf Touch up haddock formatting 2008-03-06 01:25:31 +00:00
Derek Elkins
493f9d333f Minor -Wall clean-up 2008-03-06 01:20:54 +00:00
Derek Elkins
d3b3fa5427 Stream instances guidelines 2008-03-06 01:17:54 +00:00
aslatter
7cc71ef014 cleanud up/expanded compatability modules. 2008-02-17 03:53:24 +00:00
Derek Elkins
ce708e0972 Clean most warnings 2008-02-13 04:32:24 +00:00
aslatter
f549214afc A few mtl instances 2008-02-05 05:45:50 +00:00
aslatter
77fecf1829 missing case in parserPlus 2008-02-02 21:52:25 +00:00
aslatter
0793a4cf37 added a few language pragmas
GHCi 6.8.2 didn't seem to want to load the sources without these added pragmas
2008-02-02 20:14:50 +00:00
aslatter
34ea8270c9 no longer using .Unsafe bytestring packages 2008-02-02 20:09:47 +00:00
Derek Elkins
52e514ac82 Maintainer email in ParserCombinators sub-directory 2008-02-02 04:52:12 +00:00
Derek Elkins
7ae33dc94d Tweaking Text.Parsec.Token's documentation 2008-01-22 05:25:34 +00:00
Derek Elkins
a79e8e30fe Haddock documentation for Text.Parsec.Token 2008-01-22 05:14:30 +00:00
Derek Elkins
7b8b087f24 Minor whitespace change in Text.Parsec.Prim.hs 2008-01-22 05:13:24 +00:00
Derek Elkins
3eafd20e3f Haddock documentation for Text.Parsec.Pos and removed forcePos. 2008-01-22 04:16:19 +00:00
Derek Elkins
fdf1dbfded Haddock documentation for Text.Parsec.Language 2008-01-22 04:06:32 +00:00
Derek Elkins
c544a22461 Haddock documentation for Text.Parsec.Prim 2008-01-22 01:37:52 +00:00
Derek Elkins
ee69496c3b Fix some references in the Text.Parsec.Error documentation 2008-01-22 01:35:30 +00:00
Derek Elkins
92ed4bfbe3 Haddock documentation for Text.Parsec.String, Text.Parsec.ByteString, Text.Parsec.ByteString.Lazy and updated maintainer email 2008-01-20 06:59:14 +00:00
Derek Elkins
54b0f9ec3c Haddock documentation for Text.Parsec.Expr and dropped unused t type variable. 2008-01-20 06:43:50 +00:00
Derek Elkins
667aa50d75 More accurate extension pragmas 2008-01-20 06:39:18 +00:00
Derek Elkins
3f1095204e Haddock documentation for Text.Parsec.Error 2008-01-20 06:15:04 +00:00
Derek Elkins
8ea4b8982f Changing maintainer email 2008-01-20 04:44:41 +00:00
Derek Elkins
e603bdd4b6 Haddock documentation for Text.Parsec.Perm 2008-01-20 04:39:29 +00:00
Derek Elkins
1fa6a8edef Haddock documentation for Text.Parsec.Combinator 2008-01-20 04:38:22 +00:00
Derek Elkins
9094989b03 Haddock documentation for Text.Parsec.Char 2008-01-20 04:36:10 +00:00
Derek Elkins
d035996a3a Remove redundant comments 2008-01-19 22:12:20 +00:00
Derek Elkins
0d4457848a Fixed small but critical bug in manyAccum 2008-01-19 22:07:50 +00:00
Derek Elkins
4de1647cc5 Added Control.Applicative.Alternative instance 2008-01-19 22:06:33 +00:00
Derek Elkins
4cc1a98ba9 Added Control.Applicative instances 2008-01-13 23:54:41 +00:00
Derek Elkins
034c9fbbe9 Moved Parsec.ByteString.Lazy to the correct directory 2008-01-13 23:53:50 +00:00
Derek Elkins
a9a57d3254 Move Parsec.LazyByteString to Parsec.ByteString.Lazy 2008-01-13 23:06:02 +00:00
Derek Elkins
7b0ce9636a Made cabal buildable 2008-01-13 18:00:19 +00:00
Derek Elkins
93826a6007 Initial import 2008-01-13 17:53:15 +00:00