package core:unicode/utf8

Types

Accept_Range ¶

Accept_Range :: struct {
	lo,
	hi: u8,
}

Constants

HICB ¶

HICB :: 0b1011_1111

LOCB ¶

LOCB :: 0b1000_0000
 

The default lowest and highest continuation byte.

MASK2 ¶

MASK2 :: 0b0001_1111

MASK3 ¶

MASK3 :: 0b0000_1111

MASK4 ¶

MASK4 :: 0b0000_0111

MASKX ¶

MASKX :: 0b0011_1111

MAX_RUNE ¶

MAX_RUNE :: '\U0010ffff'

RUNE1_MAX ¶

RUNE1_MAX :: 1 << 7 - 1

RUNE2_MAX ¶

RUNE2_MAX :: 1 << 11 - 1

RUNE3_MAX ¶

RUNE3_MAX :: 1 << 16 - 1

RUNE_BOM ¶

RUNE_BOM :: 0xfeff

RUNE_EOF ¶

RUNE_EOF: rune : ~rune(0)

RUNE_ERROR ¶

RUNE_ERROR :: '\ufffd'

RUNE_SELF ¶

RUNE_SELF :: 0x80

SURROGATE_MAX ¶

SURROGATE_MAX :: 0xdfff

SURROGATE_MIN ¶

SURROGATE_MIN :: 0xd800

T1 ¶

T1 :: 0b0000_0000

T2 ¶

T2 :: 0b1100_0000

T3 ¶

T3 :: 0b1110_0000

T4 ¶

T4 :: 0b1111_0000

T5 ¶

T5 :: 0b1111_1000

TX ¶

TX :: 0b1000_0000

UTF_MAX ¶

UTF_MAX :: 4

Variables

accept_ranges ¶

accept_ranges: [5]Accept_Range = …

accept_sizes ¶

accept_sizes: [256]u8 = …

Procedures

decode_last_rune_in_bytes ¶

decode_last_rune_in_bytes :: proc "odin" (s: []u8) -> (rune, int) {…}

decode_last_rune_in_string ¶

decode_last_rune_in_string :: proc "odin" (s: string) -> (rune, int) {…}

decode_rune_in_bytes ¶

decode_rune_in_bytes :: proc "odin" (s: []u8) -> (rune, int) {…}

decode_rune_in_string ¶

decode_rune_in_string :: proc "odin" (s: string) -> (rune, int) {…}

encode_rune ¶

encode_rune :: proc "odin" (c: rune) -> ([4]u8, int) {…}

full_rune_in_bytes ¶

full_rune_in_bytes :: proc "odin" (b: []u8) -> bool {…}
 

full_rune_in_bytes reports if the bytes in b begin with a full utf-8 encoding of a rune or not An invalid encoding is considered a full rune since it will convert as an error rune of width 1 (RUNE_ERROR)

full_rune_in_string ¶

full_rune_in_string :: proc "odin" (s: string) -> bool {…}
 

full_rune_in_string reports if the bytes in s begin with a full utf-8 encoding of a rune or not An invalid encoding is considered a full rune since it will convert as an error rune of width 1 (RUNE_ERROR)

rune_at ¶

rune_at :: proc "odin" (s: string, byte_index: int) -> rune {…}

rune_at_pos ¶

rune_at_pos :: proc "odin" (s: string, pos: int) -> rune {…}

rune_count_in_bytes ¶

rune_count_in_bytes :: proc "odin" (s: []u8) -> int {…}

rune_count_in_string ¶

rune_count_in_string :: proc "odin" (s: string) -> int {…}

rune_offset ¶

rune_offset :: proc "odin" (s: string, pos: int, start: int = 0) -> int {…}
 

Returns the byte position of rune at position pos in s with an optional start byte position. Returns -1 if it runs out of the string.

rune_size ¶

rune_size :: proc "odin" (r: rune) -> int {…}

rune_start ¶

rune_start :: proc "odin" (b: u8) -> bool {…}

rune_string_at_pos ¶

rune_string_at_pos :: proc "odin" (s: string, pos: int) -> string {…}

runes_to_string ¶

runes_to_string :: proc "odin" (runes: []rune, allocator := context.allocator) -> string {…}

string_to_runes ¶

string_to_runes :: proc "odin" (s: string, allocator: runtime.Allocator) -> (runes: []rune) {…}

valid_rune ¶

valid_rune :: proc "odin" (r: rune) -> bool {…}

valid_string ¶

valid_string :: proc "odin" (s: string) -> bool {…}

Procedure Groups

full_rune ¶

full_rune :: proc{
	full_rune_in_bytes,
	full_rune_in_string,
}
 

full_rune reports if the bytes in b begin with a full utf-8 encoding of a rune or not An invalid encoding is considered a full rune since it will convert as an error rune of width 1 (RUNE_ERROR)

Source Files

Generation Information

Generated with odin version dev-2023-03 (vendor "odin") Windows_amd64 @ 2023-03-29 21:09:05.346932000 +0000 UTC