def dec.take
import ezmcp@0.1.0.0/src/line.bend as Lineimport Base
114# a sequence whose continuation bytes are all valid is its char, and the
115# decoding goes on after it; else the lead byte is U+FFFD and the decoding
116# goes on at the byte after it
117def dec.take(
118 ch: Char,
119 ok: Bool,
120 after_lead: List<&2, U32>,
121 after_seq: List<&2, U32>,
122 go: List<&2, U32> -> String
123) -> String:
124 match ok:
125 case True{}:
126 SCon{ch, go(after_seq)}
127 case False{}:
128 SCon{bad(), go(after_lead)}