def check.width

bolt@1.27.0.0 · src/rules/correctness/hole.bend:26

import bolt@1.27.0.0/src/rules/correctness/hole.bend as Hole
import Base
import bolt@1.27.0.0/src/syntax/lex.bend as Lex
import bolt@1.27.0.0/src/lazy/lazy.bend as Lazy

26# the width of the hole a `?` at line, col starts: through the next token
27# past spaces, newlines and comments when it sits on the same line, else 1
28def check.width(toks: List<&2, Lex.Tok>, +line: U32, +col: U32) -> U32:
29  match toks:
30    case Con{Lex.Tok{k, t, +l, +c}, rest}:
31      Lazy.stop(U32, Lex.significant(k), Bool.pick(U32, U32.is_eq(l, line), U32.add(U32.sub(c, col), 4), 1),
32        _u => check.width(rest, line, col))
33    case Nil{}:
34      1

Uses (9)

Used by (1)