this repo has no description
1type t = Flag of int | And of t * t | Or of t * t | Not of t
2
3let rec pp ppf = function
4 | Flag s -> Fmt.string ppf (Config.to_string s)
5 | And (e1, e2) -> Fmt.pf ppf "%a&%a" pp e1 pp e2
6 | Or (e1, e2) -> Fmt.pf ppf "%a|%a" pp e1 pp e2
7 | Not e1 -> Fmt.pf ppf "~%a" pp e1
8
9let check_flag i t = Int.equal (t land i) i
10
11let satisfies (expr : t) flags =
12 let rec loop = function
13 | Flag s -> check_flag s flags
14 | Not e -> not (loop e)
15 | And (e1, e2) -> loop e1 && loop e2
16 | Or (e1, e2) -> loop e1 || loop e2
17 in
18 loop expr