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 #

Parses a single `Tok` satisfying a predicate.

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

Parses a `WordChars` token matching a predicate.

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

Parses any `Tok`.

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

Parses any `Symbol` `Tok`.

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

Parses a `Symbol` with character `c`.

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

Parses one or more whitespace `Tok`s.

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

Parses a `LineEnd` token.

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

Parses a `Spaces` token.

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

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

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

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

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

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 #

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]) #

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

hasType :: TokType -> Tok -> Bool #

Filters tokens of a certain type.

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

Filters tokens with certain contents.

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

Parse optional spaces and an endline.

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

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

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

Case-insensitive membership in a list of `Text`s.

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

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 () #

Apply `p` many times until `stop` succeeds, discarding results.

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

Efficiently skip `Tok`s satisfying a certain condition.