def span_digits

bend-toon-codec@0.1.0.0 · src/num.bend:41

import bend-toon-codec@0.1.0.0/src/num.bend as Num
import Base

41# Leading run of ASCII digits, and the rest.
42def span_digits(+s: String) -> Sp:
43  match s:
44    case SNil{}:
45      Sp{SNil{}, SNil{}}
46    case SCon{Chr{c}, t}:
47      sp.pick(Char.is_digit(Chr{c}), c, s, span_digits(t))

Uses (5)

Used by (4)