Commit Graph

8 Commits

Author SHA1 Message Date
mrkkrp
455bfa3076 major improvements of ‘Text.Megaparsec.Prim’
* Removed ‘optionMaybe’ parser, because ‘optional’ from
  ‘Control.Applicative’ does the same thing.

* Renamed ‘tokenPrim’ → ‘token’, removed old ‘token’, because
  ‘tokenPrim’ is more general and ‘token’ is little used.

* Fixed bug with ‘notFollowedBy’ always succeeded with parsers that
  don't consume input, see #6.

* Hint system introduced that greatly improved quality of error messages
  and made code of ‘Text.Megaparsec.Prim’ a lot clearer.

The improvements affected other modules too:

* Some parsers from ‘Text.Megaparsec.Combinators’ now live in
  ‘Text.Megaparsec.Prim’.

* Hint system improved error messages, so I needed to rewrite test for
  ‘Text.Megaparsec.Char.eol’, since it's error messages are very
  intelligent now and cannot be emulated by ‘newline’ and ‘crlf’ parsers
  used separately.

* Test for Bug9 from old-tests is passed successfully again.
2015-08-17 21:58:59 +06:00
mrkkrp
287a777e6c cosmetic changes (indentation, etc) 2015-08-13 00:02:49 +06:00
mrkkrp
77a54394b5 extend collection of character parsers, close #16
Added new character parsers in ‘Text.Megaparsec.Char’:

* ‘controlChar’
* ‘printChar’
* ‘markChar’
* ‘numberChar’
* ‘punctuationChar’
* ‘symbolChar’
* ‘separatorChar’
* ‘asciiChar’
* ‘latin1Char’
* ‘charCategory’

Renamed some parsers:

‘spaces’   → ‘space’
‘space’    → ‘spaceChar’
‘lower’    → ‘lowerChar’
‘upper’    → ‘upperChar’
‘letter’   → ‘letterChar’
‘alphaNum’ → ‘alphaNumChar’
‘digit’    → ‘digitChar’
‘octDigit’ → ‘octDigitChar’
‘hexDigit’ → ‘hexDigitChar’

Descriptions of old parsers have been updated to accent some
Unicode-specific moments. For example, old description of ‘letter’
stated that it parses letters from “a” to “z” and from “A” to “Z”. This
is wrong, since it used ‘Data.Char.isAlpha’ predicate internally and
thus parsed many more characters.
2015-08-12 23:00:03 +06:00
mrkkrp
c13ca493ae experimental branch with different Messages 2015-08-11 18:15:02 +06:00
mrkkrp
da48d0c690 finished tests for ‘Text.Megaparsec.Char’ 2015-08-11 03:22:29 +06:00
mrkkrp
e890c715e2 refactoring, more tests for ‘Text.Megaparsec.Char’ 2015-08-09 00:42:47 +06:00
mrkkrp
ceb5d9bc16 some tests for ‘Text.Megaparsec.Char’ 2015-08-08 15:49:57 +06:00
mrkkrp
866bcdec58 some tests written 2015-08-03 13:19:23 +06:00