Json.val: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/json.bend as Json Lines 196-214 of cswap-bend-cli@0.1.0.0/json.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/json.bend&start_line=196&end_line=214 import Base import cswap-bend-cli@0.1.0.0/json/scan.bend as Scan # One def for values, array items and object fields: `plan` says which step # this is. `fuel` bounds the work (3 * tokens + 5). An item's tokens are those # up to the next comma or closer at depth 0. def val(fuel: Nat, pl: Plan) -> Result<&2, &2, String, Json>: match fuel pl: case 0n _: Fail{"nesting too deep"} case 1n++p PRes{r}: r case 1n++p PArr{+t}: wrap.arr(Scan.closed_by(t, 22), val(p, plan(MAFirst{}, body(t)))) case 1n++p PObj{+t}: wrap.obj(Scan.closed_by(t, 21), val(p, plan(MOFirst{}, body(t)))) case 1n++p PItems{f, r}: item.cons(val(p, plan(MVal{}, f)), val(p, plan(MAAfter{}, r))) case 1n++p PFields{k, vt, r}: field.cons(k, val(p, plan(MVal{}, vt)), val(p, plan(MOAfter{}, r))) case 1n++p PNext{m, t}: val(p, plan(m, t)) Uses (13): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json/scan.bend&name=closed_by https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=Json https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=Mode https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=Plan https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=body https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=field.cons https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=item.cons https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=plan https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=wrap.arr https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=wrap.obj