Copyright | © 2015–2018 Megaparsec contributors |
---|---|
License | FreeBSD |
Maintainer | Mark Karpov <markkarpov92@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
A set of helpers that should make construction of ParseError
s more
concise. This is primarily useful in test suites and for debugging, you
most certainly don't need it for normal usage.
Since: 6.0.0
- err :: NonEmpty SourcePos -> ET t -> ParseError t e
- errFancy :: NonEmpty SourcePos -> EF e -> ParseError t e
- posI :: NonEmpty SourcePos
- posN :: forall s. Stream s => Int -> s -> NonEmpty SourcePos
- utok :: Ord t => t -> ET t
- utoks :: Ord t => [t] -> ET t
- ulabel :: Ord t => String -> ET t
- ueof :: Ord t => ET t
- etok :: Ord t => t -> ET t
- etoks :: Ord t => [t] -> ET t
- elabel :: Ord t => String -> ET t
- eeof :: Ord t => ET t
- fancy :: ErrorFancy e -> EF e
- data ET t
- data EF e
Top-level helpers
:: NonEmpty SourcePos |
|
-> ET t | Error components |
-> ParseError t e | Resulting |
Assemble a ParseError
from source position and
value. To
create source position, two helpers are available: ET
tposI
and posN
.
is a monoid and can be assembled by combining primitives
provided by this module, see below.ET
t
:: NonEmpty SourcePos |
|
-> EF e | Error components |
-> ParseError t e | Resulting |
Like err
, but constructs a “fancy” ParseError
.
Error position
Error components
utoks :: Ord t => [t] -> ET t Source #
Construct an “unexpected tokens” error component. Empty string produces
EndOfInput
.
ulabel :: Ord t => String -> ET t Source #
Construct an “unexpected label” error component. Do not use with empty strings (for empty strings it's bottom).
etoks :: Ord t => [t] -> ET t Source #
Construct an “expected tokens” error component. Empty string produces
EndOfInput
.
elabel :: Ord t => String -> ET t Source #
Construct an “expected label” error component. Do not use with empty strings.
fancy :: ErrorFancy e -> EF e Source #
Construct a custom error component.
Data types
Auxiliary type for construction of trivial parse errors.