backend-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Ltml.Parser.Common.Indent

Description

Parsers and parser combinators for handling indented text.

They generally expect to be run at the start of an input line, after any indentation (ASCII spaces; usually after nli). (Compare how typical lexeme parser combinators are expected to be run after any whitespace.)

Synopsis

Documentation

nli :: MonadParser m => m Text Source #

Parse a newline character, any number of comment lines, and any subsequent indentation (ASCII spaces).

Comment lines are lines that only contain indentation followed by a line comment.

Always returns a single newline character.

someIndented :: MonadParser m => Maybe Pos -> m a -> m [a] Source #

Parse some (>= 1) items, all indented further than the provided reference indentation level, but not necessarily the same amount. For the first item, the indentation is not checked, and should thus be checked by the caller.

The argument parser must not accept the empty input and must only succeed after a final newline plus any trailing indentation.

checkIndentGT :: MonadParser m => Maybe Pos -> m () Source #

Check whether the current actual indentation is greater than the supplied reference indentation level.