sindre-0.1: A programming language for simple GUIs




Parser and definition of the dzen2-inspired formatting language used by Sindre. A format string is a sequence of commands changing drawing option parameters, and things to draw.



data Format Source

A formatting command is either a change to the drawing state, or a string to be printed at the current location.


Fg String

Draw text in the given colour.


Draw text in the default colour.

Bg String

Draw the background in the given colour.


Draw the background in the default colour.

Text Text

Draw the given string.

type FormatString = [Format]Source

A list of formatting commands, interpreted left-to-right.

textContents :: FormatString -> TextSource

The human-readable part of a format string, with formatting directives stripped.

startBg :: FormatString -> Maybe StringSource

The first background colour preceding any default background colour or text entry specified in the format string, if any.

parseFormatString :: Text -> Either String FormatStringSource

Parse a format string, returning either an error message or the result of the parse.

unparseFormatString :: FormatString -> TextSource

Prettyprint a FormatString to a string that, when parsed by parseFormatString, results in the original FormatString