def test

yaml-for-bend@0.1.1.0 · re.bend:44

import yaml-for-bend@0.1.1.0/re.bend as Re
import Base

44def test(cls: Cls, +c: Char) -> Bool:
45  match cls:
46    case Digit{}:
47      Char.is_digit(c)
48    case Hex{}:
49      Bool.or(Char.is_digit(c), Bool.or(between(code(c), 65, 70), between(code(c), 97, 102)))
50    case Range{lo, hi}:
51      between(code(c), code(lo), code(hi))
52    case Lit{x}:
53      Char.is_eq(c, x)
54    case OneOf{chars}:
55      in(c, chars)
56    case NoneOf{chars}:
57      Bool.not(in(c, chars))
58    case Alpha{}:
59      is_alpha(code(c))
60    case Space{}:
61      Char.is_space(c)
62    case Anything{}:
63      True{}

Uses (12)

Used by (1)