def unescape
import cswap-bend-cli@0.1.0.0/json/lex.bend as Leximport Base
193# Decode the escapes of a string body. `fuel` is its length.
194def unescape(fuel: Nat, s: String) -> String:
195 match fuel s:
196 case _ SNil{}:
197 SNil{}
198 case 0n _:
199 SNil{}
200 case 1n+p SCon{Chr{+c}, +t}:
201 SCon{Chr{esc.cp(c, t)}, unescape(p, String.drop(t, esc.skip(c, t)))}