cadenza / org.intelligence.pretty / Pretty

Pretty

class Pretty

Constructors

<init>

Pretty(maxWidth: W = DEFAULT_MAX_WIDTH, maxRibbon: W = DEFAULT_MAX_RIBBON, nesting: W = 0, isFlat: Boolean = false, canFail: Boolean = false, format: Format = Format.default, curLineLen: W = 0, output: MutableList<Out> = mutableListOf())

Properties

canFail

var canFail: Boolean

curLineLen

var curLineLen: W

emWidth

val emWidth: W

format

var format: Format

hardLine

val hardLine: Unit

isFlat

var isFlat: Boolean

maxRibbon

var maxRibbon: W

maxWidth

var maxWidth: W

nesting

var nesting: W

newline

val newline: Unit

output

var output: MutableList<Out>

space

val space: Unit

spaceWidth

val spaceWidth: W

Functions

char

fun char(c: Char): Unit

measureText

fun measureText(s: String): W

space

fun space(w: W): Unit

tell

fun tell(a: Out): Boolean

text

fun text(t: CharSequence): Unit

Companion Object Properties

DEFAULT_MAX_RIBBON

const val DEFAULT_MAX_RIBBON: Int

DEFAULT_MAX_WIDTH

const val DEFAULT_MAX_WIDTH: Int

Companion Object Functions

doc

fun doc(x: Doc): Doc

out

fun Ansi.out(s: Out): Ansi

pp

fun pp(maxWidth: W = DEFAULT_MAX_WIDTH, maxRibbon: W = DEFAULT_MAX_RIBBON, doc: Doc): Unit

ppString

fun ppString(maxWidth: W = DEFAULT_MAX_WIDTH, maxRibbon: W = DEFAULT_MAX_RIBBON, doc: Doc): String

prep

fun prep(maxWidth: W = DEFAULT_MAX_WIDTH, maxRibbon: W = DEFAULT_MAX_RIBBON, doc: Doc): Out

Extension Functions

align

fun <A> Pretty.align(body: D<A>): A

annotate

fun <A> Pretty.annotate(ann: Ann, body: D<A>): A

bg

fun <A> Pretty.bg(color: Color, bright: Boolean = false, f: D<A>): A

black

fun <A> Pretty.black(bright: Boolean = true, f: D<A>): A

blue

fun <A> Pretty.blue(bright: Boolean = true, f: D<A>): A

bold

fun <A> Pretty.bold(f: D<A>): A

collection

fun Pretty.collection(open: Doc, close: Doc, sep: Doc, vararg docs: Doc): Unit

collectionBy

fun <T> Pretty.collectionBy(by: Pretty.(T) -> Unit, open: Doc, close: Doc, sep: Doc, vararg docs: T): Unit

cyan

fun <A> Pretty.cyan(bright: Boolean = true, f: D<A>): A

error

fun Pretty.error(severity: Severity = Severity.error, file: String, line: Int, col: Int? = null, sourceLine: CharSequence? = null, message: String? = null, vararg expected: Any): Unit
fun Pretty.error(severity: Severity = Severity.error, source: Source, pos: Int, message: String? = null, vararg expected: Any): Unit

expr

fun <A> Pretty.expr(d: D<A>): A

fg

fun <A> Pretty.fg(color: Color, bright: Boolean = true, f: D<A>): A

green

fun <A> Pretty.green(bright: Boolean = true, f: D<A>): A

grouped

fun <A> Pretty.grouped(body: D<A>): A

guttered

fun Pretty.guttered(t: String): Unit

hsep

fun Pretty.hsep(vararg docs: Doc): Unit

hsepBy

fun <T> Pretty.hsepBy(by: Pretty.(T) -> Unit, vararg docs: T): Unit

hsepByTight

fun <T> Pretty.hsepByTight(by: Pretty.(T) -> Unit, vararg docs: T): Unit

hsepTight

fun Pretty.hsepTight(vararg docs: Doc): Unit

hvsep

fun Pretty.hvsep(vararg docs: Doc): Unit

hvsepBy

fun <T> Pretty.hvsepBy(by: Pretty.(T) -> Unit, vararg docs: T): Unit

hvsepByTight

fun <T> Pretty.hvsepByTight(by: Pretty.(T) -> Unit, vararg docs: T): Unit

hvsepTight

fun Pretty.hvsepTight(vararg docs: Doc): Unit

intersperse

fun Pretty.intersperse(delim: Doc, vararg docs: Doc): Unit

intersperseBy

fun <T> Pretty.intersperseBy(by: Pretty.(T) -> Unit, delim: Doc, vararg docs: T): Unit

italic

fun <A> Pretty.italic(f: D<A>): A

magenta

fun <A> Pretty.magenta(bright: Boolean = true, f: D<A>): A

nest

fun <A> Pretty.nest(w: W, body: D<A>): A

oxford

fun Pretty.oxford(conjunction: String = "or", vararg docs: Doc): Unit

oxfordBy

fun <T> Pretty.oxfordBy(by: Pretty.(T) -> Unit = Pretty::simple, conjunction: String = "or", vararg docs: T): Unit

red

fun <A> Pretty.red(bright: Boolean = true, f: D<A>): A

run

fun <A> Pretty.run(d: D<A>): A

simple

fun Pretty.simple(t: Any?): Unit

vsep

fun Pretty.vsep(vararg docs: Doc): Unit

vsepBy

fun <T> Pretty.vsepBy(by: Pretty.(T) -> Unit, vararg docs: T): Unit

white

fun <A> Pretty.white(bright: Boolean = true, f: D<A>): A

yellow

fun <A> Pretty.yellow(bright: Boolean = true, f: D<A>): A