commonmark-0.2.6.1: Pure Haskell commonmark parser.

Safe Haskell | None
Language | Haskell2010

Commonmark.TokParsers

Synopsis

- satisfyTok :: forall (m :: Type -> Type) s. Monad m => (Tok -> Bool) -> ParsecT [Tok] s m Tok
- satisfyWord :: forall (m :: Type -> Type) s. Monad m => (Text -> Bool) -> ParsecT [Tok] s m Tok
- anyTok :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok
- anySymbol :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok
- symbol :: forall (m :: Type -> Type) s. Monad m => Char -> ParsecT [Tok] s m Tok
- whitespace :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m [Tok]
- lineEnd :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok
- spaceTok :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok
- oneOfToks :: forall (m :: Type -> Type) s. Monad m => [TokType] -> ParsecT [Tok] s m Tok
- noneOfToks :: forall (m :: Type -> Type) s. Monad m => [TokType] -> ParsecT [Tok] s m Tok
- gobbleSpaces :: forall (m :: Type -> Type) u. Monad m => Int -> ParsecT [Tok] u m Int
- gobbleUpToSpaces :: forall (m :: Type -> Type) u. Monad m => Int -> ParsecT [Tok] u m Int
- withRaw :: forall (m :: Type -> Type) s a. Monad m => ParsecT [Tok] s m a -> ParsecT [Tok] s m (a, [Tok])
- hasType :: TokType -> Tok -> Bool
- textIs :: (Text -> Bool) -> Tok -> Bool
- blankLine :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m ()
- restOfLine :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m [Tok]
- isOneOfCI :: [Text] -> Text -> Bool
- nonindentSpaces :: forall (m :: Type -> Type) u. Monad m => ParsecT [Tok] u m ()
- skipManyTill :: forall s u (m :: Type -> Type) a b. ParsecT s u m a -> ParsecT s u m b -> ParsecT s u m ()
- skipWhile :: forall (m :: Type -> Type) u. Monad m => (Tok -> Bool) -> ParsecT [Tok] u m ()

# Documentation

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

Parses a single `Tok` satisfying a predicate.

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

Parses a `WordChars` token matching a predicate.

anyTok :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok Source #

Parses any `Tok`.

anySymbol :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok Source #

Parses any `Symbol` `Tok`.

symbol :: forall (m :: Type -> Type) s. Monad m => Char -> ParsecT [Tok] s m Tok Source #

Parses a `Symbol` with character `c`.

whitespace :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m [Tok] Source #

Parses one or more whitespace `Tok`s.

lineEnd :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok Source #

Parses a `LineEnd` token.

spaceTok :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m Tok Source #

Parses a `Spaces` token.

oneOfToks :: forall (m :: Type -> Type) s. Monad m => [TokType] -> ParsecT [Tok] s m Tok Source #

Parses a `Tok` with one of the listed types.

noneOfToks :: forall (m :: Type -> Type) s. Monad m => [TokType] -> ParsecT [Tok] s m Tok Source #

Parses a `Tok` with none of the listed types.

gobbleSpaces :: forall (m :: Type -> Type) u. 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 :: forall (m :: Type -> Type) u. Monad m => Int -> ParsecT [Tok] u m Int Source #

Parses up to `n` spaces.

withRaw :: forall (m :: Type -> Type) s a. 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 :: forall (m :: Type -> Type) s. Monad m => ParsecT [Tok] s m () Source #

Parse optional spaces and an endline.

restOfLine :: forall (m :: Type -> Type) s. 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 `Text`s.

nonindentSpaces :: forall (m :: Type -> Type) u. Monad m => ParsecT [Tok] u m () Source #

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

skipManyTill :: forall s u (m :: Type -> Type) a b. 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 :: forall (m :: Type -> Type) u. Monad m => (Tok -> Bool) -> ParsecT [Tok] u m () Source #

Efficiently skip `Tok`s satisfying a certain condition.