<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pardes.git/src/syntax.zig, branch main</title>
<subtitle>Pardes</subtitle>
<id>https://git.0x4200.cafe/pardes.git/atom?h=main</id>
<link rel='self' href='https://git.0x4200.cafe/pardes.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/'/>
<updated>2026-10-01T03:12:17Z</updated>
<entry>
<title>A diff reads as the code it changes: hunks in their file's language, added and removed rows tinted</title>
<updated>2026-10-01T03:12:17Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-30T18:39:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=c04df904f2fa686cbe5ce0c078a96260af7b08bd'/>
<id>urn:sha1:c04df904f2fa686cbe5ce0c078a96260af7b08bd</id>
<content type='text'>
A .diff or .patch pane, and a command pane whose output is a diff (`git
diff`, `git show`, `diff -u`; told by a `diff --git` line, or `---`/`+++`
with a `@@` under them, in its first rows), colour each hunk's code in the
language of the file its section names (`+++ b/&lt;path&gt;`, `--- a/&lt;path&gt;` for
a deleted file), with tree-sitter, as highlightLocations does for results.

src/diff.zig walks a unified diff by its `@@` counts, so a removed line
that reads `--- x` is no header. Each side of a hunk is parsed as one text
(context and removed lines the old side, context and added lines the new),
so a string or comment across lines colours as it does in the file; a side
no line takes its colours from is not parsed. A section's hunks share a
parse, in pieces of about 40 lines (a hunk past 80 is cut), only those in
view, and each piece's colours are kept by its bytes, so scrolling back and
a terminal's every repaint parse nothing again.

Added and removed lines carry a flag in their style byte; the painter tints
their rows to the pane's edge, a little way from the page toward the
theme's ANSI green or red, and draws the prefix in that hue pushed to read
on it. A file in no known language keeps the old line colours.

A command pane is read once its command has finished: its rows are copied
once (File.DiffOutput, dropped when the pane runs again), so no frame dumps
the scrollback, and painted over what git printed. A running command is
shown as it prints.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Trial merge: 9P + helix + render</title>
<updated>2026-10-01T03:12:15Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-28T20:14:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=8509453c2fa78357187f1c4a7e99bfddf29027d8'/>
<id>urn:sha1:8509453c2fa78357187f1c4a7e99bfddf29027d8</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Zig has textobjects: helix's query, ported to the zig grammar pardes builds</title>
<updated>2026-10-01T03:12:15Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-28T20:13:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=c5d96bec3d5279904525292ef933a985a974b017'/>
<id>urn:sha1:c5d96bec3d5279904525292ef933a985a974b017</id>
<content type='text'>
pardes builds maxxnino/tree-sitter-zig, whose node names are not those of
the grammar helix's query targets, so the query is ported by hand
(vendor/queries/zig, its MPL header saying it is modified and how): a
function is a Decl holding an FnProto and a Block with pub beside it,
struct/enum/union one ContainerDecl, parameters and arguments ParamDeclList
and FnCallArguments, and comments come in three kinds. That grammar's
comments take their line's newline, and a node ending in a newline is now
taken without it, as helix's grammars have it. The replay test gains fifteen
Zig cases from the installed hx; none walks call arguments, which the
reference helix counts as parameters and 25.07.1's query does not.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>]f, mif and the other textobject keys use helix's own queries</title>
<updated>2026-10-01T03:12:15Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-28T20:04:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=df4d11bb95bc7ea9554b55d2211c4704a2594f08'/>
<id>urn:sha1:df4d11bb95bc7ea9554b55d2211c4704a2594f08</id>
<content type='text'>
helix's textobjects.scm for pardes's grammars are vendored in vendor/queries
under MPL-2.0, each with a header naming its source and what it inherits,
inlined; a README says what is there and what is not. syntax.objectAt and
objectNext run them over the file's kept parse, with their #eq? and #match?
predicates, for ]f [f ]t [t ]a [a ]c [c ]T [T ]e [e ]x [x and mi/ma with
f t a c T e x. erlang's and zig's queries do not compile against the grammar
versions pardes builds and are left out; fortran, markdown and powershell
have none in helix. A test replays sixteen Python and JSON cases whose
results were taken from the installed hx, and another holds that every
vendored query compiles.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>A REPL's language is named and found as the syntax table finds one: aliases, any case</title>
<updated>2026-10-01T03:12:15Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-28T19:45:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=c9d5d97e4d487b92a52d765dd9c467423ddd1de1'/>
<id>urn:sha1:c9d5d97e4d487b92a52d765dd9c467423ddd1de1</id>
<content type='text'>
Repl took only the grammar's exact name, and a file's language was found by a case-sensitive suffix of its path, apart from the aliases a code fence already had. The aliases move to grammar_manifest with byName and byPath, which syntax, Repl and langOf share, so `Repl py` and a .PY file work. The line-by-line warning is for the python language, not an id that starts with python. Joincol's doc line was sitting on Repl.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Alt-o, Alt-i and the other tree-sitter keys walk the file's syntax tree</title>
<updated>2026-10-01T03:12:15Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-28T19:35:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=e87e16547a17864b2a0cd574c1aa42d44125bc6c'/>
<id>urn:sha1:e87e16547a17864b2a0cd574c1aa42d44125bc6c</id>
<content type='text'>
helix's expand/shrink, previous/next sibling, all siblings, all children and
parent-node end/start (Alt-o/up, Alt-i/down, Alt-p/left, Alt-right, Alt-a,
Alt-I, Alt-e, Alt-b; Alt-n stays the new terminal) walk a whole-file parse
the file keeps (File.node_tree), made on the first such key after an edit and
reused until the next, never per key. syntax.walkNodes follows helix's
TreeCursor over every node, anonymous ones included, and Alt-i goes back to
what Alt-o grew from while the selection still holds it. The harness runs
without grammars, so the cases prove the plain-text no-op; a test replays
eleven JSON walks whose results were taken from the installed hx.

Co-Authored-By: Claude Opus 5.5 &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Allocate tree-sitter's external scanners from the same Zig allocator as its runtime</title>
<updated>2026-10-01T03:12:14Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-24T16:04:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=b4fc9fed0c2d10cd8c1b3b99246b39c262ac5ade'/>
<id>urn:sha1:b4fc9fed0c2d10cd8c1b3b99246b39c262ac5ade</id>
<content type='text'>
syntax.zig points the tree-sitter runtime at a Zig allocator, but the
grammars' external scanners did not follow it. A grammar's
tree_sitter/alloc.h maps ts_malloc to the runtime's current allocator only
when TREE_SITTER_REUSE_ALLOCATOR is defined, and plain malloc otherwise, so
every scanner's state and its arrays came from libc. Five scanners (bash,
markdown, markdown_inline, python, typst) also call malloc, calloc, realloc
and free by name.

