LLVM M.D.Source codeContentsIndex
MD.Parser.Parsec.Prim
MaintainerPaul Govereau <govereau@cs.harvard.edu>
Contents
Primitive Parsers
Primitive Parser Transformers
Moving between parser states
Augmenting error messages
Special transformers
Description
A modified version of the Parsec library. This version uses a lazy byte string as a source for parsing, and supports the untry combinator.
Synopsis
data Parser st a
data SourcePos
getPosition :: Parser st SourcePos
setPosition :: SourcePos -> Parser st ()
runParser :: Parser st a -> st -> LBS -> Either ParseError a
runParser' :: Parser st a -> st -> LBS -> Either ParseError (a, LBS)
runParserIO :: Parser st a -> st -> LBS -> IO a
runParserIO' :: Parser st a -> st -> LBS -> IO (a, LBS)
tokenPrim :: Bool -> (Word8 -> Maybe a) -> Parser st a
tokens :: Bool -> [Word8] -> Parser st [Word8]
fetch :: Int64 -> Parser st LBS
skip :: Int64 -> Parser st ()
align :: Int64 -> Parser st ()
unexpected :: String -> Parser st a
try :: Parser st a -> Parser st a
untry :: Parser st a -> Parser st a
look :: Parser st a -> Parser st a
onEmpty :: Parser st a -> Parser st a -> Parser st a
onFail :: Parser st a -> Parser st a -> Parser st a
label :: String -> Parser st a -> Parser st a
labels :: [String] -> Parser st a -> Parser st a
manyAccum :: (a -> [a] -> [a]) -> Parser st a -> Parser st [a]
limit :: Int64 -> Parser st a -> Parser st a
limitSkip :: Int64 -> Parser st a -> Parser st a
Documentation
data Parser st a Source
show/hide Instances
MonadWriter ParseError (Parser st)
MonadState st (Parser st)
Monad (Parser st)
Functor (Parser st)
MonadPlus (Parser st)
data SourcePos Source
show/hide Instances
getPosition :: Parser st SourcePosSource
setPosition :: SourcePos -> Parser st ()Source
runParser :: Parser st a -> st -> LBS -> Either ParseError aSource
runParser' :: Parser st a -> st -> LBS -> Either ParseError (a, LBS)Source
runParserIO :: Parser st a -> st -> LBS -> IO aSource
runParserIO' :: Parser st a -> st -> LBS -> IO (a, LBS)Source
Primitive Parsers
tokenPrim :: Bool -> (Word8 -> Maybe a) -> Parser st aSource
tokens :: Bool -> [Word8] -> Parser st [Word8]Source
fetch :: Int64 -> Parser st LBSSource
Fetch a number of words from the input stream.
skip :: Int64 -> Parser st ()Source
Skips the given number of words.
align :: Int64 -> Parser st ()Source
Align the the given byte boundry
unexpected :: String -> Parser st aSource
An alternatives to fail that sets the unexpected message rather than the user message.
Primitive Parser Transformers
Moving between parser states
try :: Parser st a -> Parser st aSource
untry :: Parser st a -> Parser st aSource
look :: Parser st a -> Parser st aSource
onEmpty :: Parser st a -> Parser st a -> Parser st aSource
A call to onEmpty a b will run parser a, and only run parser b if a results in a successful but empty parse. That is, a is successful and did not consume any input.
onFail :: Parser st a -> Parser st a -> Parser st aSource
Augmenting error messages
label :: String -> Parser st a -> Parser st aSource
labels :: [String] -> Parser st a -> Parser st aSource
Special transformers
manyAccum :: (a -> [a] -> [a]) -> Parser st a -> Parser st [a]Source
Will fail on empty.
limit :: Int64 -> Parser st a -> Parser st aSource
Limits the number of words that can be consumed by a parser.
limitSkip :: Int64 -> Parser st a -> Parser st aSource
Produced by Haddock version 2.6.0