Text.Parsec.IndentParsec.Combinator
Description
Module containing combinators to parse some indentation based structures.
- blockOf :: (Monad m, Show t, Stream s (IndentT HaskellLike m) t) => IndentParsecT s u m a -> IndentParsecT s u m a
- foldedLinesOf :: (Monad m, Show t, Stream s (IndentT HaskellLike m) t) => IndentParsecT s u m a -> IndentParsecT s u m a
- between :: (Monad m, Indentation i, Show t, Show i, Stream s (IndentT i m) t) => GenIndentParsecT i s u m open -> GenIndentParsecT i s u m close -> GenIndentParsecT i s u m a -> GenIndentParsecT i s u m a
- betweenBlock :: (Monad m, Stream s (IndentT HaskellLike m) t, Show t) => IndentParsecT s u m open -> IndentParsecT s u m close -> IndentParsecT s u m a -> IndentParsecT s u m a
Documentation
blockOf :: (Monad m, Show t, Stream s (IndentT HaskellLike m) t) => IndentParsecT s u m a -> IndentParsecT s u m aSource
run a given parser inside a block.
foldedLinesOf :: (Monad m, Show t, Stream s (IndentT HaskellLike m) t) => IndentParsecT s u m a -> IndentParsecT s u m aSource
run a given parser inside a line fold.
Arguments
| :: (Monad m, Indentation i, Show t, Show i, Stream s (IndentT i m) t) | |
| => GenIndentParsecT i s u m open | the opening delimiter |
| -> GenIndentParsecT i s u m close | the closing delimiter |
| -> GenIndentParsecT i s u m a | the contents |
| -> GenIndentParsecT i s u m a |
Similar to . However, the
Text.Parsec.Combinator.between will not work as expected because
it will not turn off the indentation check of its input parser.
Text.Parsec.Combinator.between
So something like
whereClause = between lbrack rbrack bindings
lbrack = do char '{'; spaces
rbrack = do char '}'; spaces
will not be able to parse say
where {
a = 10
}
Use the version exported by this module instead.
Arguments
| :: (Monad m, Stream s (IndentT HaskellLike m) t, Show t) | |
| => IndentParsecT s u m open | opening delimitor |
| -> IndentParsecT s u m close | closing delimitor |
| -> IndentParsecT s u m a | the contents parser |
| -> IndentParsecT s u m a |
Similar to but if the opening and closing delimiters are
not given, uses a block to delimit the nesting. For example, a haskell
where clause will look like
between
whereClause = betweenBlock lbrack rbrack bindings
lbrack = do char '{'; spaces
rbrack = do char '}'; spaces