tagsoup-megaparsec-0.1.0.0: A Tag token parser and Tag specific parsing combinators

Copyright© 2016 Kwang Yul Seo
LicenseBSD
MaintainerKwang Yul Seo <kwangyul.seo@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Text.Megaparsec.TagSoup

Contents

Description

Make Tags an instance of Stream with 'Tag str' token type.

Synopsis

Documentation

type TagParser str = Parsec [Tag str] Source #

Different modules corresponding to various types of streams (String, Text, ByteString) define it differently, so user can use “abstract” Parser type and easily change it by importing different “type modules”. This one is for TagSoup tags.

space :: (Show str, StringLike str, MonadParsec s m (Tag str)) => m (Tag str) Source #

Parses a text block containing only characters which satisfy isSpace.

whitespace :: (Show str, StringLike str, MonadParsec s m (Tag str)) => m () Source #

Parses any whitespace. Whitespace consists of zero or more ocurrences of space.

lexeme :: (Show str, StringLike str, MonadParsec s m (Tag str)) => m (Tag str) -> m (Tag str) Source #

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.

satisfy :: (Show str, StringLike str, MonadParsec s m (Tag str)) => (Tag str -> Bool) -> m (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.

anyTag :: (Show str, StringLike str, MonadParsec s m (Tag str)) => m (Tag str) Source #

Parses any tag. As all the tag parsers, it consumes the whitespace immediately after the parsed tag.

anyTagOpen :: (Show str, StringLike str, MonadParsec s m (Tag str)) => m (Tag str) Source #

Parse any opening tag. As all the tag parsers, it consumes the whitespace immediately after the parsed tag.

anyTagClose :: (Show str, StringLike str, MonadParsec s m (Tag str)) => m (Tag str) Source #

Parse any closing tag. As all the tag parsers, it consumes the whitespace immediately after the parsed tag.

tagText :: (Show str, StringLike str, MonadParsec s m (Tag str)) => m (Tag str) Source #

Parses a chunk of text. As all the tag parsers, it consumes the whitespace immediately after the parsed tag.

tagOpen :: (Show str, StringLike str, MonadParsec s m (Tag str)) => str -> m (Tag str) Source #

Parse the given opening tag. As all the tag parsers, these consume the whitespace immediately after the parsed tag.

tagClose :: (Show str, StringLike str, MonadParsec s m (Tag str)) => str -> m (Tag str) Source #

Parse the given closing tag. As all the tag parsers, these consume the whitespace immediately after the parsed tag.

Orphan instances

ShowToken (Tag str) => ShowToken [Tag str] Source # 

Methods

showToken :: [Tag str] -> String #

Show str => ShowToken (Tag str) Source # 

Methods

showToken :: Tag str -> String #