def Format.frac.go

bend-time-lib@0.4.0.1 · format.bend:149

import bend-time-lib@0.4.0.1/format.bend as Format
import Base

149def Format.frac.go(
150  s: String, n: Nat, dig: Bool, +h: Char, +acc: U32, off: Nat, got: Nat
151) -> Result<&2, &2, Format.Error, Format.FracP>:
152  match s n dig:
153    case _ 0n True{}:
154      Fail{BadFraction{off}}
155    case _ 0n False{}:
156      Format.frac.end_ok(SCon{h, s}, acc, off, got)
157    case _ 1n++p False{}:
158      Format.frac.end_ok(SCon{h, s}, acc, off, got)
159    case SNil{} 1n++p True{}:
160      Format.frac.end_ok(SNil{}, Format.nacc(acc, h), 1n+off, 1n+got)
161    case SCon{+h2, t} 1n++p True{}:
162      Format.frac.go(
163        t, p, Char.is_digit(h2), h2, Format.nacc(acc, h), 1n+off, 1n+got
164      )

Uses (11)

Used by (1)