def elements.kinds
gralha-xml-doc@0.1.0.1 · xml.bend:463
import gralha-xml-doc@0.1.0.1/xml.bend as Xml
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
463
464
465def elements.kinds(xs: List<&2, Element>, +acc: U32) -> U32:
466 match xs:
467 case Nil{}: acc
468 case Con{Element{name, attrs, kids, text}, rest}:
469 +n = name
470 elements.kinds(rest, elements.kinds(kids, U32.or(acc, U.choose(U32, U.string.equal(n, "image"), 1,
471 U.choose(U32, U.string.equal(n, "use"), 2, U.choose(U32, U.string.equal(n, "text"), 4, U.choose(U32, U.string.equal(n, "style"), 8, 0)))))))