def octal
import bolt@1.27.0.0/src/rules/correctness/escape.bend as Escapeimport Base
37# the Sym's char when it is an octal digit
38def octal(ss: Sym) -> Maybe<&2, Char>:
39 match ss:
40 case SZero{}:
41 Some{'0'}
42 case SDigit{Chr{+x}}:
43 Bool.pick(Maybe<&2, Char>, U32.is_le(x, 55), Some{Chr{x}}, None{})
44 case other:
45 None{}