| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Documentation.Haddock.Parser.Monad
- newtype ParserState = ParserState {}
- initialParserState :: ParserState
- newtype Parser a = Parser (StateT ParserState Parser a)
- parseOnly :: Parser a -> ByteString -> Either String (ParserState, a)
- lift :: Parser a -> Parser a
- setParserState :: ParserState -> Parser ()
- setSince :: Version -> Parser ()
- char :: Char -> Parser Char
- char8 :: Char -> Parser Word8
- anyChar :: Parser Char
- notChar :: Char -> Parser Char
- satisfy :: (Char -> Bool) -> Parser Char
- peekChar :: Parser (Maybe Char)
- peekChar' :: Parser Char
- digit :: Parser Char
- letter_iso8859_15 :: Parser Char
- letter_ascii :: Parser Char
- space :: Parser Char
- string :: ByteString -> Parser ByteString
- stringCI :: ByteString -> Parser ByteString
- skipSpace :: Parser ()
- skipWhile :: (Char -> Bool) -> Parser ()
- take :: Int -> Parser ByteString
- scan :: s -> (s -> Char -> Maybe s) -> Parser ByteString
- takeWhile :: (Char -> Bool) -> Parser ByteString
- takeWhile1 :: (Char -> Bool) -> Parser ByteString
- takeTill :: (Char -> Bool) -> Parser ByteString
- takeByteString :: Parser ByteString
- takeLazyByteString :: Parser ByteString
- endOfLine :: Parser ()
- decimal :: Integral a => Parser a
- hexadecimal :: (Integral a, Bits a) => Parser a
- endOfInput :: Parser ()
- atEnd :: Parser Bool
- isDigit :: Char -> Bool
- isDigit_w8 :: Word8 -> Bool
- isAlpha_iso8859_15 :: Char -> Bool
- isAlpha_ascii :: Char -> Bool
- isSpace :: Char -> Bool
- isSpace_w8 :: Word8 -> Bool
- inClass :: String -> Char -> Bool
- notInClass :: String -> Char -> Bool
- isEndOfLine :: Word8 -> Bool
- isHorizontalSpace :: Word8 -> Bool
- choice :: Alternative f => [f a] -> f a
- count :: Monad m => Int -> m a -> m [a]
- option :: Alternative f => a -> f a -> f a
- many' :: MonadPlus m => m a -> m [a]
- many1 :: Alternative f => f a -> f [a]
- many1' :: MonadPlus m => m a -> m [a]
- manyTill :: Alternative f => f a -> f b -> f [a]
- manyTill' :: MonadPlus m => m a -> m b -> m [a]
- sepBy :: Alternative f => f a -> f s -> f [a]
- sepBy' :: MonadPlus m => m a -> m s -> m [a]
- sepBy1 :: Alternative f => f a -> f s -> f [a]
- sepBy1' :: MonadPlus m => m a -> m s -> m [a]
- skipMany :: Alternative f => f a -> f ()
- skipMany1 :: Alternative f => f a -> f ()
- eitherP :: Alternative f => f a -> f b -> f (Either a b)
Documentation
Constructors
| Parser (StateT ParserState Parser a) |
parseOnly :: Parser a -> ByteString -> Either String (ParserState, a) Source #
setParserState :: ParserState -> Parser () Source #
string :: ByteString -> Parser ByteString Source #
stringCI :: ByteString -> Parser ByteString Source #
takeWhile1 :: (Char -> Bool) -> Parser ByteString Source #
endOfInput :: Parser () Source #
isDigit_w8 :: Word8 -> Bool Source #
A fast digit predicate.
isAlpha_iso8859_15 :: Char -> Bool Source #
A fast alphabetic predicate for the ISO-8859-15 encoding
Note: For all character encodings other than ISO-8859-15, and almost all Unicode code points above U+00A3, this predicate gives wrong answers.
isAlpha_ascii :: Char -> Bool Source #
A fast alphabetic predicate for the ASCII encoding
Note: For all character encodings other than ASCII, and almost all Unicode code points above U+007F, this predicate gives wrong answers.
isSpace :: Char -> Bool Source #
Fast predicate for matching ASCII space characters.
Note: This predicate only gives correct answers for the ASCII
encoding. For instance, it does not recognise U+00A0 (non-breaking
space) as a space character, even though it is a valid ISO-8859-15
byte. For a Unicode-aware and only slightly slower predicate,
use isSpace
inClass :: String -> Char -> Bool Source #
Match any character in a set.
vowel = inClass "aeiou"
Range notation is supported.
halfAlphabet = inClass "a-nA-N"
To add a literal '-' to a set, place it at the beginning or end of the string.
isEndOfLine :: Word8 -> Bool Source #
A predicate that matches either a carriage return '\r' or
newline '\n' character.
isHorizontalSpace :: Word8 -> Bool Source #
A predicate that matches either a space ' ' or horizontal tab
'\t' character.
choice :: Alternative f => [f a] -> f a Source #
choice ps tries to apply the actions in the list ps in order,
until one of them succeeds. Returns the value of the succeeding
action.
count :: Monad m => Int -> m a -> m [a] Source #
Apply the given action repeatedly, returning every result.
option :: Alternative f => a -> f a -> f a Source #
option x p tries to apply action p. If p fails without
consuming input, it returns the value x, otherwise the value
returned by p.
priority = option 0 (digitToInt <$> digit)
many' :: MonadPlus m => m a -> m [a] Source #
many' p applies the action p zero or more times. Returns a
list of the returned values of p. The value returned by p is
forced to WHNF.
word = many' letter
many1 :: Alternative f => f a -> f [a] Source #
many1 p applies the action p one or more times. Returns a
list of the returned values of p.
word = many1 letter
many1' :: MonadPlus m => m a -> m [a] Source #
many1' p applies the action p one or more times. Returns a
list of the returned values of p. The value returned by p is
forced to WHNF.
word = many1' letter
manyTill :: Alternative f => f a -> f b -> f [a] Source #
manyTill p end applies action p zero or more times until
action end succeeds, and returns the list of values returned by
p. This can be used to scan comments:
simpleComment = string "<!--" *> manyTill anyChar (string "-->")
(Note the overlapping parsers anyChar and string "-->".
While this will work, it is not very efficient, as it will cause a
lot of backtracking.)
manyTill' :: MonadPlus m => m a -> m b -> m [a] Source #
manyTill' p end applies action p zero or more times until
action end succeeds, and returns the list of values returned by
p. This can be used to scan comments:
simpleComment = string "<!--" *> manyTill' anyChar (string "-->")
(Note the overlapping parsers anyChar and string "-->".
While this will work, it is not very efficient, as it will cause a
lot of backtracking.)
The value returned by p is forced to WHNF.
sepBy :: Alternative f => f a -> f s -> f [a] Source #
sepBy p sep applies zero or more occurrences of p, separated
by sep. Returns a list of the values returned by p.
commaSep p = p `sepBy` (symbol ",")
sepBy' :: MonadPlus m => m a -> m s -> m [a] Source #
sepBy' p sep applies zero or more occurrences of p, separated
by sep. Returns a list of the values returned by p. The value
returned by p is forced to WHNF.
commaSep p = p `sepBy'` (symbol ",")
sepBy1 :: Alternative f => f a -> f s -> f [a] Source #
sepBy1 p sep applies one or more occurrences of p, separated
by sep. Returns a list of the values returned by p.
commaSep p = p `sepBy1` (symbol ",")
sepBy1' :: MonadPlus m => m a -> m s -> m [a] Source #
sepBy1' p sep applies one or more occurrences of p, separated
by sep. Returns a list of the values returned by p. The value
returned by p is forced to WHNF.
commaSep p = p `sepBy1'` (symbol ",")
skipMany :: Alternative f => f a -> f () Source #
Skip zero or more instances of an action.
skipMany1 :: Alternative f => f a -> f () Source #
Skip one or more instances of an action.
eitherP :: Alternative f => f a -> f b -> f (Either a b) Source #
Combine two alternatives.