def dq.end

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

import cswap-bend-cli@0.1.0.0/fmt/ylex.bend as Ylex
import Base

170# `n` characters of a double-quoted body (after the opening quote) up to and
171# including its closing quote, or None when it never closes.
172def dq.end(s: String, +n: Nat, +esc: Bool) -> Maybe<&2, Nat>:
173  match s:
174    case SNil{}:
175      None{}
176    case SCon{Chr{+c}, t}:
177      dq.pick(Bool.not(esc) && U32.is_eq(c, 34), Nat.add(n, 1n), dq.end(t, Nat.add(n, 1n), Bool.not(esc) && U32.is_eq(c, 92)))

Uses (10)

Used by (1)