def num.go
bend-kit-regex@0.8.0.0 · regex.bend:256
import bend-kit-regex@0.8.0.0/regex.bend as Regex
import Base
256def num.go(t: String, +c: U32, +acc: U32, +n: U32, dig: Bool) -> Num:
257 match t:
258 case SNil{}:
259 match dig:
260 case True{}:
261 Num{num.add(acc, c), (n + 1 : U32), SNil{}}
262 case False{}:
263 Num{acc, n, SCon{Chr{c}, SNil{}}}
264 case SCon{Chr{+d}, u}:
265 match dig:
266 case True{}:
267 num.go(u, d, num.add(acc, c), (n + 1 : U32), is_digit(d))
268 case False{}:
269 Num{acc, n, SCon{Chr{c}, SCon{Chr{d}, u}}}