pr feedback: `get`, remove todos for case_folding_simple

pull/8757/head
Jacob Sandlund 2025-09-19 01:24:13 -04:00
parent 4fc8faa01e
commit cf3b514efc
8 changed files with 9 additions and 18 deletions

View File

@ -42,8 +42,8 @@
.lazy = true,
},
.uucode = .{
.url = "https://github.com/jacobsandlund/uucode/archive/3512203ca991c02b2500392d1d51226c48131c99.tar.gz",
.hash = "uucode-0.0.0-ZZjBPgErQADBJsnLdcZKdRk94lB28CbKC4OrUDPOnSeV",
.url = "https://github.com/jacobsandlund/uucode/archive/f748edb9639d9b3c8ae13d6190953f419a615343.tar.gz",
.hash = "uucode-0.0.0-ZZjBPk0GQACuYIoFqT_Vzkvn8Ur_M3dE7o4DNUE65Z7v",
},
.zig_wayland = .{
// codeberg ifreund/zig-wayland

View File

@ -208,7 +208,7 @@ fn stepUucode(ptr: *anyopaque) Benchmark.Error!void {
std.mem.doNotOptimizeAway(if (cp <= 0xFF)
1
else
uucode.getX(.width, @intCast(cp)));
uucode.get(.width, @intCast(cp)));
}
}
}

View File

@ -104,7 +104,7 @@ fn stepUucode(ptr: *anyopaque) Benchmark.Error!void {
const cp_, const consumed = d.next(c);
assert(consumed);
if (cp_) |cp| {
std.mem.doNotOptimizeAway(uucode.getX(.is_symbol, cp));
std.mem.doNotOptimizeAway(uucode.get(.is_symbol, cp));
}
}
}

View File

@ -64,28 +64,22 @@ pub const tables = [_]config.Table{
.fields = &.{
d.field("is_emoji_presentation"),
d.field("case_folding_full"),
// TODO: Alternatively, use:
// d.field("case_folding_simple"),
d.field("is_emoji_modifier"),
d.field("is_emoji_modifier_base"),
},
},
.{
.stages = .two,
.extensions = &.{ wcwidth, width },
.fields = &.{
width.field("width"),
},
},
.{
.stages = .two,
.extensions = &.{},
.fields = &.{
d.field("grapheme_break"),
},
},
.{
.stages = .two,
.extensions = &.{is_symbol},
.fields = &.{
is_symbol.field("is_symbol"),

View File

@ -1609,9 +1609,6 @@ pub const Trigger = struct {
.unicode => |cp| std.hash.autoHash(
hasher,
foldedCodepoint(cp),
// TODO: Alternatively, just use simple case folding, and
// delete `foldedCodepoint` below:
// uucode.get(.case_folding_simple, cp),
),
}
std.hash.autoHash(hasher, self.mods.binding());

View File

@ -35,7 +35,7 @@ test "codepointWidth basic" {
// const uu = if (cp > uucode.config.max_code_point)
// 1
// else
// uucode.getX(.width, @intCast(cp));
// uucode.get(.width, @intCast(cp));
// if (simd != uu) mismatch: {
// if (cp == 0x2E3B) {
// try testing.expectEqual(@as(i8, 2), simd);

View File

@ -131,7 +131,7 @@ pub fn get(cp: u21) Properties {
const width = if (cp > uucode.config.max_code_point)
1
else
uucode.getX(.width, cp);
uucode.get(.width, cp);
return .{
.width = width,
@ -188,7 +188,7 @@ test "unicode props: tables match uucode" {
const uu = if (cp > uucode.config.max_code_point)
1
else
uucode.getX(.width, @intCast(cp));
uucode.get(.width, @intCast(cp));
if (t.width != uu) {
std.log.warn("mismatch cp=U+{x} t={} uu={}", .{ cp, t.width, uu });
try testing.expect(false);

View File

@ -31,7 +31,7 @@ pub fn main() !void {
return if (cp > uucode.config.max_code_point)
false
else
uucode.getX(.is_symbol, @intCast(cp));
uucode.get(.is_symbol, @intCast(cp));
}
pub fn eql(ctx: @This(), a: bool, b: bool) bool {
@ -65,7 +65,7 @@ test "unicode symbols: tables match uucode" {
const uu = if (cp > uucode.config.max_code_point)
false
else
uucode.getX(.is_symbol, @intCast(cp));
uucode.get(.is_symbol, @intCast(cp));
if (t != uu) {
std.log.warn("mismatch cp=U+{x} t={} uu={}", .{ cp, t, uu });