diff options
| author | 2025-09-14 04:11:09 -0700 | |
|---|---|---|
| committer | 2025-09-14 04:11:09 -0700 | |
| commit | 749197a3f9d25e211615960c02380a3d659b20f9 (patch) | |
| tree | 9c892349f0a7136edb150f27f549dc182f7699bb /codegen/wbp.zig | |
| parent | Update codebase to Zig 0.15.1. (diff) | |
| download | zg-749197a3f9d25e211615960c02380a3d659b20f9.tar.gz zg-749197a3f9d25e211615960c02380a3d659b20f9.tar.xz zg-749197a3f9d25e211615960c02380a3d659b20f9.zip | |
Embed data files in scripts rather than relying on filesystem access for easier packaging
Diffstat (limited to 'codegen/wbp.zig')
| -rw-r--r-- | codegen/wbp.zig | 10 |
1 files changed, 3 insertions, 7 deletions
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; |