def parse.strict.bytes

bend-kit-json@0.7.0.0 · json.bend:732

import bend-kit-json@0.7.0.0/json.bend as Json
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

732# Strict UTF-8 JSON: reject lone surrogate escapes and more than cap nested
733# arrays/objects, including empty containers. Scalars have depth zero.
734# The limit is checked at each opening, before any contents are parsed.
735def parse.strict.bytes(b: Bytes.Bytes, cap: U32) -> Maybe<&1, Val>:
736  Bytes.Bytes{+len, buf} = b
737  runb(Nat.add(Nat.mul(U32.to_nat(len), 4n), 4n), (buf, BValue{0, Nil{}}, 0), len, True{}, cap)

Uses (12)

Used by (3)