Copyright | Bryan O'Sullivan 2007-2015 |
---|---|
License | BSD3 |
Maintainer | bos@serpentine.com |
Stability | experimental |
Portability | unknown |
Safe Haskell | None |
Language | Haskell2010 |
Simple, efficient parser combinators for strings, loosely based on the Parsec library.
Documentation
The core parser type. This is parameterised over the type
i
of string being processed.
This type is an instance of the following classes:
-
Monad
, wherefail
throws an exception (i.e. fails) with an error message. -
Functor
andApplicative
, which follow the usual definitions. -
MonadPlus
, wheremzero
fails (with no error message) andmplus
executes the right-hand parser if the left-hand one fails. When the parser on the right executes, the input is reset to the same state as the parser on the left started with. (In other words, attoparsec is a backtracking parser that supports arbitrary lookahead.) -
Alternative
, which followsMonadPlus
.
Instances
Monad ( Parser i) Source # | |
Functor ( Parser i) Source # | |
MonadFail ( Parser i) Source # | |
a ~ Text => IsString ( Parser a) Source # | |
Defined in Data.Attoparsec.Text.Internal fromString :: String -> Parser a Source # |
|
a ~ ByteString => IsString ( Parser a) Source # | |
Defined in Data.Attoparsec.ByteString.Char8 fromString :: String -> Parser a Source # |
|
Applicative ( Parser i) Source # | |
Defined in Data.Attoparsec.Internal.Types |
|
Alternative ( Parser i) Source # | |
MonadPlus ( Parser i) Source # | |
Semigroup ( Parser i a) Source # | |
Monoid ( Parser i a) Source # | |
The result of a parse. This is parameterised over the type
i
of string that was processed.
This type is an instance of
Functor
, where
fmap
transforms the
value in a
Done
result.
Fail i [ String ] String |
The parse failed. The
|
Partial (i -> IResult i r) |
Supply this continuation with more input so that the parser can resume. To indicate that no more input is available, pass an empty string to the continuation.
Note
: if you get a
|
Done i r |
The parse succeeded. The
|
class Monoid c => Chunk c where Source #
A common interface for input chunks.
chunkElemToChar :: c -> ChunkElem c -> Char Source #
Map an element to the corresponding character. The first argument is ignored.
Instances
Chunk ByteString Source # | |
Defined in Data.Attoparsec.Internal.Types type ChunkElem ByteString Source # nullChunk :: ByteString -> Bool Source # pappendChunk :: State ByteString -> ByteString -> State ByteString Source # atBufferEnd :: ByteString -> State ByteString -> Pos Source # bufferElemAt :: ByteString -> Pos -> State ByteString -> Maybe ( ChunkElem ByteString , Int ) Source # chunkElemToChar :: ByteString -> ChunkElem ByteString -> Char Source # |
|
Chunk Text Source # | |
Defined in Data.Attoparsec.Internal.Types |