def sq.end

cswap-bend-cli@0.1.0.0 · fmt/ylex.bend:193

import cswap-bend-cli@0.1.0.0/fmt/ylex.bend as Ylex
import 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)))

Uses (11)

Used by (1)