summaryrefslogtreecommitdiff
path: root/codegen/scripts.zig
diff options
context:
space:
mode:
authorGravatar Sam Atman2026-02-04 18:36:18 -0500
committerGravatar Sam Atman2026-02-04 18:36:18 -0500
commite476250ea9326b2550847b301c265115ff375a31 (patch)
treecf627ced47cecce80020b7a1f30aa51852c0c59b /codegen/scripts.zig
parentNormalization and case folding (diff)
downloadzg-e476250ea9326b2550847b301c265115ff375a31.tar.gz
zg-e476250ea9326b2550847b301c265115ff375a31.tar.xz
zg-e476250ea9326b2550847b301c265115ff375a31.zip
Rest of the 'easy' stuff
This gets us up to feature parity with Jacob's work. I want to eliminate that last allocation using the comptime hash map, and then see about eliminating allocations from case comparisons as well. That should just about do it.
Diffstat (limited to 'codegen/scripts.zig')
-rw-r--r--codegen/scripts.zig31
1 files changed, 24 insertions, 7 deletions
diff --git a/codegen/scripts.zig b/codegen/scripts.zig
index 0f0194c..6bd5866 100644
--- a/codegen/scripts.zig
+++ b/codegen/scripts.zig
@@ -299,15 +299,32 @@ pub fn main() anyerror!void {
299 defer out_file.close(); 299 defer out_file.close();
300 var writer = out_file.writer(&write_buf); 300 var writer = out_file.writer(&write_buf);
301 301
302 const endian = builtin.cpu.arch.endian(); 302 try writer.interface.print(
303 try writer.interface.writeInt(u16, @intCast(stage1.items.len), endian); 303 \\//! This file is auto-generated. Do not edit.
304 for (stage1.items) |i| try writer.interface.writeInt(u16, i, endian); 304 \\
305 \\pub const s1: [{}]u16 = .{{
306 , .{stage1.items.len});
307 for (stage1.items) |entry| try writer.interface.print("{}, ", .{entry});
305 308
306 try writer.interface.writeInt(u16, @intCast(stage2.items.len), endian); 309 try writer.interface.print(
307 for (stage2.items) |i| try writer.interface.writeInt(u8, i, endian); 310 \\
311 \\}};
312 \\
313 \\pub const s2: [{}]u8 = .{{
314 , .{stage2.items.len});
315 for (stage2.items) |entry| try writer.interface.print("{}, ", .{entry});
308 316
309 try writer.interface.writeInt(u8, @intCast(stage3.items.len), endian); 317 try writer.interface.print(
310 for (stage3.items) |i| try writer.interface.writeInt(u8, i, endian); 318 \\
319 \\}};
320 \\
321 \\pub const s3: [{}]u8 = .{{
322 , .{stage3.items.len});
323 for (stage3.items) |entry| try writer.interface.print("{}, ", .{entry});
324
325 try writer.interface.writeAll(
326 \\};
327 );
311 328
312 try writer.interface.flush(); 329 try writer.interface.flush();
313} 330}