Safe Haskell | None |
---|---|
Language | Haskell2010 |
Compatibility module to bridge the gap between megaparsec-5 and megaparsec-6
Import this instead of Text.Megaparsec, Text.Megaparsec.Char and Text.Megaparsec.Text
- module Text.Megaparsec.Char
- module Text.Megaparsec
- type Parser = Parsec Dec Text
- type Dec = Void
- string :: MonadParsec e s m => Tokens s -> m (Tokens s)
- data CustomError e
- mkCustomError :: SourcePos -> e -> ParseError t (CustomError e)
- addCustomError :: Ord e => ParseError Char (CustomError e) -> e -> ParseError Char (CustomError e)
- parseWithStart :: (Stream s, Ord e) => Parsec e s a -> SourcePos -> s -> Either (ParseError (Token s) e) a
Re-exports
module Text.Megaparsec.Char
module Text.Megaparsec
Compatibility reimplementations
Custom error handling
data CustomError e Source #
Custom error type that mimics FancyError of megaparsec-6 but retains information about unexpected and expected tokens.
Eq e => Eq (CustomError e) Source # | |
Ord e => Ord (CustomError e) Source # | |
Show e => Show (CustomError e) Source # | |
ShowErrorComponent e => ShowErrorComponent (CustomError e) Source # | |
mkCustomError :: SourcePos -> e -> ParseError t (CustomError e) Source #
Wrap a custom error type into a ParseError
.
addCustomError :: Ord e => ParseError Char (CustomError e) -> e -> ParseError Char (CustomError e) Source #
Add a custom error to an already existing error.
This retains the original information such as expected and unexpected tokens as well as the source position.