def graphemes

bend-kit-unicode@0.1.0.0 · unicode.bend:228

import bend-kit-unicode@0.1.0.0/unicode.bend as Unicode
import Base
import bend-kit-unicode@0.1.0.0/tables.bend as T

228# Extended grapheme clusters (UAX #29): "e\u{301}x" is ["e\u{301}", "x"].
229def graphemes(s: String) -> List<&2, String>:
230  match s:
231    case SNil{}:
232      Nil{}
233    case SCon{Chr{+c}, t}:
234      +q = T.gb(c)
235      gr.go(t, Gr{q, next.ri(0, q, False{}), next.ep(q, 0), next.incb(q, 0), SCon{Chr{c}, SNil{}}, Nil{}})

Uses (10)

Used by (1)