def scan
import cswap-bend-cli@0.1.0.0/json/scan.bend as Scanimport Base
import cswap-bend-cli@0.1.0.0/json/lex.bend as Lex
33# Tokens before the first comma or closer at depth 0.
34def scan(toks: List<&2, Lex.Tok>, +d: U32) -> Nat:
35 match toks:
36 case Nil{}:
37 0n
38 case Con{+h, t}:
39 scan.pick(stopper(tk.kind(h), d), 1n+scan(t, depth.next(tk.kind(h), d)))