From 6b3df3071d16153bd554462c4f54ebb88f3ed50e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 11:07:09 -0300 Subject: lib: pardes's syntax is a library, as ghostty-vt is ghostty's: a package that depends on pardes is given build.zig's `library` and nothing of the editor, one module, `pardes-syntax` (src/lib_syntax.zig), naming what a program that draws source text itself takes, the editor's own code under its own names (highlightFileRange and analyzeSource for a Syn a byte and the sticky headers' declarations, parse and walkNodes over the tree-sitter bindings, theme, page, ink and synInk for a named theme's colours, the line arithmetic, pathFor for a language's name); every dependency but tree-sitter's runtime is lazy in the manifest, so such a package fetches the runtime and the grammars of its tree-sitter set alone, and pardes's own build asks for all it is missing in one round before its first b.dependency; build.zig's tree-sitter and theme-generator blocks become treeSitter and generatedThemes for both to call, a grammar not yet fetched asked for and left out of that round, and the scanners' -include of src/tree_sitter_heap.h is spelled from the root package's directory, where the compiler runs (pardes's own flags are as they were); File.synStyle's switch moves to colors.synInk, so the editor and the library colour a class from one place; test/lib is such a package, depending on pardes by path: it colours, outlines and walks a C and a Zig source in orchard's colours under the testing allocator, and `zig build lib-test`, which unit-test runs, is its own `zig build test` over this checkout's zig-pkg; ts_markdown is pinned by the commit its hash is of (a0a00f81): its split_parser branch moved to v0.5.4 and a fresh fetch no longer matched; building.typ and the changelog say so; syntax snapshots unchanged --- src/colors.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/colors.zig') diff --git a/src/colors.zig b/src/colors.zig index bc59c334..e679f4a5 100644 --- a/src/colors.zig +++ b/src/colors.zig @@ -281,6 +281,17 @@ pub const Theme = struct { rail_px: ?u8 = null, }; +/// The ink a syntax class is drawn in; a byte of none keeps its text's own. +pub fn synInk(th: *const Theme, sy: @import("syntax.zig").Syn) ?[3]u8 { + return switch (sy) { + .none => null, + .keyword => th.kw, + .string => th.str, + .number => th.num, + .comment => th.comment, + }; +} + /// One family, its twelve backgrounds a theme each (`curated`). const seoul256 = @import("themes/seoul256.zig"); -- cgit v1.3