- type TagParser str st = GenParser (Tag str) st
- satisfy :: (StringLike str, Show str) => (Tag str -> Bool) -> TagParser str st (Tag str)
- lexeme :: (Show str, StringLike str) => TagParser str st a -> TagParser str st a
- space :: (Show str, StringLike str) => TagParser str st (Tag str)
- whitespace :: (Show str, StringLike str) => TagParser str st ()
- anyTag :: (Show str, StringLike str) => TagParser str st (Tag str)
- anyTagOpen, anyTagClose :: (Show str, StringLike str) => TagParser str st (Tag str)
- tag :: forall st str rep. (StringLike str, Show str, TagRep rep) => rep -> TagParser str st (Tag str)
- tagOpen, tagClose :: (Show str, StringLike str) => str -> TagParser str st (Tag str)
- tagP :: forall rep str st a. (StringLike str, Show str, TagRep rep) => rep -> (Tag str -> TagParser str st a) -> TagParser str st a
- anyTagP :: (Show str, StringLike str) => (Tag str -> TagParser str st a) -> TagParser str st a
- tagText :: (Show str, StringLike str) => TagParser str st str
- oneOf, noneOf :: (Show str, StringLike str) => [Tag str] -> TagParser str st (Tag str)
Documentation
type TagParser str st = GenParser (Tag str) stSource
The type of Tag parsers, a synonym for GenParser (Tag str)
satisfy :: (StringLike str, Show str) => (Tag str -> Bool) -> TagParser str st (Tag str)Source
Parse a tag if it satisfies the predicate. As all the tag parsers, it consumes the whitespace immediately after the parsed tag.
lexeme :: (Show str, StringLike str) => TagParser str st a -> TagParser str st aSource
lexeme p
first applies parser p
and then whitespace
, returning the value of p
.
lexeme = (<* whitespace)
Every tag parser is defined using lexeme
, this way every parse starts at a point
without whitespace.
The only point where whitespace
should be called explicitly is at the start of
the top level parser, in order to skip any leading whitespace.
space :: (Show str, StringLike str) => TagParser str st (Tag str)Source
Parses a text block containing only characters which satisfy isSpace
.
whitespace :: (Show str, StringLike str) => TagParser str st ()Source
Parses any whitespace. Whitespace consists of zero or more ocurrences of space
.
anyTagOpen, anyTagClose :: (Show str, StringLike str) => TagParser str st (Tag str)Source
Parse any opening or closing tag. As all the tag parsers, these consume the whitespace immediately after the parsed tag.
tag :: forall st str rep. (StringLike str, Show str, TagRep rep) => rep -> TagParser str st (Tag str)Source
tag t
parses any tag for which (~== t)
is true.
tagOpen, tagClose :: (Show str, StringLike str) => str -> TagParser str st (Tag str)Source
Parse the given opening or closing tag As all the tag parsers, these consume the whitespace immediately after the parsed tag.
tagP :: forall rep str st a. (StringLike str, Show str, TagRep rep) => rep -> (Tag str -> TagParser str st a) -> TagParser str st aSource
The main workhorse.
tagP t p
parses an opening tag u
for which (~== t)
is true.
Then it runs the continuation parser p
.
Next it skips all the tags until the closing tag for u
.
Finally it returns the results of p
.
The p
parser should never consume the closing tag for u
, or tagP will fail.
anyTagP :: (Show str, StringLike str) => (Tag str -> TagParser str st a) -> TagParser str st aSource
Behaves like tagP
sans the predicate. Expects that the next tag will be an opening tag or fails otherwise.
tagText :: (Show str, StringLike str) => TagParser str st strSource
Parses a chunk of text. As all the tag parsers, it consumes the whitespace immediately after the parsed tag.