authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-19 01:54:03 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-01-19 01:54:03 -08:00
log0072865f1e40ae053ab43589bfc27735ce84cf84
treef27da67c0d16c54e1aea9fbb95c2fbc330073711
parentba472f055e4e641958202b0229ef52a8c5193d8b

add some doc comments


2 files changed, 7 insertions(+), 0 deletions(-)

idna.zig+4
......@@ -8,6 +8,7 @@ pub const @"2008" = @import("./2008.zig");
88
99pub const table = @import("./table.zig");
1010
11// https://unicode.org/reports/tr46/#ToASCII
1112pub fn ToASCII(
1213 allocator: std.mem.Allocator,
1314 domain_name: []const u8,
......@@ -44,6 +45,7 @@ pub fn ToASCII(
4445 return map.toOwnedSlice();
4546}
4647
48// https://unicode.org/reports/tr46/#ToUnicode
4749pub fn ToUnicode(
4850 allocator: std.mem.Allocator,
4951 domain_name: []const u8,
......@@ -60,6 +62,7 @@ pub fn ToUnicode(
6062 return map.toOwnedSlice();
6163}
6264
65// https://unicode.org/reports/tr46/#Processing
6366fn Processing(
6467 map: *extras.ManyArrayList(u8),
6568 domain_name: []const u8,
......@@ -166,6 +169,7 @@ fn isNFC(map: *const extras.ManyArrayList(u8)) bool {
166169 return false;
167170}
168171
172// https://unicode.org/reports/tr46/#Validity_Criteria
169173fn Validity_Criteria(
170174 label: []const u8,
171175 CheckHyphens: bool,
normalization.zig+3
......@@ -41,6 +41,7 @@ pub fn ToNFKC(map: *extras.ManyArrayList(u8)) !void {
4141 try CanonicalComposition(map);
4242}
4343
44// https://www.unicode.org/versions/latest/core-spec/chapter-3/#G733
4445fn Decomposition(map: *extras.ManyArrayList(u8), kind: enum { canonical, compatibility }) !void {
4546 // fully decompose all codepoints in the string
4647 var n: usize = 0;
......@@ -101,6 +102,7 @@ fn Decomposition(map: *extras.ManyArrayList(u8), kind: enum { canonical, compati
101102 }
102103}
103104
105// https://www.unicode.org/versions/latest/core-spec/chapter-3/#G50628
104106fn CanonicalComposition(map: *extras.ManyArrayList(u8)) !void {
105107 if (map.lengths.items.len < 2) {
106108 return;
......@@ -157,6 +159,7 @@ fn CanonicalComposition(map: *extras.ManyArrayList(u8)) !void {
157159 break;
158160 }
159161 }
162 // https://www.unicode.org/versions/latest/core-spec/chapter-3/#G56669
160163 i = 0;
161164 while (i < map.lengths.items.len) : (i += 1) {
162165 const sll = map.items(i);