This module defines our parsing monad. In the past there have been lazy and strict parsers in this module. Currently we have only the strict variant and it is used for parsing patch files.
- class Monad m => ParserM m where
- work :: (ByteString -> Maybe (a, ByteString)) -> m a
- maybeWork :: (ByteString -> Maybe (a, ByteString)) -> m (Maybe a)
- peekInput :: m ByteString
- alterInput :: ParserM m => (ByteString -> ByteString) -> m ()
- parseStrictly :: SM a -> ByteString -> Maybe (a, ByteString)
- lexChar :: ParserM m => Char -> m ()
- lexString :: ParserM m => String -> m ()
- lexStrings :: ParserM m => [String] -> m String
- lexEof :: ParserM m => m ()
- myLex :: ByteString -> Maybe (ByteString, ByteString)
Documentation
class Monad m => ParserM m whereSource
work :: (ByteString -> Maybe (a, ByteString)) -> m aSource
Applies a parsing function inside the ParserM
monad.
maybeWork :: (ByteString -> Maybe (a, ByteString)) -> m (Maybe a)Source
peekInput :: m ByteStringSource
Allows for the inspection of the input that is yet to be parsed.
ParserM SM |
alterInput :: ParserM m => (ByteString -> ByteString) -> m ()Source
Applies a function to the input stream and discards the result of the function.
parseStrictly :: SM a -> ByteString -> Maybe (a, ByteString)Source
parseStrictly
applies the parser functions to a string
and checks that each parser produced a result as it goes.
The strictness is in the ParserM
instance for SM
.
lexStrings :: ParserM m => [String] -> m StringSource
myLex :: ByteString -> Maybe (ByteString, ByteString)Source