def span.eq.go

emerging-ezjson@1.3.0.0 · src/value.bend:46

import emerging-ezjson@1.3.0.0/src/value.bend as Value
import Base

46# whether the first `nn` chars of `src` equal `key`, stopping at the first miss.
47# A count past the end of `src` covers what there is, as span.str reads it
48def span.eq.go(src: String, same: Bool, zero: Bool, key: String, +nn: U32) -> Bool:
49  match src same zero key:
50    case s False{} zero k:
51      False{}
52    case s True{} True{} SNil{}:
53      True{}
54    case s True{} True{} k:
55      False{}
56    case SCon{+a, as} True{} False{} SCon{+b, bs}:
57      span.eq.go(as, Char.is_eq(a, b), U32.is_zero(U32.sub(nn, 1)), bs, U32.sub(nn, 1))
58    case SNil{} True{} False{} SNil{}:
59      True{}
60    case s True{} False{} k:
61      False{}

Uses (6)

Used by (1)