list-t-html-parser-0.2.1.0: Streaming HTML parser

Safe HaskellNone
LanguageHaskell2010

ListT.HTMLParser

Contents

Synopsis

Documentation

data Parser m a Source

A backtracking HTML-tokens stream parser.

Instances

type Error = Maybe ErrorDetails Source

A possibly detailed parser error. When mzero or empty is used, an error value of Nothing is produced.

data ErrorDetails Source

Constructors

ErrorDetails_Message Text

A text message

ErrorDetails_UnexpectedToken

Unexpected token

ErrorDetails_EOI

End of input

run :: Monad m => Parser m a -> ListT m Token -> m (Either Error a) Source

Run a parser on a stream of HTML tokens, consuming only as many as needed.

Parsers

eoi :: Monad m => Parser m () Source

End of input.

token :: Monad m => Parser m Token Source

Any HTML token.

openingTag :: Monad m => Parser m OpeningTag Source

An opening tag.

closingTag :: Monad m => Parser m ClosingTag Source

A closing tag.

text :: Monad m => Parser m Text Source

A text between tags with HTML-entities decoded.

comment :: Monad m => Parser m Text Source

Contents of a comment.

Combinators

manyTill :: Monad m => Parser m a -> Parser m b -> Parser m ([a], b) Source

Apply a parser multiple times until another parser is satisfied. Returns results of both parsers.

skipTill :: Monad m => Parser m a -> Parser m a Source

Skip any tokens until the provided parser is satisfied.

total :: Monad m => Parser m a -> Parser m a Source

Greedily consume all the input until the end, while running the provided parser. Same as:

theParser <* eoi