Class LineSplitter
java.lang.Object
org.ek9lang.compiler.formatter.LineSplitter
Pass 4 of the EK9 source formatter: Line Splitting.
Parses the source to obtain both a token stream and parse tree, then identifies lines exceeding the maximum length threshold. For each long line, the parse tree determines the construct type and applies the appropriate splitting strategy:
- Strategy 1: Parameter lists — one argument per line
- Strategy 2: Stream pipelines — one stage per line
- Strategy 3: Boolean/logical chains — break after and/or/xor
- Strategy 4: Long binary expressions — break after operator
Lines inside multi-line comments and string literals are exempt.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LineSplitter
LineSplitter()
-
-
Method Details
-
split
Apply line splitting to the given EK9 source.Iterates: each pass may split an outer construct, producing new lines that themselves exceed the limit (e.g. nested parameter lists). The loop re-parses after each pass and continues until no further splits are needed or the iteration limit is reached.
- Parameters:
source- The EK9 source code (already indented, reordered and spaced).- Returns:
- The source with long lines split, or null if parsing fails.
-