def Parse.read_fixed.go
bend-scanner@0.1.0.0 · parse.bend:142
import bend-scanner@0.1.0.0/parse.bend as Parse
import Base
142def Parse.read_fixed.go(
143 s: String, n: Nat, +acc: U32, off: Nat, st: Parse.St, +max: U32
144) -> Result<&2, &2, Parse.Error, Parse.Dec>:
145 match s n st:
146 case _ _ StBad{c}:
147 Fail{Unexpected{off, c}}
148 case _ _ StOv{}:
149 Fail{Overflow{off}}
150 case _ 0n StOk{}:
151 Done{Dec{acc, Cur{s, off}}}
152 case SNil{} 1n++p StOk{}:
153 Fail{Eof{off}}
154 case SCon{+h, t} 1n++p StOk{}:
155 Parse.read_fixed.go(
156 t, p, Parse.nacc(acc, h), 1n+off, Parse.st.of(acc, h, max), max
157 )