def entities.loop
import gralha-xml-doc@0.1.0.1/xml.bend as Xmlimport Base
import gralha-text-scan@0.1.0.1/scan.bend as U
349def entities.loop(s: String, +acc: String) -> String:
350 match s:
351 case SNil{}: U.rev(acc, "")
352 case SCon{Chr{c}, t}:
353 +ch = c
354 +tail = t
355 U.branch(String, U32.is_eq(ch, 38),
356 _ => entities.more(U.until(tail, 59, ""), acc, rest => text => entities.loop(rest, text)),
357 _ => entities.loop(tail, SCon{Chr{ch}, acc}))