Commit Graph

12 Commits

Author SHA1 Message Date
mrkkrp
321b781e29 refresh values of “Portability” field
‘Text.Megaparsec.Prim’ cannot be considered portable since it uses
multi-parameter type classes and functional dependencies.

Other modules that depend on these non-portable features from
‘Text.Megaparsec.Prim’ should be considered non-portable too.
2015-09-27 14:46:12 +06:00
mrkkrp
1617f9b1b8 even more cosmetic corrections
Make details consistent and fix some minor cosmetic issues.
2015-09-23 19:46:24 +06:00
mrkkrp
3975ae52d0 cosmetic improvements, courtesy of @neongreen
Closes #37.

Most part of these changes is proposed by @neongreen. To apply precisely
what I deem acceptable, correct some of them in other way, and add some
other things, I've manually re-edited this.
2015-09-23 17:23:24 +06:00
mrkkrp
dcc53ad0b7 improved error messages for labelled ‘many’
Closes #35.

Since ‘many’ (and thus ‘some’) are the only combinator that can succeed
consuming input and produce hints at the same time we can conclude that
‘cok'’ continuation in ‘pLabel’ combinator is only called when ‘many’ is
labelled. By correcting label in this case prepending the phrase “rest
of ” to actual label we can greatly improve result error message.
2015-09-22 15:09:40 +06:00
mrkkrp
fce6c3187c eliminated user state and written ‘MonadParsec’
Close # 27.

Backtracking user state can be achieved via combination of ‘StateT’
monad transformer and ‘ParsecT’:

  StateT StateType (ParsecT s m a)

This user state can be more flexible. This fact renders current built-in
user state redundant.

To help work with this new approach (combining monad transformers more
freely) we introduce ‘MonadParsec’ MTL-style type class. All tools that
come with Megaparsec library were modified to work smoothly with any
instance of ‘MonadParsec’, not only ‘ParsecT’.
2015-09-18 15:33:44 +06:00
mrkkrp
ec3b5934f0 fix a typo (columns starts from 1) 2015-09-13 21:00:22 +06:00
mrkkrp
193d7ade07 fixed ‘skipLineComment’ and ‘skipBlockComment’
Multi-character staring/ending sequences should be wrapped with
‘try’. Also, ‘lookAhead’ should not be used in ‘skipBlockComment’.
2015-09-13 18:51:15 +06:00
mrkkrp
3de3f6965d make ‘hexadecimal’ and ‘octal’ more powerful
Various languages may vary in how hexadecimal and octal literals should
be prefixed. Following the spirit of the new lexer we leave this to
programmer to decide.
2015-09-09 14:15:39 +06:00
mrkkrp
7298c01387 first version of the new lexer module 2015-09-08 17:34:02 +06:00
mrkkrp
f58d5bfe1c further refinement 2015-09-06 15:23:12 +06:00
mrkkrp
b6a43c3335 started work on new lexer
Eliminated ‘Text.Megaparsec.Language’ module because at this point it is
clear that already existing definitions are of little use in
Megaparsec. I started writing “default” language definition in
‘Text.Megaparsec.Lexer’.

At this point it should be possible to parse languages where indentation
matters, although we will need to provide more helpers to make it
easier.
2015-09-06 15:23:12 +06:00
mrkkrp
2ca6316f33 renamed ‘Text.Megaparsec.Token’ module
Now it's called ‘Text.Megaparsec.Lexer’. This commit contains other
cosmetic changes as well.
2015-08-30 16:00:07 +06:00