def color.hex.scan
gralha-svg-render@0.1.0.1 · svg.bend:807
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
807def color.hex.scan(hexed: Bool, +ch: U32, t: String, +acc: U32, +n: U32) -> U32 & U32:
808 match hexed:
809 case True{}:
810 match t:
811 case SNil{}: ((acc * 16 + U.hex.digit(ch) : U32), (n + 1 : U32))
812 case SCon{Chr{c}, t2}:
813 +c2 = c
814 color.hex.scan(color.hex.digit(c2), c2, t2, (acc * 16 + U.hex.digit(ch) : U32), (n + 1 : U32))
815 case False{}: U.choose(U32 & U32, U.space(ch) && U.string.equal(U.trim(t), ""), (acc, n), (0, 0))