Documentation
¶
Overview ¶
Package format formats Kukel source (kukel fmt): it re-indents lines and normalizes the spaces between tokens. Line breaks and comments stay where they are, and at most one blank line in a row is kept. A line that continues a statement outside brackets is indented one level more than its first line (see continues). A statement that starts with if, while, do, for, switch, try or with gets a blank line before it (breathing space), unless it starts a block or follows a label (see breathe).
The result is checked: read again, it must give the same tokens and comments as the input, or Source refuses it (so formatting can never change a program).
Index ¶
Constants ¶
const Indent = " "
Indent is one level of indentation.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶ added in v0.37.0
type Options struct {
// Strict (kukel fmt -strict) puts braces around the statement of each
// if, else, for, while, do and with that has none (not around the if
// of an else if, nor around a local declaration or a case label, which
// may not stand there: such a program stays an error), and puts every
// function and member function definition on several lines: each
// statement of its blocks on a line of its own, also in a function
// that fits on one (f() { return 1; }). Function literals keep their
// lines (they get the braces); empty blocks stay {}.
Strict bool
}
Options are the choices of kukel fmt beyond its fixed layout.