From 0072865f1e40ae053ab43589bfc27735ce84cf84 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Mon, 19 Jan 2026 01:54:03 -0800 Subject: [PATCH] add some doc comments --- idna.zig | 4 ++++ normalization.zig | 3 +++ 2 files changed, 7 insertions(+) diff --git a/idna.zig b/idna.zig index d9264636003ebfaa3278d8d27ac414113b3fc49a..056c1c2cc1cd1334008fcf1e6cf9e145ed39c044 100644 --- a/idna.zig +++ b/idna.zig @@ -8,6 +8,7 @@ pub const @"2008" = @import("./2008.zig"); pub const table = @import("./table.zig"); +// https://unicode.org/reports/tr46/#ToASCII pub fn ToASCII( allocator: std.mem.Allocator, domain_name: []const u8, @@ -44,6 +45,7 @@ pub fn ToASCII( return map.toOwnedSlice(); } +// https://unicode.org/reports/tr46/#ToUnicode pub fn ToUnicode( allocator: std.mem.Allocator, domain_name: []const u8, @@ -60,6 +62,7 @@ pub fn ToUnicode( return map.toOwnedSlice(); } +// https://unicode.org/reports/tr46/#Processing fn Processing( map: *extras.ManyArrayList(u8), domain_name: []const u8, @@ -166,6 +169,7 @@ fn isNFC(map: *const extras.ManyArrayList(u8)) bool { return false; } +// https://unicode.org/reports/tr46/#Validity_Criteria fn Validity_Criteria( label: []const u8, CheckHyphens: bool, diff --git a/normalization.zig b/normalization.zig index 318c16a9922c703d2b8e51db1da0a2b98851930e..77f69787e726db3201c9d62468420b90f8e5f01f 100644 --- a/normalization.zig +++ b/normalization.zig @@ -41,6 +41,7 @@ pub fn ToNFKC(map: *extras.ManyArrayList(u8)) !void { try CanonicalComposition(map); } +// https://www.unicode.org/versions/latest/core-spec/chapter-3/#G733 fn Decomposition(map: *extras.ManyArrayList(u8), kind: enum { canonical, compatibility }) !void { // fully decompose all codepoints in the string var n: usize = 0; @@ -101,6 +102,7 @@ fn Decomposition(map: *extras.ManyArrayList(u8), kind: enum { canonical, compati } } +// https://www.unicode.org/versions/latest/core-spec/chapter-3/#G50628 fn CanonicalComposition(map: *extras.ManyArrayList(u8)) !void { if (map.lengths.items.len < 2) { return; @@ -157,6 +159,7 @@ fn CanonicalComposition(map: *extras.ManyArrayList(u8)) !void { break; } } + // https://www.unicode.org/versions/latest/core-spec/chapter-3/#G56669 i = 0; while (i < map.lengths.items.len) : (i += 1) { const sll = map.items(i); -- 2.54.0