aboutsummaryrefslogtreecommitdiff
path: root/lib/unicode.ml
diff options
context:
space:
mode:
authorMatej Kosik2015-12-16 12:55:40 +0100
committerMatej Kosik2015-12-18 15:57:49 +0100
commit5174ee7e118d2bc57fc2d8a6619101735af79b16 (patch)
treed387c3bcf3f7358b7aefbfa5e3d556b46f8b32ec /lib/unicode.ml
parentca42472322013714050b98756aeaa222908fbe67 (diff)
COMMENTS: added to the "Unicode" module.
Diffstat (limited to 'lib/unicode.ml')
-rw-r--r--lib/unicode.ml7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/unicode.ml b/lib/unicode.ml
index 1765e93dcd..05998bb804 100644
--- a/lib/unicode.ml
+++ b/lib/unicode.ml
@@ -18,7 +18,7 @@ exception Unsupported
to simplify the masking process. (This choice seems to be a good
trade-off between speed and space after some benchmarks.) *)
-(* A 256ko table, initially filled with zeros. *)
+(* A 256 KiB table, initially filled with zeros. *)
let table = Array.make (1 lsl 17) 0
(* Associate a 2-bit pattern to each status at position [i].
@@ -147,6 +147,11 @@ let utf8_of_unicode n =
s
end
+(* If [s] is some UTF-8 encoded string
+ and [i] is a position of some UTF-8 character within [s]
+ then [next_utf8 s i] returns [(j,n)] where:
+ - [j] indicates the position of the next UTF-8 character
+ - [n] represents the UTF-8 character at index [i] *)
let next_utf8 s i =
let err () = invalid_arg "utf8" in
let l = String.length s - i in