@@ -42,8 +42,7 @@ CodePoint :: { cp : U32 }.{
4242 u32 >= 0xDC00 and u32 <= 0xDFFF
4343 }
4444
45- ## Zig docs: bytes the UTF-8 representation would require
46- ## for the given codepoint.
45+ ## Returns the number of bytes needed to encode this [CodePoint] as UTF-8.
4746 utf8_len : CodePoint -> Try (U8 , [InvalidCodePoint ])
4847 utf8_len = |code_point| {
4948 u32 = code_point. to_u32 ()
@@ -61,7 +60,7 @@ CodePoint :: { cp : U32 }.{
6160 }
6261 }
6362
64- ## Encode a Scalar as UTF-8 bytes and append those bytes to an existing list of UTF-8 bytes.
63+ ## Encode a [CodePoint] as UTF-8 bytes and append those bytes to an existing list of UTF-8 bytes.
6564 append_utf8 : List (U8 ), CodePoint -> List (U8 )
6665 append_utf8 = |bytes, code_point| {
6766 u32 = code_point. to_u32 ()
@@ -111,9 +110,6 @@ CodePoint :: { cp : U32 }.{
111110 . append (byte3)
112111 } else {
113112
114- ## This was an invalid Unicode scalar value, even though it had the Roc type Scalar.
115- ## This should never happen!
116- # expect u32 < 0x110000
117113 byte1 =
118114 u32
119115 . shift_right_by (18 )
@@ -149,7 +145,7 @@ CodePoint :: { cp : U32 }.{
149145 }
150146 }
151147
152- ## The number of UTF-8 bytes it takes to represent this Scalar .
148+ ## The number of UTF-8 bytes it takes to represent this [CodePoint] .
153149 count_utf8_bytes : CodePoint -> U8
154150 count_utf8_bytes = |code_point| {
155151 u32 = code_point. to_u32 ()
0 commit comments