build.zig now compiles every grammar with TREE_SITTER_REUSE_ALLOCATOR and
forces in src/tree_sitter_heap.h, which includes stdlib.h and then defines
the four names as calls through ts_current_malloc and friends. A header
forced in from the build rather than a patch to the grammars keeps zig-pkg
pristine. No grammar archive refers to libc's allocator any more; only the
runtime does, for its defaults. A scanner frees only what it allocated
itself, and the syntax tests that create and destroy a parser for every
grammar under a leak-checking allocator pass.

Co-Authored-By: Claude Opus 5.5 (1M context) &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Hand every C library's allocator hook the same C heap</title>
<updated>2026-10-01T03:12:14Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-24T15:52:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=8de5bf6fecc19cf2be6093b4338691fe4af84815'/>
<id>urn:sha1:8de5bf6fecc19cf2be6093b4338691fe4af84815</id>
<content type='text'>
C's malloc, calloc, realloc and free over a Zig allocator were written three
times: syntax.zig's for tree-sitter, pdf.zig's for MuPDF, and gui.zig's for
FreeType and HarfBuzz. They are now one, src/c_heap.zig's Heap. Each hook
names the allocator variable its heap reads; gui.zig exports its heap under
the ui_malloc names font.c and HarfBuzz call. It is a module of its own
because pdf.zig is the MuPDF module, and a file cannot belong to that module
and the core's at once.

A block starts with a 16-byte header holding its size and the allocator that
made it, so it goes back where it came from even after the heap is repointed,
as the fonts' copy did. The fonts' copy carried the 16-byte Allocator itself
in a 32-byte header; here the header holds the allocator's index in a table of
every allocator a heap has used (entries are published once and never change,
and a heap remembers where its current one was last found). The difference is
measurable: with the 32-byte header, pardes-pdf-bench's filtered page render
at 96 dpi took 1.1% longer than before this change, slower in 15 of 16 pinned
rounds in two separate runs, and highlighting all of src/pardes.zig (305k
tree-sitter blocks) up to 0.6% longer, against an A/A pair within 0.7%. With
the 16-byte header both are back within the A/A pair's noise.

Two other things change. For tree-sitter and MuPDF, a block made before the
allocator was repointed now goes back to the one that made it rather than
through the current one. For the fonts, realloc(block, 0) now frees and
returns null, as glibc's does and as the other two copies already did;
neither FreeType nor HarfBuzz asks for it. The heap's test replaces the
tests of the old copies.

Co-Authored-By: Claude Opus 5.5 (1M context) &lt;noreply@anthropic.com&gt;
</content>
</entry>
<entry>
<title>Reuse bounded source analysis and speed up result context traversal</title>
<updated>2026-10-01T03:12:14Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-15T21:52:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=3f4f26e0e40d06427e72f72e760d01adcdc0326c'/>
<id>urn:sha1:3f4f26e0e40d06427e72f72e760d01adcdc0326c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Default location results to stacked addresses and source previews</title>
<updated>2026-10-01T03:12:14Z</updated>
<author>
<name>Gabriel Schneider</name>
<email>gbrls@0x4200.cafe</email>
</author>
<published>2026-09-15T21:41:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0x4200.cafe/pardes.git/commit/?id=02ea4db25f9802e76112f3b4e69aa75e5a9464dc'/>
<id>urn:sha1:02ea4db25f9802e76112f3b4e69aa75e5a9464dc</id>
<content type='text'>
</content>
</entry>
</feed>
