summaryrefslogtreecommitdiff
path: root/tools/gen_builtins_json.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 22:49:11 -0300
committerGabriel Schneider <[email protected]>2026-11-06 23:38:31 -0300
commitdbff3a5bb1d47e5a348ce7e91073df43b29b3e44 (patch)
tree02bd08fb2747a893c532651ce39d0ba6d7c67a61 /tools/gen_builtins_json.zig
parentd03b727cddfcec41b464ddf6178f17d0e831e529 (diff)
downloadpardes-dbff3a5bb1d47e5a348ce7e91073df43b29b3e44.tar.gz
pardes-dbff3a5bb1d47e5a348ce7e91073df43b29b3e44.zip
kinds #51, builtins-json lists the shipped addons' words, read off the Zig kinds' `Word` lines (image.zig and pdf.zig, handed to the generator and read by the staleness test), each `"addon"` first so the docs test's search for a builtin never meets one and an addon word the docs name is checked against the sources (renaming PdfFit fails it); the glossary says whose addon a word is, and the changelog
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'tools/gen_builtins_json.zig')
-rw-r--r--tools/gen_builtins_json.zig7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/gen_builtins_json.zig b/tools/gen_builtins_json.zig
index 3158c8b2..35dc49dc 100644
--- a/tools/gen_builtins_json.zig
+++ b/tools/gen_builtins_json.zig
@@ -1,14 +1,17 @@
//! Writes every builtin as JSON to the path given (docs/typ/builtins-<tui|gui>.json,
-//! by way of `zig build builtins-json`).
+//! by way of `zig build builtins-json`), then the words of the addons whose
+//! sources follow it (builtins_json.addons, in that order).
const std = @import("std");
const pardes = @import("pardes");
pub fn main(init: std.process.Init) !void {
const args = try init.minimal.args.toSlice(init.arena.allocator());
+ var sources: [pardes.builtins_json.addons.len][]const u8 = undefined;
+ for (&sources, args[2..][0..sources.len]) |*source, path| source.* = try std.Io.Dir.cwd().readFileAlloc(init.io, path, init.arena.allocator(), .limited(1 << 20));
var file = try std.Io.Dir.cwd().createFile(init.io, args[1], .{});
defer file.close(init.io);
var buf: [4096]u8 = undefined;
var w = file.writer(init.io, &buf);
- try pardes.builtins_json.write(&w.interface);
+ try pardes.builtins_json.write(&w.interface, &sources);
try w.interface.flush();
}