Skip to main content

Crate eure_fmt

Crate eure_fmt 

Source
Expand description

Eure formatter.

This crate provides formatting functionality for Eure files, using an IR-based architecture inspired by Wadler’s “A Prettier Printer” algorithm.

§Architecture

The formatter uses a three-stage pipeline:

  1. Parse - Source text → CST (done externally via eure-parol)
  2. Build - CST → Doc IR (intermediate representation)
  3. Print - Doc IR → Formatted string

§Example

use eure_fmt::{format, FormatConfig};

let input = "a={b=1,c=2}";
let config = FormatConfig::default();
let formatted = format(input, &config).unwrap();

Re-exports§

pub use config::FormatConfig;
pub use doc::Doc;
pub use source::build_source_doc;
pub use source::format_source_document;

Modules§

config
Formatter configuration.
doc
Document IR for the Eure formatter.
printer
Wadler-style pretty printer.
source
Formatter for SourceDocument.

Structs§

TextEdit
A text edit representing a change to apply.

Enums§

FormatCheckResult
Result of checking if a file is formatted.
FormatError
Error that can occur during formatting.

Functions§

build_doc
Build a Doc IR from a CST.
compute_edits
Compute text edits to transform input into formatted output.
format_cst
Format Eure source code using an already-parsed CST.