def Json.parse.in_str.hex
import bend-kube-runtime@0.2.0.0/src/json.bend as Jsonimport Base
543# \uXXXX: esc counts 2..5 over the four digits. A UTF-16 surrogate pair
544# arrives as two escapes; each half is kept as its own code, which the
545# Kubernetes API never emits for text it validates.
546def Json.parse.in_str.hex(d: Maybe<&2, U32>, buf: String, key: Bool, +esc: U32, code: U32,
547 stack: List<&2, Frame>) -> JState:
548 match d:
549 case None{}:
550 Json.parse.err("bad \\u escape")
551 case Some{v}:
552 Json.parse.in_str.hex.put(((code << 4n) + v : U32), buf, key, esc, stack)