def scan.go

bend-lint-rules@0.2.0.0 · layout/format.bend:357

import bend-lint-rules@0.2.0.0/layout/format.bend as Format
import Base

357# `scan`, with the text so far last character first: on the C lane, ++ copies its left side.
358def scan.go(
359  ~test: String -> Bool,
360  s: String,
361  keep: String,
362  ok: Bool,
363  text: String,
364  n: U32,
365  last: Char
366) -> Run:
367  match s ok:
368    case SCon{+c, +rest} True{}:
369      scan.go(~test, rest, rest, test(rest), SCon{c, text}, (n + 1: U32), c)
370    case _ _:
371      Run{String.reverse(text), n, keep, last}

Uses (7)

Used by (1)