Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- withToken :: (Stream s, Monad m) => Maybe l -> (Maybe (Token s) -> ParserT l s e m a) -> ParserT l s e m a
- withChunk :: (Stream s, Monad m) => Maybe l -> Int -> (Maybe (Chunk s) -> ParserT l s e m a) -> ParserT l s e m a
- peekToken :: (Stream s, Monad m) => ParserT l s e m (Maybe (Token s))
- popToken :: (Stream s, Monad m) => ParserT l s e m (Maybe (Token s))
- peekChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Maybe (Chunk s))
- popChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Maybe (Chunk s))
- dropChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Maybe Int)
- isEnd :: (Stream s, Monad m) => ParserT l s e m Bool
- matchEnd :: (Stream s, Monad m) => ParserT l s e m ()
- anyToken :: (Stream s, Monad m) => ParserT l s e m (Token s)
- anyChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Chunk s)
- satisfyToken :: (Stream s, Monad m) => Maybe l -> (Token s -> Bool) -> ParserT l s e m (Token s)
- foldTokensWhile :: (Stream s, Monad m) => (Token s -> x -> (Bool, x)) -> x -> ParserT l s e m x
- takeTokensWhile :: (Stream s, Monad m) => (Token s -> Bool) -> ParserT l s e m (Chunk s)
- takeTokensWhile1 :: (Stream s, Monad m) => Maybe l -> (Token s -> Bool) -> ParserT l s e m (Chunk s)
- dropTokensWhile :: (Stream s, Monad m) => (Token s -> Bool) -> ParserT l s e m Int
- dropTokensWhile1 :: (Stream s, Monad m) => Maybe l -> (Token s -> Bool) -> ParserT l s e m Int
- matchToken :: (Stream s, Monad m, Eq (Token s)) => Token s -> ParserT l s e m (Token s)
- matchChunk :: (Stream s, Monad m, Eq (Chunk s)) => Chunk s -> ParserT l s e m (Chunk s)
Documentation
withToken :: (Stream s, Monad m) => Maybe l -> (Maybe (Token s) -> ParserT l s e m a) -> ParserT l s e m a Source #
Fetches the next token from the stream and runs the callback.
withChunk :: (Stream s, Monad m) => Maybe l -> Int -> (Maybe (Chunk s) -> ParserT l s e m a) -> ParserT l s e m a Source #
Fetches the next chunk from the stream and runs the callback.
peekToken :: (Stream s, Monad m) => ParserT l s e m (Maybe (Token s)) Source #
Return the next token, if any, but don't consume it. (SAFE)
popToken :: (Stream s, Monad m) => ParserT l s e m (Maybe (Token s)) Source #
Return the next token, if any, and consume it. (SAFE)
peekChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Maybe (Chunk s)) Source #
Return the next chunk of the given size, if any, but don't consume it. May return a smaller chunk at end of stream, but never returns an empty chunk. (SAFE)
popChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Maybe (Chunk s)) Source #
Return the next chunk of the given size, if any, and consume it. May return a smaller chunk at end of stream, but never returns an empty chunk. (SAFE)
dropChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Maybe Int) Source #
Drop the next chunk of the given size, if any, and consume it. May return a smaller size at end of stream, but never returns size 0. (SAFE)
matchEnd :: (Stream s, Monad m) => ParserT l s e m () Source #
Match the end of the stream or terminate the parser. (UNSAFE)
anyToken :: (Stream s, Monad m) => ParserT l s e m (Token s) Source #
Return the next token or terminate the parser at end of stream. (UNSAFE)
anyChunk :: (Stream s, Monad m) => Int -> ParserT l s e m (Chunk s) Source #
Return the next chunk of the given size or terminate the parser at end of stream. May return a smaller chunk at end of stream, but never returns an empty chunk. (UNSAFE)
satisfyToken :: (Stream s, Monad m) => Maybe l -> (Token s -> Bool) -> ParserT l s e m (Token s) Source #
Match the next token with the given predicate or terminate the parser at predicate false or end of stream. (UNSAFE)
foldTokensWhile :: (Stream s, Monad m) => (Token s -> x -> (Bool, x)) -> x -> ParserT l s e m x Source #
Folds over a stream of tokens while the boolean value is true. Always succeeds, even at end of stream. Only consumes greediest match. (SAFE)
takeTokensWhile :: (Stream s, Monad m) => (Token s -> Bool) -> ParserT l s e m (Chunk s) Source #
Take tokens into a chunk while they satisfy the given predicate. Always succeeds, even at end of stream. May return an empty chunk. Only yields greediest match. (SAFE)
takeTokensWhile1 :: (Stream s, Monad m) => Maybe l -> (Token s -> Bool) -> ParserT l s e m (Chunk s) Source #
Take tokens into a chunk while they satisfy the given predicate. Only succeeds if 1 or more tokens are taken, so it never returns an empty chunk. Also takes an optional label to describe the predicate. (UNSAFE)
dropTokensWhile :: (Stream s, Monad m) => (Token s -> Bool) -> ParserT l s e m Int Source #
Drop tokens and return chunk size while they satisfy the given predicate. Always succeeds, even at end of stream. May return empty chunk size 0. Only drops greediest match. (SAFE)
dropTokensWhile1 :: (Stream s, Monad m) => Maybe l -> (Token s -> Bool) -> ParserT l s e m Int Source #
Drop tokens and return chunk size while they satisfy the given predicate. Only succeeds if 1 or more tokens are dropped. Also takes an optional label to describe the predicate. (UNSAFE)