1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# 1 "Camomile/public/uSet.ml"
(** Sets of Unicode characters, implemented as sets of intervals.
The signature is mostly same to Set.S in stdlib *)
include ISet
let mem u s = ISet.mem (UChar.uint_code u) s
let add u s = ISet.add (UChar.uint_code u) s
let add_range u1 u2 s =
ISet.add_range (UChar.uint_code u1) (UChar.uint_code u2) s
let singleton u = ISet.singleton (UChar.uint_code u)
let remove u s = ISet.remove (UChar.uint_code u) s
let remove_range u1 u2 s =
ISet.remove_range (UChar.uint_code u1) (UChar.uint_code u2) s
let from u s = ISet.from (UChar.uint_code u) s
let after u s = ISet.after (UChar.uint_code u) s
let until u s = ISet.until (UChar.uint_code u) s
let before u s = ISet.before (UChar.uint_code u) s
let iter f s = ISet.iter (fun n -> f (UChar.chr_of_uint n)) s
let iter_range f s =
let f' n1 n2 =
f (UChar.chr_of_uint n1) (UChar.chr_of_uint n2) in
ISet.iter_range f' s
let fold f s a =
let f' n a = f (UChar.chr_of_uint n) a in
ISet.fold f' s a
let fold_range f s a =
let f' n1 n2 a =
f (UChar.chr_of_uint n1) (UChar.chr_of_uint n2) a in
ISet.fold_range f' s a
let for_all p s =
let p' n = p (UChar.chr_of_uint n) in
ISet.for_all p' s
let exists p s =
let p' n = p (UChar.chr_of_uint n) in
ISet.exists p' s
let filter p s =
let p' n = p (UChar.chr_of_uint n) in
ISet.filter p' s
let partition p s =
let p' n = p (UChar.chr_of_uint n) in
ISet.partition p' s
let elements s =
List.map UChar.chr_of_uint (ISet.elements s)
let ranges s =
let f (n1, n2) =
(UChar.chr_of_uint n1,
UChar.chr_of_uint n2) in
List.map f (ISet.ranges s)
let min_elt s = UChar.chr_of_uint (ISet.min_elt s)
let max_elt s = UChar.chr_of_uint (ISet.max_elt s)
let choose s = UChar.chr_of_uint (ISet.choose s)
let uset_of_iset s = s
let iset_of_uset s = s