def utf8_scalar
import cli@0.2.0.0/cli.bend as Cliimport Base
7940# A decoded code point, if it is a Unicode scalar at least least.
7941def utf8_scalar(found: Maybe<&2, U32>, least: U32) -> Maybe<&2, U32>:
7942 match found:
7943 case None{}: None{}
7944 case Some{+x}:
7945 utf8_next(Bool.and(Bool.and(U32.is_ge(x, least),
7946 U32.is_le(x, 1114111)), U32.is_ge((x - 55296 : U32), 2048)), Some{x})