commonmark-0.2.5.1: Pure Haskell commonmark parser.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Commonmark.TokParsers

Synopsis

Documentation

satisfyTok :: Monad m => (Tok -> Bool) -> ParsecT [Tok] s m Tok Source #

Parses a single Tok satisfying a predicate.

satisfyWord :: Monad m => (Text -> Bool) -> ParsecT [Tok] s m Tok Source #

Parses a WordChars token matching a predicate.

anyTok :: Monad m => ParsecT [Tok] s m Tok Source #

Parses any Tok.

anySymbol :: Monad m => ParsecT [Tok] s m Tok Source #

Parses any Symbol Tok.

symbol :: Monad m => Char -> ParsecT [Tok] s m Tok Source #

Parses a Symbol with character c.

whitespace :: Monad m => ParsecT [Tok] s m [Tok] Source #

Parses one or more whitespace Toks.

lineEnd :: Monad m => ParsecT [Tok] s m Tok Source #

Parses a LineEnd token.

spaceTok :: Monad m => ParsecT [Tok] s m Tok Source #

Parses a Spaces token.

oneOfToks :: Monad m => [TokType] -> ParsecT [Tok] s m Tok Source #

Parses a Tok with one of the listed types.

noneOfToks :: Monad m => [TokType] -> ParsecT [Tok] s m Tok Source #

Parses a Tok with none of the listed types.

gobbleSpaces :: Monad m => Int -> ParsecT [Tok] u m Int Source #

Parses exactly n spaces. If tabs are encountered, they are split into spaces before being consumed; so a tab may be partially consumed by this parser.

gobbleUpToSpaces :: Monad m => Int -> ParsecT [Tok] u m Int Source #

Parses up to n spaces.

withRaw :: Monad m => ParsecT [Tok] s m a -> ParsecT [Tok] s m (a, [Tok]) Source #

Applies a parser and returns its value (if successful) plus a list of the raw tokens parsed.

hasType :: TokType -> Tok -> Bool Source #

Filters tokens of a certain type.

textIs :: (Text -> Bool) -> Tok -> Bool Source #

Filters tokens with certain contents.

blankLine :: Monad m => ParsecT [Tok] s m () Source #

Parse optional spaces and an endline.

restOfLine :: Monad m => ParsecT [Tok] s m [Tok] Source #

Efficiently parse the remaining tokens on a line, including the LineEnd (if any).

isOneOfCI :: [Text] -> Text -> Bool Source #

Case-insensitive membership in a list of Texts.

nonindentSpaces :: Monad m => ParsecT [Tok] u m () Source #

Gobble up to 3 spaces (may be part of a tab).

skipManyTill :: ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m () Source #

Apply p many times until stop succeeds, discarding results.

skipWhile :: Monad m => (Tok -> Bool) -> ParsecT [Tok] u m () Source #

Efficiently skip Toks satisfying a certain condition.