INNER CODE UNIT · Python
depth
Cooler2/ApusGameEngine · tools/normalize_indent.py:151
depth = 1 # the opening begin counts as +1
else:
depth += _block_delta(lines[k])
if depth <= 0:
end_line = k
break
if not found_open or end_line < 0:
continue # no valid body found — skip
# All lines from j to end_line (inclusive) need one extra reduction
for idx in range(j, end_line + 1):
reductions[idx] = reductions.get(idx, 0) + 1
# Second pass: same-level style — var/begin at proc_indent (not proc_indent+1).
# Only for nested procs (pi>0); top-level procs need no reduction.
# Items are at proc_indent+2; apply reduction=1 only to those lines.
for i, line in enumerate(lines):