public final class CaseRules extends Object implements LayoutRule
CASE expressions vertically: a linebreak before each
WHEN, ELSE, and the closing END, keeping THEN
on its WHEN line.
CASE WHEN x = 1 THEN 'a' WHEN x = 2 THEN 'b' ELSE 'c' END
Operates over the IslandKind.CASE islands recognised in S22 (so a
BEGIN ... END block's END is never mistaken for a CASE end).
Incomplete CASE islands (no END,
IncompleteReason.MISSING_END) are still
laid out — their WHEN/ELSE break, and no END is
fabricated. Nested CASE expressions are handled because each is its own island.
Priority LayoutPriorities.CASE_ANDOR. Needs the S22 islands on the
context. Iterative (no recursion); read-only.
Plan reference: §7.3/S27, §7.4/S27.
| Constructor and Description |
|---|
CaseRules() |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(LayoutContext context)
Apply the rule, requesting layout decisions on the context.
|
String |
name()
Short, stable identifier for logging/diagnostics.
|
int |
priority()
The rule's precedence.
|
public CaseRules()
public int priority()
LayoutRulepriority in interface LayoutRulepublic String name()
LayoutRulename in interface LayoutRulepublic void apply(LayoutContext context)
LayoutRuleapply in interface LayoutRule