Skip to content

Commit be27cab

Browse files
committed
snapshot
1 parent 423171f commit be27cab

File tree

5 files changed

+7715
-6033
lines changed

5 files changed

+7715
-6033
lines changed

lib/4.06.1/rescript.ml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6729,22 +6729,24 @@ let stats_to_string
67296729
(String.concat ","
67306730
(Array.to_list (Array.map string_of_int bucket_histogram)))
67316731

6732-
let string_of_int_as_char i =
6733-
let str = match Char.unsafe_chr i with
6734-
| '\'' -> "\\'"
6735-
| '\\' -> "\\\\"
6736-
| '\n' -> "\\n"
6737-
| '\t' -> "\\t"
6738-
| '\r' -> "\\r"
6739-
| '\b' -> "\\b"
6740-
| ' ' .. '~' as c ->
6741-
let s = (Bytes.create [@doesNotRaise]) 1 in
6742-
Bytes.unsafe_set s 0 c;
6743-
Bytes.unsafe_to_string s
6744-
| _ -> Ext_utf8.encode_codepoint i
6745-
in
6746-
Printf.sprintf "\'%s\'" str
6747-
6732+
let string_of_int_as_char (i : int) : string =
6733+
if i <= 255 && i >= 0 then Format.asprintf "%C" (Char.unsafe_chr i)
6734+
else
6735+
let str =
6736+
match Char.unsafe_chr i with
6737+
| '\'' -> "\\'"
6738+
| '\\' -> "\\\\"
6739+
| '\n' -> "\\n"
6740+
| '\t' -> "\\t"
6741+
| '\r' -> "\\r"
6742+
| '\b' -> "\\b"
6743+
| ' ' .. '~' as c ->
6744+
let s = (Bytes.create [@doesNotRaise]) 1 in
6745+
Bytes.unsafe_set s 0 c;
6746+
Bytes.unsafe_to_string s
6747+
| _ -> Ext_utf8.encode_codepoint i
6748+
in
6749+
Printf.sprintf "\'%s\'" str
67486750

67496751
end
67506752
module Hash_gen

lib/4.06.1/unstable/all_ounit_tests.ml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6645,22 +6645,24 @@ let stats_to_string
66456645
(String.concat ","
66466646
(Array.to_list (Array.map string_of_int bucket_histogram)))
66476647

6648-
let string_of_int_as_char i =
6649-
let str = match Char.unsafe_chr i with
6650-
| '\'' -> "\\'"
6651-
| '\\' -> "\\\\"
6652-
| '\n' -> "\\n"
6653-
| '\t' -> "\\t"
6654-
| '\r' -> "\\r"
6655-
| '\b' -> "\\b"
6656-
| ' ' .. '~' as c ->
6657-
let s = (Bytes.create [@doesNotRaise]) 1 in
6658-
Bytes.unsafe_set s 0 c;
6659-
Bytes.unsafe_to_string s
6660-
| _ -> Ext_utf8.encode_codepoint i
6661-
in
6662-
Printf.sprintf "\'%s\'" str
6663-
6648+
let string_of_int_as_char (i : int) : string =
6649+
if i <= 255 && i >= 0 then Format.asprintf "%C" (Char.unsafe_chr i)
6650+
else
6651+
let str =
6652+
match Char.unsafe_chr i with
6653+
| '\'' -> "\\'"
6654+
| '\\' -> "\\\\"
6655+
| '\n' -> "\\n"
6656+
| '\t' -> "\\t"
6657+
| '\r' -> "\\r"
6658+
| '\b' -> "\\b"
6659+
| ' ' .. '~' as c ->
6660+
let s = (Bytes.create [@doesNotRaise]) 1 in
6661+
Bytes.unsafe_set s 0 c;
6662+
Bytes.unsafe_to_string s
6663+
| _ -> Ext_utf8.encode_codepoint i
6664+
in
6665+
Printf.sprintf "\'%s\'" str
66646666

66656667
end
66666668
module Hash_gen

0 commit comments

Comments
 (0)