@@ -13,7 +13,7 @@ let is_ascii s =
13
13
14
14
let normalize = Uunf_string. normalize_utf_8 `NFKC
15
15
16
- let fold_uchars f acc str =
16
+ let foldi_uchars ~ f acc str =
17
17
let len = String. length str in
18
18
let rec loop pos acc =
19
19
if pos == len then acc
@@ -25,19 +25,19 @@ let fold_uchars f acc str =
25
25
loop (pos + char_length) acc in
26
26
loop 0 acc
27
27
28
- let iter_uchars s f =
28
+ let iteri_uchars ~ f str =
29
29
let f' buf pos c =
30
30
f pos c;
31
31
Buffer. add_utf_8_uchar buf c;
32
32
buf in
33
33
let s_after =
34
- Buffer. contents @@ fold_uchars f ' (Buffer. create (String. length s )) s in
34
+ Buffer. contents @@ foldi_uchars ~f: f ' (Buffer. create (String. length str )) str in
35
35
(* another sanity check *)
36
- if not (String. equal s s_after) then
36
+ if not (String. equal str s_after) then
37
37
Core. (
38
38
ICE. internal_compiler_error
39
39
[% message
40
- " Failed to round-trip unicode string!" (s : string ) (s_after : string )])
40
+ " Failed to round-trip unicode string!" (str : string ) (s_after : string )])
41
41
42
42
(* WIP:
43
43
@@ -60,7 +60,7 @@ let confusable x y =
60
60
(* TODO!! replace with prototype - need data? *)
61
61
Buffer. add_utf_8_uchar acc c;
62
62
acc in
63
- let buf = fold_uchars f (Buffer. create (String. length x)) x in
63
+ let buf = foldi_uchars ~ f (Buffer. create (String. length x)) x in
64
64
let x = Buffer. contents buf in
65
65
let x = Uunf_string. normalize_utf_8 `NFD x in
66
66
x in
@@ -98,7 +98,7 @@ let restriction_level x =
98
98
let scripts =
99
99
Uucp.Script. script_extensions c |> ScriptSet. of_list |> extended in
100
100
scripts :: acc in
101
- let soss = fold_uchars f [] x in
101
+ let soss = foldi_uchars ~ f [] x in
102
102
let resolved = List. fold_right ScriptSet. inter soss all in
103
103
if not @@ ScriptSet. is_empty resolved then `Single
104
104
else `Unrestricted (* TODO implement levels 3-5 *)
0 commit comments