Class LayoutRepairs
java.lang.Object
org.ek9lang.compiler.repair.LayoutRepairs
THE layout repairs - the faults in how a source is laid out rather than what it says, each with exactly one
reading and none able to change which code runs. Formerly the formatter's
SourcePreProcessor (and,
for the shebang, a second copy in the MCP file writer).
- a leading byte-order mark (U+FEFF) - removed (the compiler rejects one);
- CRLF / CR line endings - LF (only in
all(String): CRLF parses, so no diagnostic ever asks for it); - a WRONG shebang (
#!/usr/bin/env ek9) - replaced by#!ek9; a MISSING one - added; - layout tabs - two spaces each; a tab inside a String, character or regex literal, or a comment, is content and is kept (the lexer decides which is which);
- an odd base indent (a file indented in threes) - re-levelled to two spaces per level.
There is deliberately NO keyword-typo correction: a Levenshtein guess rewrote valid identifiers
(heads to head) and ek9 -ff saved the file (removed 2026-10-05). A misspelt keyword
changes which code runs - see ParseSuggestions.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final recordThe repaired text and one note per repair; notes empty means nothing changed. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription(package private) static LayoutRepairs.ResultEvery layout repair, line endings included - theek9 -ffpre-pass.(package private) static StringreplaceLayoutTabs(String source) Replace each LAYOUT tab with two spaces.(package private) static LayoutRepairs.ResultwithoutLineEndings(String source) Every layout repair except the line endings - for a caller whose text already failed to parse.
-
Field Details
-
SHEBANG
- See Also:
-
-
Method Details
-
all
Every layout repair, line endings included - theek9 -ffpre-pass. -
withoutLineEndings
Every layout repair except the line endings - for a caller whose text already failed to parse. -
replaceLayoutTabs
Replace each LAYOUT tab with two spaces. The EK9 lexer decides which tabs are layout: a tab it reads as part of an INDENT/DEDENT/NL (in the indentation, or between tokens) is one the compiler rejects, and is replaced here. A tab inside any other token - a String, a backtick String, a character or regex literal, a comment - is part of that token's text and is kept, because replacing it would change what the program does.
-