summaryrefslogtreecommitdiff
path: root/src/unicode
diff options
context:
space:
mode:
authorJacob Sandlund <jacob@jacobsandlund.com>2025-09-23 09:54:09 -0400
committerJacob Sandlund <jacob@jacobsandlund.com>2025-09-23 10:01:23 -0400
commitb5c6c044a724ec161a1793e308531bd82b75d56c (patch)
tree00b7a47aa4ee73742371915da1b0140029acd373 /src/unicode
parentc2a9c5ee5b3be5cad1952bb3c569b2abf1d0cf69 (diff)
Fix merge
Diffstat (limited to 'src/unicode')
-rw-r--r--src/unicode/props_table.zig2
-rw-r--r--src/unicode/props_uucode.zig2
-rw-r--r--src/unicode/symbols_table.zig2
-rw-r--r--src/unicode/symbols_uucode.zig41
4 files changed, 44 insertions, 3 deletions
diff --git a/src/unicode/props_table.zig b/src/unicode/props_table.zig
index d4ddfebbb..cac0a38b3 100644
--- a/src/unicode/props_table.zig
+++ b/src/unicode/props_table.zig
@@ -8,7 +8,7 @@ pub const table = table: {
// build.zig process, but due to Zig's lazy analysis we can still reference
// it here.
//
- // An example process is the `main` in `props_ziglyph.zig`
+ // An example process is the `main` in `props_uucode.zig`
const generated = @import("unicode_tables").Tables(Properties);
const Tables = lut.Tables(Properties);
break :table Tables{
diff --git a/src/unicode/props_uucode.zig b/src/unicode/props_uucode.zig
index 449c04ddf..fe9de37ab 100644
--- a/src/unicode/props_uucode.zig
+++ b/src/unicode/props_uucode.zig
@@ -55,7 +55,7 @@ pub fn get(cp: u21) Properties {
return .{
.width = width,
- .grapheme_boundary_class = .init(cp),
+ .grapheme_boundary_class = graphemeBoundaryClass(cp),
};
}
diff --git a/src/unicode/symbols_table.zig b/src/unicode/symbols_table.zig
index af77d88fd..da2614cae 100644
--- a/src/unicode/symbols_table.zig
+++ b/src/unicode/symbols_table.zig
@@ -7,7 +7,7 @@ pub const table = table: {
// build.zig process, but due to Zig's lazy analysis we can still reference
// it here.
//
- // An example process is the `main` in `symbols_ziglyph.zig`
+ // An example process is the `main` in `symbols_uucode.zig`
const generated = @import("symbols_tables").Tables(bool);
const Tables = lut.Tables(bool);
break :table Tables{
diff --git a/src/unicode/symbols_uucode.zig b/src/unicode/symbols_uucode.zig
new file mode 100644
index 000000000..d78a2b234
--- /dev/null
+++ b/src/unicode/symbols_uucode.zig
@@ -0,0 +1,41 @@
+const std = @import("std");
+const uucode = @import("uucode");
+const lut = @import("lut.zig");
+
+/// Runnable binary to generate the lookup tables and output to stdout.
+pub fn main() !void {
+ var arena_state = std.heap.ArenaAllocator.init(std.heap.page_allocator);
+ defer arena_state.deinit();
+ const alloc = arena_state.allocator();
+
+ const gen: lut.Generator(
+ bool,
+ struct {
+ pub fn get(ctx: @This(), cp: u21) !bool {
+ _ = ctx;
+ return if (cp > uucode.config.max_code_point)
+ false
+ else
+ uucode.get(.is_symbol, @intCast(cp));
+ }
+
+ pub fn eql(ctx: @This(), a: bool, b: bool) bool {
+ _ = ctx;
+ return a == b;
+ }
+ },
+ ) = .{};
+
+ const t = try gen.generate(alloc);
+ defer alloc.free(t.stage1);
+ defer alloc.free(t.stage2);
+ defer alloc.free(t.stage3);
+ try t.writeZig(std.io.getStdOut().writer());
+
+ // Uncomment when manually debugging to see our table sizes.
+ // std.log.warn("stage1={} stage2={} stage3={}", .{
+ // t.stage1.len,
+ // t.stage2.len,
+ // t.stage3.len,
+ // });
+}