def widths
bolt@1.27.0.0 · src/rules/style/space.bend:51
import bolt@1.27.0.0/src/rules/style/space.bend as Space
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
51
52def widths(toks: List<&2, Lex.Tok>, +path: String, +nn: U32, +acc: U32) -> List<&2, F.Finding>:
53 match toks:
54 case Nil{}:
55 too_wide(acc, path, nn, [])
56 case Con{Lex.Tok{Lex.TNewline{}, t, l, c}, rest}:
57 too_wide(acc, path, nn, widths(rest, path, (nn + 1 : U32), 0))
58 case Con{Lex.Tok{k, t, l, c}, rest}:
59 +w = width_of(k, t)
60 widths(rest, path, nn, (acc + w : U32))