def dc.step

bend-kit-http@0.38.2.0 · http.bend:531

import bend-kit-http@0.38.2.0/http.bend as Http
import Base

531# One byte c. Done and Bad never look at it, and a data byte is not inspected.
532def dc.step(st: Dc, +c: U32) -> Dc:
533  match st:
534    case DcBad{}:
535      DcBad{}
536    case DcSize{+acc, seen}:
537      dc.size(acc, seen, c, Bool.and(is_hex(c), U32.is_le(acc, 268435455)))
538    case DcExt{+n}:
539      dc.ext(n, c, U32.is_eq(c, 13))
540    case DcSizeLf{+n}:
541      dc.size.lf(n, U32.is_eq(c, 10))
542    case DcDataCr{}:
543      dc.pick(U32.is_eq(c, 13), DcDataLf{})
544    case DcDataLf{}:
545      dc.pick(U32.is_eq(c, 10), dc.start())
546    case DcTr{+j}:
547      dc.tr(j, c, U32.is_eq(c, dc.tr.want(j)))
548    case DcData{+k}:
549      dc.data(k, 1)
550    case DcDone{}:
551      DcDone{}

Uses (14)

Used by (2)