def sq.end
import cswap-bend-cli@0.1.0.0/fmt/ylex.bend as Yleximport Base
193# The same for a single-quoted body: `''` is a quote. `prevq`: the last
194# character was a quote that may close the string.
195def sq.end(s: String, +n: Nat, +prevq: Bool) -> Maybe<&2, Nat>:
196 match s:
197 case SNil{}:
198 sq.eos(prevq, n)
199 case SCon{Chr{+c}, t}:
200 sq.pick(prevq && Bool.not(U32.is_eq(c, 39)), n, sq.end(t, Nat.add(n, 1n), Bool.not(prevq) && U32.is_eq(c, 39)))