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.
Since: 6.0.0
Synopsis
- err :: Int -> ET s -> ParseError s e
- errFancy :: Int -> EF e -> ParseError s e
- utok :: Stream s => Token s -> ET s
- utoks :: forall s. Stream s => Tokens s -> ET s
- ulabel :: Stream s => String -> ET s
- ueof :: Stream s => ET s
- etok :: Stream s => Token s -> ET s
- etoks :: forall s. Stream s => Tokens s -> ET s
- elabel :: Stream s => String -> ET s
- eeof :: Stream s => ET s
- fancy :: ErrorFancy e -> EF e
- data ET s
- data EF e
Top-level helpers
:: Int |
|
-> ET s | Error components |
-> ParseError s e | Resulting |
Assemble a ParseError
from offset and
value. ET
t
is a
monoid and can be assembled by combining primitives provided by this
module, see below.ET
t
:: Int |
|
-> EF e | Error components |
-> ParseError s e | Resulting |
Like err
, but constructs a “fancy” ParseError
.
Error components
utoks :: forall s. Stream s => Tokens s -> ET s Source #
Construct an “unexpected tokens” error component. Empty chunk produces
EndOfInput
.
ulabel :: Stream s => String -> ET s Source #
Construct an “unexpected label” error component. Do not use with empty strings (for empty strings it's bottom).
etoks :: forall s. Stream s => Tokens s -> ET s Source #
Construct an “expected tokens” error component. Empty chunk produces
EndOfInput
.
elabel :: Stream s => String -> ET s 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.
Instances
Eq (Token s) => Eq (ET s) Source # | |
(Data s, Data (Token s), Ord (Token s)) => Data (ET s) Source # | |
Defined in Text.Megaparsec.Error.Builder gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ET s -> c (ET s) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (ET s) # dataTypeOf :: ET s -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (ET s)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (ET s)) # gmapT :: (forall b. Data b => b -> b) -> ET s -> ET s # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ET s -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ET s -> r # gmapQ :: (forall d. Data d => d -> u) -> ET s -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ET s -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ET s -> m (ET s) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ET s -> m (ET s) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ET s -> m (ET s) # | |
Ord (Token s) => Ord (ET s) Source # | |
Generic (ET s) Source # | |
Stream s => Semigroup (ET s) Source # | |
Stream s => Monoid (ET s) Source # | |
type Rep (ET s) Source # | |
Defined in Text.Megaparsec.Error.Builder type Rep (ET s) = D1 (MetaData "ET" "Text.Megaparsec.Error.Builder" "megaparsec-7.0.3-33us1Wj7Xo51sKKEffQvN7" False) (C1 (MetaCons "ET" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe (ErrorItem (Token s)))) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set (ErrorItem (Token s)))))) |
Auxiliary type for construction of fancy parse errors.
Instances
Eq e => Eq (EF e) Source # | |
(Data e, Ord e) => Data (EF e) Source # | |
Defined in Text.Megaparsec.Error.Builder gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EF e -> c (EF e) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (EF e) # dataTypeOf :: EF e -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (EF e)) # dataCast2 :: Typeable t => (forall d e0. (Data d, Data e0) => c (t d e0)) -> Maybe (c (EF e)) # gmapT :: (forall b. Data b => b -> b) -> EF e -> EF e # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EF e -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EF e -> r # gmapQ :: (forall d. Data d => d -> u) -> EF e -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EF e -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EF e -> m (EF e) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EF e -> m (EF e) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EF e -> m (EF e) # | |
Ord e => Ord (EF e) Source # | |
Generic (EF e) Source # | |
Ord e => Semigroup (EF e) Source # | |
Ord e => Monoid (EF e) Source # | |
type Rep (EF e) Source # | |
Defined in Text.Megaparsec.Error.Builder type Rep (EF e) = D1 (MetaData "EF" "Text.Megaparsec.Error.Builder" "megaparsec-7.0.3-33us1Wj7Xo51sKKEffQvN7" True) (C1 (MetaCons "EF" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Set (ErrorFancy e))))) |