summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Michael Chaten2025-09-14 04:11:09 -0700
committerGravatar Michael Chaten2025-09-14 04:11:09 -0700
commit749197a3f9d25e211615960c02380a3d659b20f9 (patch)
tree9c892349f0a7136edb150f27f549dc182f7699bb
parentUpdate codebase to Zig 0.15.1. (diff)
downloadzg-749197a3f9d25e211615960c02380a3d659b20f9.tar.gz
zg-749197a3f9d25e211615960c02380a3d659b20f9.tar.xz
zg-749197a3f9d25e211615960c02380a3d659b20f9.zip
Embed data files in scripts rather than relying on filesystem access for easier packaging
-rw-r--r--build.zig25
-rw-r--r--codegen/canon.zig8
-rw-r--r--codegen/case_prop.zig9
-rw-r--r--codegen/ccc.zig9
-rw-r--r--codegen/compat.zig7
-rw-r--r--codegen/core_props.zig9
-rw-r--r--codegen/dwp.zig14
-rw-r--r--codegen/fold.zig13
-rw-r--r--codegen/gbp.zig23
-rw-r--r--codegen/gencat.zig9
-rw-r--r--codegen/hangul.zig9
-rw-r--r--codegen/lower.zig8
-rw-r--r--codegen/normp.zig9
-rw-r--r--codegen/numeric.zig9
-rw-r--r--codegen/props.zig9
-rw-r--r--codegen/scripts.zig11
-rw-r--r--codegen/upper.zig11
-rw-r--r--codegen/wbp.zig10
-rw-r--r--src/unicode_tests.zig23
19 files changed, 78 insertions, 147 deletions
diff --git a/build.zig b/build.zig
index 67a009a..5678cd1 100644
--- a/build.zig
+++ b/build.zig
@@ -48,6 +48,9 @@ pub fn build(b: *std.Build) void {
48 .optimize = .Debug, 48 .optimize = .Debug,
49 }), 49 }),
50 }); 50 });
51 gbp_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
52 gbp_gen_exe.root_module.addAnonymousImport("GraphemeBreakProperty.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/GraphemeBreakProperty.txt") });
53 gbp_gen_exe.root_module.addAnonymousImport("emoji-data.txt", .{ .root_source_file = b.path("data/unicode/emoji/emoji-data.txt") });
51 const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); 54 const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe);
52 const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z"); 55 const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z");
53 56
@@ -59,6 +62,7 @@ pub fn build(b: *std.Build) void {
59 .optimize = .Debug, 62 .optimize = .Debug,
60 }), 63 }),
61 }); 64 });
65 wbp_gen_exe.root_module.addAnonymousImport("WordBreakProperty.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/WordBreakProperty.txt") });
62 const run_wbp_gen_exe = b.addRunArtifact(wbp_gen_exe); 66 const run_wbp_gen_exe = b.addRunArtifact(wbp_gen_exe);
63 const wbp_gen_out = run_wbp_gen_exe.addOutputFileArg("wbp.bin.z"); 67 const wbp_gen_out = run_wbp_gen_exe.addOutputFileArg("wbp.bin.z");
64 68
@@ -70,6 +74,8 @@ pub fn build(b: *std.Build) void {
70 .optimize = .Debug, 74 .optimize = .Debug,
71 }), 75 }),
72 }); 76 });
77 dwp_gen_exe.root_module.addAnonymousImport("DerivedEastAsianWidth.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedEastAsianWidth.txt") });
78 dwp_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") });
73 dwp_gen_exe.root_module.addOptions("options", dwp_options); 79 dwp_gen_exe.root_module.addOptions("options", dwp_options);
74 const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); 80 const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe);
75 const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.bin.z"); 81 const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.bin.z");
@@ -83,6 +89,7 @@ pub fn build(b: *std.Build) void {
83 .optimize = .Debug, 89 .optimize = .Debug,
84 }), 90 }),
85 }); 91 });
92 canon_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
86 const run_canon_gen_exe = b.addRunArtifact(canon_gen_exe); 93 const run_canon_gen_exe = b.addRunArtifact(canon_gen_exe);
87 const canon_gen_out = run_canon_gen_exe.addOutputFileArg("canon.bin.z"); 94 const canon_gen_out = run_canon_gen_exe.addOutputFileArg("canon.bin.z");
88 95
@@ -94,6 +101,7 @@ pub fn build(b: *std.Build) void {
94 .optimize = .Debug, 101 .optimize = .Debug,
95 }), 102 }),
96 }); 103 });
104 compat_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
97 const run_compat_gen_exe = b.addRunArtifact(compat_gen_exe); 105 const run_compat_gen_exe = b.addRunArtifact(compat_gen_exe);
98 const compat_gen_out = run_compat_gen_exe.addOutputFileArg("compat.bin.z"); 106 const compat_gen_out = run_compat_gen_exe.addOutputFileArg("compat.bin.z");
99 107
@@ -105,6 +113,7 @@ pub fn build(b: *std.Build) void {
105 .optimize = .Debug, 113 .optimize = .Debug,
106 }), 114 }),
107 }); 115 });
116 hangul_gen_exe.root_module.addAnonymousImport("HangulSyllableType.txt", .{ .root_source_file = b.path("data/unicode/HangulSyllableType.txt") });
108 const run_hangul_gen_exe = b.addRunArtifact(hangul_gen_exe); 117 const run_hangul_gen_exe = b.addRunArtifact(hangul_gen_exe);
109 const hangul_gen_out = run_hangul_gen_exe.addOutputFileArg("hangul.bin.z"); 118 const hangul_gen_out = run_hangul_gen_exe.addOutputFileArg("hangul.bin.z");
110 119
@@ -116,6 +125,7 @@ pub fn build(b: *std.Build) void {
116 .optimize = .Debug, 125 .optimize = .Debug,
117 }), 126 }),
118 }); 127 });
128 normp_gen_exe.root_module.addAnonymousImport("DerivedNormalizationProps.txt", .{ .root_source_file = b.path("data/unicode/DerivedNormalizationProps.txt") });
119 const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe); 129 const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe);
120 const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.bin.z"); 130 const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.bin.z");
121 131
@@ -127,6 +137,7 @@ pub fn build(b: *std.Build) void {
127 .optimize = .Debug, 137 .optimize = .Debug,
128 }), 138 }),
129 }); 139 });
140 ccc_gen_exe.root_module.addAnonymousImport("DerivedCombiningClass.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedCombiningClass.txt") });
130 const run_ccc_gen_exe = b.addRunArtifact(ccc_gen_exe); 141 const run_ccc_gen_exe = b.addRunArtifact(ccc_gen_exe);
131 const ccc_gen_out = run_ccc_gen_exe.addOutputFileArg("ccc.bin.z"); 142 const ccc_gen_out = run_ccc_gen_exe.addOutputFileArg("ccc.bin.z");
132 143
@@ -138,6 +149,7 @@ pub fn build(b: *std.Build) void {
138 .optimize = .Debug, 149 .optimize = .Debug,
139 }), 150 }),
140 }); 151 });
152 gencat_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") });
141 const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe); 153 const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe);
142 const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z"); 154 const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z");
143 155
@@ -149,6 +161,8 @@ pub fn build(b: *std.Build) void {
149 .optimize = .Debug, 161 .optimize = .Debug,
150 }), 162 }),
151 }); 163 });
164 fold_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
165 fold_gen_exe.root_module.addAnonymousImport("CaseFolding.txt", .{ .root_source_file = b.path("data/unicode/CaseFolding.txt") });
152 const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe); 166 const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe);
153 const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z"); 167 const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z");
154 168
@@ -161,6 +175,7 @@ pub fn build(b: *std.Build) void {
161 .optimize = .Debug, 175 .optimize = .Debug,
162 }), 176 }),
163 }); 177 });
178 num_gen_exe.root_module.addAnonymousImport("DerivedNumericType.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedNumericType.txt") });
164 const run_num_gen_exe = b.addRunArtifact(num_gen_exe); 179 const run_num_gen_exe = b.addRunArtifact(num_gen_exe);
165 const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); 180 const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z");
166 181
@@ -173,6 +188,7 @@ pub fn build(b: *std.Build) void {
173 .optimize = .Debug, 188 .optimize = .Debug,
174 }), 189 }),
175 }); 190 });
191 case_prop_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
176 const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe); 192 const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe);
177 const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z"); 193 const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z");
178 194
@@ -185,6 +201,7 @@ pub fn build(b: *std.Build) void {
185 .optimize = .Debug, 201 .optimize = .Debug,
186 }), 202 }),
187 }); 203 });
204 upper_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
188 const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe); 205 const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe);
189 const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z"); 206 const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z");
190 207
@@ -197,6 +214,7 @@ pub fn build(b: *std.Build) void {
197 .optimize = .Debug, 214 .optimize = .Debug,
198 }), 215 }),
199 }); 216 });
217 lower_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
200 const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe); 218 const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe);
201 const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z"); 219 const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z");
202 220
@@ -208,6 +226,7 @@ pub fn build(b: *std.Build) void {
208 .optimize = .Debug, 226 .optimize = .Debug,
209 }), 227 }),
210 }); 228 });
229 scripts_gen_exe.root_module.addAnonymousImport("Scripts.txt", .{ .root_source_file = b.path("data/unicode/Scripts.txt") });
211 const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe); 230 const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe);
212 const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z"); 231 const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z");
213 232
@@ -219,6 +238,7 @@ pub fn build(b: *std.Build) void {
219 .optimize = .Debug, 238 .optimize = .Debug,
220 }), 239 }),
221 }); 240 });
241 core_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
222 const run_core_gen_exe = b.addRunArtifact(core_gen_exe); 242 const run_core_gen_exe = b.addRunArtifact(core_gen_exe);
223 const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z"); 243 const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z");
224 244
@@ -230,6 +250,8 @@ pub fn build(b: *std.Build) void {
230 .optimize = .Debug, 250 .optimize = .Debug,
231 }), 251 }),
232 }); 252 });
253
254 props_gen_exe.root_module.addAnonymousImport("PropList.txt", .{ .root_source_file = b.path("data/unicode/PropList.txt") });
233 const run_props_gen_exe = b.addRunArtifact(props_gen_exe); 255 const run_props_gen_exe = b.addRunArtifact(props_gen_exe);
234 const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z"); 256 const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z");
235 257
@@ -483,6 +505,9 @@ pub fn build(b: *std.Build) void {
483 .optimize = optimize, 505 .optimize = optimize,
484 }), 506 }),
485 }); 507 });
508 unicode_tests.root_module.addAnonymousImport("GraphemeBreakTest.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/GraphemeBreakTest.txt") });
509 unicode_tests.root_module.addAnonymousImport("NormalizationTest.txt", .{ .root_source_file = b.path("data/unicode/NormalizationTest.txt") });
510 unicode_tests.root_module.addAnonymousImport("WordBreakTest.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/WordBreakTest.txt") });
486 unicode_tests.root_module.addImport("Graphemes", graphemes); 511 unicode_tests.root_module.addImport("Graphemes", graphemes);
487 unicode_tests.root_module.addImport("Normalize", norm); 512 unicode_tests.root_module.addImport("Normalize", norm);
488 unicode_tests.root_module.addImport("Words", words); 513 unicode_tests.root_module.addImport("Words", words);
diff --git a/codegen/canon.zig b/codegen/canon.zig
index 89a9070..34e720f 100644
--- a/codegen/canon.zig
+++ b/codegen/canon.zig
@@ -6,13 +6,9 @@ pub fn main() anyerror!void {
6 defer arena.deinit(); 6 defer arena.deinit();
7 const allocator = arena.allocator(); 7 const allocator = arena.allocator();
8 8
9 var line_buf: [4096]u8 = undefined;
10 var write_buf: [4096]u8 = undefined; 9 var write_buf: [4096]u8 = undefined;
11 // Process UnicodeData.txt 10 // Process UnicodeData.txt
12 var in_file = try std.fs.cwd().openFile("data/unicode/UnicodeData.txt", .{}); 11 var in_reader = std.io.Reader.fixed(@embedFile("UnicodeData.txt"));
13 defer in_file.close();
14 var in_reader = in_file.reader(&line_buf);
15
16 var args_iter = try std.process.argsWithAllocator(allocator); 12 var args_iter = try std.process.argsWithAllocator(allocator);
17 defer args_iter.deinit(); 13 defer args_iter.deinit();
18 _ = args_iter.skip(); 14 _ = args_iter.skip();
@@ -24,7 +20,7 @@ pub fn main() anyerror!void {
24 var writer = &file_writer.interface; 20 var writer = &file_writer.interface;
25 const endian = builtin.cpu.arch.endian(); 21 const endian = builtin.cpu.arch.endian();
26 22
27 lines: while (in_reader.interface.takeDelimiterInclusive('\n')) |line| { 23 lines: while (in_reader.takeDelimiterInclusive('\n')) |line| {
28 if (line.len == 0) continue; 24 if (line.len == 0) continue;
29 25
30 var field_iter = std.mem.splitScalar(u8, line, ';'); 26 var field_iter = std.mem.splitScalar(u8, line, ';');
diff --git a/codegen/case_prop.zig b/codegen/case_prop.zig
index 66eb62c..46b8e65 100644
--- a/codegen/case_prop.zig
+++ b/codegen/case_prop.zig
@@ -30,14 +30,9 @@ pub fn main() anyerror!void {
30 var flat_map = std.AutoHashMap(u21, u8).init(allocator); 30 var flat_map = std.AutoHashMap(u21, u8).init(allocator);
31 defer flat_map.deinit(); 31 defer flat_map.deinit();
32 32
33 var line_buf: [4096]u8 = undefined;
34
35 // Process DerivedCoreProperties.txt 33 // Process DerivedCoreProperties.txt
36 var in_file = try std.fs.cwd().openFile("data/unicode/DerivedCoreProperties.txt", .{}); 34 var in_reader = std.io.Reader.fixed(@embedFile("DerivedCoreProperties.txt"));
37 defer in_file.close(); 35 while (in_reader.takeDelimiterExclusive('\n')) |line| {
38 var in_reader = in_file.reader(&line_buf);
39
40 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
41 if (line.len == 0 or line[0] == '#') continue; 36 if (line.len == 0 or line[0] == '#') continue;
42 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 37 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
43 38
diff --git a/codegen/ccc.zig b/codegen/ccc.zig
index b9b2bc3..48d3a9d 100644
--- a/codegen/ccc.zig
+++ b/codegen/ccc.zig
@@ -29,14 +29,9 @@ pub fn main() anyerror!void {
29 var flat_map = std.AutoHashMap(u21, u8).init(allocator); 29 var flat_map = std.AutoHashMap(u21, u8).init(allocator);
30 defer flat_map.deinit(); 30 defer flat_map.deinit();
31 31
32 var line_buf: [4096]u8 = undefined;
33
34 // Process DerivedCombiningClass.txt 32 // Process DerivedCombiningClass.txt
35 var cc_file = try std.fs.cwd().openFile("data/unicode/extracted/DerivedCombiningClass.txt", .{}); 33 var cc_reader = std.io.Reader.fixed(@embedFile("DerivedCombiningClass.txt"));
36 defer cc_file.close(); 34 while (cc_reader.takeDelimiterExclusive('\n')) |line| {
37 var cc_reader = cc_file.reader(&line_buf);
38
39 while (cc_reader.interface.takeDelimiterExclusive('\n')) |line| {
40 if (line.len == 0 or line[0] == '#') continue; 35 if (line.len == 0 or line[0] == '#') continue;
41 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 36 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
42 37
diff --git a/codegen/compat.zig b/codegen/compat.zig
index 835a636..0a06c44 100644
--- a/codegen/compat.zig
+++ b/codegen/compat.zig
@@ -7,12 +7,9 @@ pub fn main() anyerror!void {
7 const allocator = arena.allocator(); 7 const allocator = arena.allocator();
8 8
9 // Process UnicodeData.txt 9 // Process UnicodeData.txt
10 var in_file = try std.fs.cwd().openFile("data/unicode/UnicodeData.txt", .{});
11 defer in_file.close();
12 var line_buf: [4096]u8 = undefined;
13 var write_buf: [4096]u8 = undefined; 10 var write_buf: [4096]u8 = undefined;
14 var in_reader = in_file.reader(&line_buf);
15 11
12 var in_reader = std.io.Reader.fixed(@embedFile("UnicodeData.txt"));
16 var args_iter = try std.process.argsWithAllocator(allocator); 13 var args_iter = try std.process.argsWithAllocator(allocator);
17 defer args_iter.deinit(); 14 defer args_iter.deinit();
18 _ = args_iter.skip(); 15 _ = args_iter.skip();
@@ -24,7 +21,7 @@ pub fn main() anyerror!void {
24 21
25 const endian = builtin.cpu.arch.endian(); 22 const endian = builtin.cpu.arch.endian();
26 23
27 lines: while (in_reader.interface.takeDelimiterExclusive('\n')) |line| { 24 lines: while (in_reader.takeDelimiterExclusive('\n')) |line| {
28 if (line.len == 0) continue; 25 if (line.len == 0) continue;
29 26
30 var field_iter = std.mem.splitScalar(u8, line, ';'); 27 var field_iter = std.mem.splitScalar(u8, line, ';');
diff --git a/codegen/core_props.zig b/codegen/core_props.zig
index 19063f6..d59a77e 100644
--- a/codegen/core_props.zig
+++ b/codegen/core_props.zig
@@ -30,14 +30,9 @@ pub fn main() anyerror!void {
30 var flat_map = std.AutoHashMap(u21, u8).init(allocator); 30 var flat_map = std.AutoHashMap(u21, u8).init(allocator);
31 defer flat_map.deinit(); 31 defer flat_map.deinit();
32 32
33 var line_buf: [4096]u8 = undefined;
34
35 // Process DerivedCoreProperties.txt 33 // Process DerivedCoreProperties.txt
36 var in_file = try std.fs.cwd().openFile("data/unicode/DerivedCoreProperties.txt", .{}); 34 var in_reader = std.io.Reader.fixed(@embedFile("DerivedCoreProperties.txt"));
37 defer in_file.close(); 35 while (in_reader.takeDelimiterExclusive('\n')) |line| {
38 var in_reader = in_file.reader(&line_buf);
39
40 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
41 if (line.len == 0 or line[0] == '#') continue; 36 if (line.len == 0 or line[0] == '#') continue;
42 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 37 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
43 38
diff --git a/codegen/dwp.zig b/codegen/dwp.zig
index fad08d1..8189ad8 100644
--- a/codegen/dwp.zig
+++ b/codegen/dwp.zig
@@ -31,14 +31,10 @@ pub fn main() anyerror!void {
31 var flat_map = std.AutoHashMap(u21, i4).init(allocator); 31 var flat_map = std.AutoHashMap(u21, i4).init(allocator);
32 defer flat_map.deinit(); 32 defer flat_map.deinit();
33 33
34 var line_buf: [4096]u8 = undefined;
35
36 // Process DerivedEastAsianWidth.txt 34 // Process DerivedEastAsianWidth.txt
37 var deaw_file = try std.fs.cwd().openFile("data/unicode/extracted/DerivedEastAsianWidth.txt", .{}); 35 var deaw_reader = std.io.Reader.fixed(@embedFile("DerivedEastAsianWidth.txt"));
38 defer deaw_file.close();
39 var deaw_reader = deaw_file.reader(&line_buf);
40 36
41 while (deaw_reader.interface.takeDelimiterExclusive('\n')) |line| { 37 while (deaw_reader.takeDelimiterExclusive('\n')) |line| {
42 if (line.len == 0) continue; 38 if (line.len == 0) continue;
43 39
44 // @missing ranges 40 // @missing ranges
@@ -94,11 +90,9 @@ pub fn main() anyerror!void {
94 }, 90 },
95 } 91 }
96 // Process DerivedGeneralCategory.txt 92 // Process DerivedGeneralCategory.txt
97 var dgc_file = try std.fs.cwd().openFile("data/unicode/extracted/DerivedGeneralCategory.txt", .{}); 93 var dgc_reader = std.io.Reader.fixed(@embedFile("DerivedGeneralCategory.txt"));
98 defer dgc_file.close();
99 var dgc_reader = dgc_file.reader(&line_buf);
100 94
101 while (dgc_reader.interface.takeDelimiterExclusive('\n')) |line| { 95 while (dgc_reader.takeDelimiterExclusive('\n')) |line| {
102 if (line.len == 0 or line[0] == '#') continue; 96 if (line.len == 0 or line[0] == '#') continue;
103 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 97 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
104 98
diff --git a/codegen/fold.zig b/codegen/fold.zig
index cc381a8..d927795 100644
--- a/codegen/fold.zig
+++ b/codegen/fold.zig
@@ -7,16 +7,13 @@ pub fn main() anyerror!void {
7 defer std.debug.assert(gpa.deinit() == .ok); 7 defer std.debug.assert(gpa.deinit() == .ok);
8 const allocator = gpa.allocator(); 8 const allocator = gpa.allocator();
9 9
10 var line_buf: [4096]u8 = undefined;
11 // Process DerivedCoreProperties.txt 10 // Process DerivedCoreProperties.txt
12 var props_file = try std.fs.cwd().openFile("data/unicode/DerivedCoreProperties.txt", .{}); 11 var props_reader = std.io.Reader.fixed(@embedFile("DerivedCoreProperties.txt"));
13 defer props_file.close();
14 var props_reader = props_file.reader(&line_buf);
15 12
16 var props_map = std.AutoHashMap(u21, void).init(allocator); 13 var props_map = std.AutoHashMap(u21, void).init(allocator);
17 defer props_map.deinit(); 14 defer props_map.deinit();
18 15
19 props_lines: while (props_reader.interface.takeDelimiterExclusive('\n')) |line| { 16 props_lines: while (props_reader.takeDelimiterExclusive('\n')) |line| {
20 if (line.len == 0 or line[0] == '#') continue; 17 if (line.len == 0 or line[0] == '#') continue;
21 18
22 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 19 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
@@ -57,11 +54,9 @@ pub fn main() anyerror!void {
57 defer codepoint_mapping.deinit(); 54 defer codepoint_mapping.deinit();
58 55
59 // Process CaseFolding.txt 56 // Process CaseFolding.txt
60 var cp_file = try std.fs.cwd().openFile("data/unicode/CaseFolding.txt", .{});
61 defer cp_file.close();
62 var cp_reader = cp_file.reader(&line_buf);
63 57
64 while (cp_reader.interface.takeDelimiterExclusive('\n')) |line| { 58 var cp_reader = std.io.Reader.fixed(@embedFile("CaseFolding.txt"));
59 while (cp_reader.takeDelimiterExclusive('\n')) |line| {
65 if (line.len == 0 or line[0] == '#') continue; 60 if (line.len == 0 or line[0] == '#') continue;
66 61
67 var field_it = std.mem.splitScalar(u8, line, ';'); 62 var field_it = std.mem.splitScalar(u8, line, ';');
diff --git a/codegen/gbp.zig b/codegen/gbp.zig
index d654cf1..895aa7a 100644
--- a/codegen/gbp.zig
+++ b/codegen/gbp.zig
@@ -61,14 +61,11 @@ pub fn main() anyerror!void {
61 var emoji_set = std.AutoHashMap(u21, void).init(allocator); 61 var emoji_set = std.AutoHashMap(u21, void).init(allocator);
62 defer emoji_set.deinit(); 62 defer emoji_set.deinit();
63 63
64 var line_buf: [4096]u8 = undefined;
65
66 // Process Indic 64 // Process Indic
67 var indic_file = try std.fs.cwd().openFile("data/unicode/DerivedCoreProperties.txt", .{}); 65 const indic_file = @embedFile("DerivedCoreProperties.txt");
68 defer indic_file.close(); 66 var indic_reader = std.io.Reader.fixed(indic_file);
69 var indic_reader = indic_file.reader(&line_buf);
70 67
71 while (indic_reader.interface.takeDelimiterExclusive('\n')) |line| { 68 while (indic_reader.takeDelimiterExclusive('\n')) |line| {
72 if (line.len == 0 or line[0] == '#') continue; 69 if (line.len == 0 or line[0] == '#') continue;
73 if (std.mem.indexOf(u8, line, "InCB") == null) continue; 70 if (std.mem.indexOf(u8, line, "InCB") == null) continue;
74 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 71 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
@@ -106,11 +103,10 @@ pub fn main() anyerror!void {
106 }, 103 },
107 } 104 }
108 // Process GBP 105 // Process GBP
109 var gbp_file = try std.fs.cwd().openFile("data/unicode/auxiliary/GraphemeBreakProperty.txt", .{});
110 defer gbp_file.close();
111 var gbp_reader = gbp_file.reader(&line_buf);
112 106
113 while (gbp_reader.interface.takeDelimiterExclusive('\n')) |line| { 107 var gbp_reader = std.io.Reader.fixed(@embedFile("GraphemeBreakProperty.txt"));
108
109 while (gbp_reader.takeDelimiterExclusive('\n')) |line| {
114 if (line.len == 0 or line[0] == '#') continue; 110 if (line.len == 0 or line[0] == '#') continue;
115 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 111 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
116 112
@@ -147,11 +143,10 @@ pub fn main() anyerror!void {
147 }, 143 },
148 } 144 }
149 // Process Emoji 145 // Process Emoji
150 var emoji_file = try std.fs.cwd().openFile("data/unicode/emoji/emoji-data.txt", .{});
151 defer emoji_file.close();
152 var emoji_reader = emoji_file.reader(&line_buf);
153 146
154 while (emoji_reader.interface.takeDelimiterExclusive('\n')) |line| { 147 var emoji_reader = std.io.Reader.fixed(@embedFile("emoji-data.txt"));
148
149 while (emoji_reader.takeDelimiterExclusive('\n')) |line| {
155 if (line.len == 0 or line[0] == '#') continue; 150 if (line.len == 0 or line[0] == '#') continue;
156 if (std.mem.indexOf(u8, line, "Extended_Pictographic") == null) continue; 151 if (std.mem.indexOf(u8, line, "Extended_Pictographic") == null) continue;
157 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 152 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
diff --git a/codegen/gencat.zig b/codegen/gencat.zig
index 7dedb5d..79fa072 100644
--- a/codegen/gencat.zig
+++ b/codegen/gencat.zig
@@ -62,14 +62,9 @@ pub fn main() !void {
62 var flat_map = std.AutoHashMap(u21, u5).init(allocator); 62 var flat_map = std.AutoHashMap(u21, u5).init(allocator);
63 defer flat_map.deinit(); 63 defer flat_map.deinit();
64 64
65 var line_buf: [4096]u8 = undefined;
66
67 // Process DerivedGeneralCategory.txt 65 // Process DerivedGeneralCategory.txt
68 var in_file = try std.fs.cwd().openFile("data/unicode/extracted/DerivedGeneralCategory.txt", .{}); 66 var in_reader = std.io.Reader.fixed(@embedFile("DerivedGeneralCategory.txt"));
69 defer in_file.close(); 67 while (in_reader.takeDelimiterExclusive('\n')) |line| {
70 var in_reader = in_file.reader(&line_buf);
71
72 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
73 if (line.len == 0 or line[0] == '#') continue; 68 if (line.len == 0 or line[0] == '#') continue;
74 69
75 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 70 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
diff --git a/codegen/hangul.zig b/codegen/hangul.zig
index 6768b3f..64ab11c 100644
--- a/codegen/hangul.zig
+++ b/codegen/hangul.zig
@@ -38,14 +38,9 @@ pub fn main() anyerror!void {
38 var flat_map = std.AutoHashMap(u21, u3).init(allocator); 38 var flat_map = std.AutoHashMap(u21, u3).init(allocator);
39 defer flat_map.deinit(); 39 defer flat_map.deinit();
40 40
41 var line_buf: [4096]u8 = undefined;
42
43 // Process HangulSyllableType.txt 41 // Process HangulSyllableType.txt
44 var in_file = try std.fs.cwd().openFile("data/unicode/HangulSyllableType.txt", .{}); 42 var in_reader = std.io.Reader.fixed(@embedFile("HangulSyllableType.txt"));
45 defer in_file.close(); 43 while (in_reader.takeDelimiterExclusive('\n')) |line| {
46 var in_reader = in_file.reader(&line_buf);
47
48 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
49 if (line.len == 0 or line[0] == '#') continue; 44 if (line.len == 0 or line[0] == '#') continue;
50 45
51 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 46 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
diff --git a/codegen/lower.zig b/codegen/lower.zig
index c11cb0a..987f004 100644
--- a/codegen/lower.zig
+++ b/codegen/lower.zig
@@ -6,13 +6,9 @@ pub fn main() !void {
6 defer arena.deinit(); 6 defer arena.deinit();
7 const allocator = arena.allocator(); 7 const allocator = arena.allocator();
8 8
9 var line_buf: [4096]u8 = undefined;
10 var write_buf: [4096]u8 = undefined; 9 var write_buf: [4096]u8 = undefined;
11 // Process UnicodeData.txt 10 // Process UnicodeData.txt
12 var in_file = try std.fs.cwd().openFile("data/unicode/UnicodeData.txt", .{}); 11 var in_reader = std.io.Reader.fixed(@embedFile("UnicodeData.txt"));
13 defer in_file.close();
14 var in_reader = in_file.reader(&line_buf);
15
16 var args_iter = try std.process.argsWithAllocator(allocator); 12 var args_iter = try std.process.argsWithAllocator(allocator);
17 defer args_iter.deinit(); 13 defer args_iter.deinit();
18 _ = args_iter.skip(); 14 _ = args_iter.skip();
@@ -24,7 +20,7 @@ pub fn main() !void {
24 20
25 const endian = builtin.cpu.arch.endian(); 21 const endian = builtin.cpu.arch.endian();
26 22
27 lines: while (in_reader.interface.takeDelimiterExclusive('\n')) |line| { 23 lines: while (in_reader.takeDelimiterExclusive('\n')) |line| {
28 if (line.len == 0) continue; 24 if (line.len == 0) continue;
29 25
30 var field_iter = std.mem.splitScalar(u8, line, ';'); 26 var field_iter = std.mem.splitScalar(u8, line, ';');
diff --git a/codegen/normp.zig b/codegen/normp.zig
index 71a1ae5..3cdd770 100644
--- a/codegen/normp.zig
+++ b/codegen/normp.zig
@@ -29,14 +29,9 @@ pub fn main() anyerror!void {
29 var flat_map = std.AutoHashMap(u21, u3).init(allocator); 29 var flat_map = std.AutoHashMap(u21, u3).init(allocator);
30 defer flat_map.deinit(); 30 defer flat_map.deinit();
31 31
32 var line_buf: [4096]u8 = undefined;
33
34 // Process DerivedNormalizationProps.txt 32 // Process DerivedNormalizationProps.txt
35 var in_file = try std.fs.cwd().openFile("data/unicode/DerivedNormalizationProps.txt", .{}); 33 var in_reader = std.io.Reader.fixed(@embedFile("DerivedNormalizationProps.txt"));
36 defer in_file.close(); 34 while (in_reader.takeDelimiterExclusive('\n')) |line| {
37 var in_reader = in_file.reader(&line_buf);
38
39 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
40 if (line.len == 0 or line[0] == '#') continue; 35 if (line.len == 0 or line[0] == '#') continue;
41 36
42 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 37 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
diff --git a/codegen/numeric.zig b/codegen/numeric.zig
index cf918e8..d6b3165 100644
--- a/codegen/numeric.zig
+++ b/codegen/numeric.zig
@@ -30,14 +30,9 @@ pub fn main() anyerror!void {
30 var flat_map = std.AutoHashMap(u21, u8).init(allocator); 30 var flat_map = std.AutoHashMap(u21, u8).init(allocator);
31 defer flat_map.deinit(); 31 defer flat_map.deinit();
32 32
33 var line_buf: [4096]u8 = undefined;
34
35 // Process DerivedNumericType.txt 33 // Process DerivedNumericType.txt
36 var in_file = try std.fs.cwd().openFile("data/unicode/extracted/DerivedNumericType.txt", .{}); 34 var in_reader = std.io.Reader.fixed(@embedFile("DerivedNumericType.txt"));
37 defer in_file.close(); 35 while (in_reader.takeDelimiterExclusive('\n')) |line| {
38 var in_reader = in_file.reader(&line_buf);
39
40 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
41 if (line.len == 0 or line[0] == '#') continue; 36 if (line.len == 0 or line[0] == '#') continue;
42 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 37 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
43 38
diff --git a/codegen/props.zig b/codegen/props.zig
index 6ff0a33..ca42987 100644
--- a/codegen/props.zig
+++ b/codegen/props.zig
@@ -30,14 +30,9 @@ pub fn main() anyerror!void {
30 var flat_map = std.AutoHashMap(u21, u8).init(allocator); 30 var flat_map = std.AutoHashMap(u21, u8).init(allocator);
31 defer flat_map.deinit(); 31 defer flat_map.deinit();
32 32
33 var line_buf: [4096]u8 = undefined;
34
35 // Process PropList.txt 33 // Process PropList.txt
36 var in_file = try std.fs.cwd().openFile("data/unicode/PropList.txt", .{}); 34 var in_reader = std.io.Reader.fixed(@embedFile("PropList.txt"));
37 defer in_file.close(); 35 while (in_reader.takeDelimiterExclusive('\n')) |line| {
38 var in_reader = in_file.reader(&line_buf);
39
40 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
41 if (line.len == 0 or line[0] == '#') continue; 36 if (line.len == 0 or line[0] == '#') continue;
42 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 37 const no_comment = if (mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
43 38
diff --git a/codegen/scripts.zig b/codegen/scripts.zig
index bdd3d9d..81511cc 100644
--- a/codegen/scripts.zig
+++ b/codegen/scripts.zig
@@ -203,14 +203,9 @@ pub fn main() anyerror!void {
203 var flat_map = std.AutoHashMap(u21, u8).init(allocator); 203 var flat_map = std.AutoHashMap(u21, u8).init(allocator);
204 defer flat_map.deinit(); 204 defer flat_map.deinit();
205 205
206 var line_buf: [4096]u8 = undefined; 206 // Process Scripts.txt
207 207 var in_reader = std.io.Reader.fixed(@embedFile("Scripts.txt"));
208 // Process DerivedGeneralCategory.txt 208 while (in_reader.takeDelimiterExclusive('\n')) |line| {
209 var in_file = try std.fs.cwd().openFile("data/unicode/Scripts.txt", .{});
210 defer in_file.close();
211 var in_reader = in_file.reader(&line_buf);
212
213 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
214 if (line.len == 0 or line[0] == '#') continue; 209 if (line.len == 0 or line[0] == '#') continue;
215 210
216 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 211 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
diff --git a/codegen/upper.zig b/codegen/upper.zig
index 7d96a0e..108fdbd 100644
--- a/codegen/upper.zig
+++ b/codegen/upper.zig
@@ -6,13 +6,9 @@ pub fn main() anyerror!void {
6 defer arena.deinit(); 6 defer arena.deinit();
7 const allocator = arena.allocator(); 7 const allocator = arena.allocator();
8 8
9 var line_buf: [4096]u8 = undefined;
10 var write_buf: [4096]u8 = undefined; 9 var write_buf: [4096]u8 = undefined;
11 // Process UnicodeData.txt 10 // Process UnicodeData.txt
12 var in_file = try std.fs.cwd().openFile("data/unicode/UnicodeData.txt", .{}); 11 var in_reader = std.io.Reader.fixed(@embedFile("UnicodeData.txt"));
13 defer in_file.close();
14 var in_reader = in_file.reader(&line_buf);
15
16 var args_iter = try std.process.argsWithAllocator(allocator); 12 var args_iter = try std.process.argsWithAllocator(allocator);
17 defer args_iter.deinit(); 13 defer args_iter.deinit();
18 _ = args_iter.skip(); 14 _ = args_iter.skip();
@@ -23,7 +19,7 @@ pub fn main() anyerror!void {
23 var file_writer = out_file.writer(&write_buf); 19 var file_writer = out_file.writer(&write_buf);
24 const endian = builtin.cpu.arch.endian(); 20 const endian = builtin.cpu.arch.endian();
25 21
26 lines: while (in_reader.interface.takeDelimiterExclusive('\n')) |line| { 22 lines: while (in_reader.takeDelimiterExclusive('\n')) |line| {
27 if (line.len == 0) continue; 23 if (line.len == 0) continue;
28 24
29 var field_iter = std.mem.splitScalar(u8, line, ';'); 25 var field_iter = std.mem.splitScalar(u8, line, ';');
@@ -48,9 +44,6 @@ pub fn main() anyerror!void {
48 } 44 }
49 } 45 }
50 } else |err| switch (err) { 46 } else |err| switch (err) {
51 error.ReadFailed => {
52 return in_reader.err orelse err;
53 },
54 error.EndOfStream => {}, 47 error.EndOfStream => {},
55 else => { 48 else => {
56 return err; 49 return err;
diff --git a/codegen/wbp.zig b/codegen/wbp.zig
index b1ed56a..dfdc32e 100644
--- a/codegen/wbp.zig
+++ b/codegen/wbp.zig
@@ -51,14 +51,10 @@ pub fn main() anyerror!void {
51 var flat_map = std.AutoHashMap(u21, u5).init(allocator); 51 var flat_map = std.AutoHashMap(u21, u5).init(allocator);
52 defer flat_map.deinit(); 52 defer flat_map.deinit();
53 53
54 var line_buf: [4096]u8 = undefined;
55
56 // Process HangulSyllableType.txt 54 // Process HangulSyllableType.txt
57 var in_file = try std.fs.cwd().openFile("data/unicode/auxiliary/WordBreakProperty.txt", .{}); 55 const in_file = @embedFile("WordBreakProperty.txt");
58 defer in_file.close(); 56 var in_reader = std.io.Reader.fixed(in_file);
59 var in_reader = in_file.reader(&line_buf); 57 while (in_reader.takeDelimiterExclusive('\n')) |line| {
60
61 while (in_reader.interface.takeDelimiterExclusive('\n')) |line| {
62 if (line.len == 0 or line[0] == '#') continue; 58 if (line.len == 0 or line[0] == '#') continue;
63 59
64 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line; 60 const no_comment = if (std.mem.indexOfScalar(u8, line, '#')) |octo| line[0..octo] else line;
diff --git a/src/unicode_tests.zig b/src/unicode_tests.zig
index ff49b2a..875c5f0 100644
--- a/src/unicode_tests.zig
+++ b/src/unicode_tests.zig
@@ -8,14 +8,10 @@ test "Unicode normalization tests" {
8 const n = try Normalize.init(allocator); 8 const n = try Normalize.init(allocator);
9 defer n.deinit(allocator); 9 defer n.deinit(allocator);
10 10
11 var file = try fs.cwd().openFile("data/unicode/NormalizationTest.txt", .{}); 11 var reader = std.io.Reader.fixed(@embedFile("NormalizationTest.txt"));
12 defer file.close();
13 var buf: [4096]u8 = undefined;
14 var reader = file.reader(&buf);
15
16 var cp_buf: [4]u8 = undefined; 12 var cp_buf: [4]u8 = undefined;
17 13
18 var line_iter: IterRead = .{ .read = &reader.interface }; 14 var line_iter: IterRead = .{ .read = &reader };
19 15
20 while (line_iter.next()) |line| { 16 while (line_iter.next()) |line| {
21 // Iterate over fields. 17 // Iterate over fields.
@@ -120,15 +116,12 @@ test "Unicode normalization tests" {
120 116
121test "Segmentation GraphemeIterator" { 117test "Segmentation GraphemeIterator" {
122 const allocator = std.testing.allocator; 118 const allocator = std.testing.allocator;
123 var file = try std.fs.cwd().openFile("data/unicode/auxiliary/GraphemeBreakTest.txt", .{});
124 defer file.close();
125 var buf: [4096]u8 = undefined;
126 var reader = file.reader(&buf);
127 119
120 var reader = std.io.Reader.fixed(@embedFile("GraphemeBreakTest.txt"));
128 const graph = try Graphemes.init(allocator); 121 const graph = try Graphemes.init(allocator);
129 defer graph.deinit(allocator); 122 defer graph.deinit(allocator);
130 123
131 var line_iter: IterRead = .{ .read = &reader.interface }; 124 var line_iter: IterRead = .{ .read = &reader };
132 125
133 while (line_iter.next()) |raw| { 126 while (line_iter.next()) |raw| {
134 // Clean up. 127 // Clean up.
@@ -263,15 +256,11 @@ test "Segmentation GraphemeIterator" {
263 256
264test "Segmentation Word Iterator" { 257test "Segmentation Word Iterator" {
265 const allocator = std.testing.allocator; 258 const allocator = std.testing.allocator;
266 var file = try std.fs.cwd().openFile("data/unicode/auxiliary/WordBreakTest.txt", .{}); 259 var reader = std.io.Reader.fixed(@embedFile("WordBreakTest.txt"));
267 defer file.close();
268 var buf: [4096]u8 = undefined;
269 var reader = file.reader(&buf);
270
271 const wb = try Words.init(allocator); 260 const wb = try Words.init(allocator);
272 defer wb.deinit(allocator); 261 defer wb.deinit(allocator);
273 262
274 var line_iter: IterRead = .{ .read = &reader.interface }; 263 var line_iter: IterRead = .{ .read = &reader };
275 264
276 while (line_iter.next()) |raw| { 265 while (line_iter.next()) |raw| {
277 // Clean up. 266 // Clean up.