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 four-pass Tier 1 pipeline for parseable files and a three-phase Tier 2 pipeline for force-formatting unparseable files.
- See Also:
-
ClassDescriptionPass 1 of the EK9 source formatter: Canonical Indentation.Pass 4 of the EK9 source formatter: Comment Interior Re-indentation.Orchestrates the EK9 source code formatting pipeline.Result of a formatting operation.The state of the formatter after processing.Pass 4 of the EK9 source formatter: Line Splitting.Pre-processes EK9 source that does not parse, applying simple text-level fixes to make it parseable before the formatting pipeline runs.Pass 2 of the EK9 source formatter: Structural Reordering.Canonical ordering for module block types.Pass 3 of the EK9 source formatter: Token Spacing.