Expand description
LeekScript tree printer.
Prints the syntax tree by emitting tokens in source order without modifying the tree.
Use [format] with a root sipha::red::SyntaxNode and FormatterOptions.
Modifications (e.g. semicolon insertion/removal) can be added later as separate passes.
Structs§
- Format
Driver - Driver that writes the syntax tree to a string by visiting tokens.
You can use [
format] directly, or build a custom flow withwalk(root, &mut driver, &opts). - Formatter
Options - Options for printing the syntax tree.
Enums§
- Brace
Style - Brace placement for blocks.
- Indent
Style - Indentation style for canonical formatting.
- Semicolon
Style - Semicolon style for statement ends.
Functions§
- format
- Print the syntax tree to a string.
When
canonical_format,parenthesize_expressions, orannotate_typesis set, runs a custom walk; otherwise uses sipha’s emit API for round-trip. - load_
formatter_ options_ from_ dir - Try to load formatter options from a directory: first
.leekfmt.toml, thenleekscript.tomlwith[format]section. ReturnsNoneif no file is found or parsing fails; caller falls back toFormatterOptions::default(). - load_
formatter_ options_ from_ file - Load formatter options from a single config file (e.g.
.leekfmt.toml) with a top-level[format]section.