INNER CODE UNIT · Python
transform_file
Cooler2/ApusGameEngine · tools/normalize_indent.py:218
def transform_file(lines, flag_above):
"""
Returns (new_lines, changed_count, flagged_lines).
flagged_lines: list of (line_no, old_indent, line_content)
Two corrections on top of plain 2x:
1. Nested proc bodies: subtract accumulated reduction before multiplying.
2. `uses` continuations: pin to the indent of the `uses` keyword.
"""
reductions = _compute_reductions(lines)
new_lines = []
changed = 0
flagged = []
in_uses = False
new_uses_indent = 0
for i, l in enumerate(lines):
stripped = l.strip()