Package org.ek9lang.compiler.formatter


package org.ek9lang.compiler.formatter
EK9 Canonical Source Formatter.

Zero-configuration formatter that enforces a single canonical style for all EK9 code. Inspired by gofmt and Black: no options, no debates, one format everywhere.

Key properties:

  • Idempotent: Running twice produces the same output as running once.
  • Deterministic: Same input always produces the same output.
  • Safe by default: Refuses to modify unparseable files without force flag.
  • Parser-validated: Every transformation is validated by re-parsing.
  • Never corrupts: Original file preserved if any pass produces unparseable output.

The formatter uses a six-pass Tier 1 pipeline for parseable files. Force mode first runs the text layer of THE repair engine, SourceRepairs.repairText(String) (layout repairs, then the one-reading parse repairs in a parse-verified loop), then the same pipeline; every repair is reported and nothing is renamed.

See Also: