diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:25:19 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | 6d9272b83d122585ad7bbe7214c078f65351c3c0 (patch) | |
| tree | 5d55a1025ccc4a33ac1e1935f510884d8fae49a8 /src | |
| parent | 5caef6d571f51e98eab3a48c063678ad35e09cce (diff) | |
| download | pardes-6d9272b83d122585ad7bbe7214c078f65351c3c0.tar.gz pardes-6d9272b83d122585ad7bbe7214c078f65351c3c0.zip | |
lib: the diff is a language of pardes-syntax: `diff` (Walk, targetAt), `highlightDiff`, the style byte's `syn_bits` and grounds and colors.Grounds, a theme's colours for them; test/lib colours a C patch through it (each side's code as C, the rows' grounds, Orchard's, and the place a `+` row names)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib_syntax.zig | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib_syntax.zig b/src/lib_syntax.zig index 395a02f0..a25af884 100644 --- a/src/lib_syntax.zig +++ b/src/lib_syntax.zig @@ -51,6 +51,25 @@ pub const SourceAnalysis = syntax.SourceAnalysis; pub const ContextDeclaration = syntax.ContextDeclaration; pub const analyzeSource = syntax.analyzeSource; +/// A unified diff as a language: `diff` walks one a line at a time +/// (`Walk`: a line's kind, the file its section names, the hunk's line +/// numbers) and says what a row of it points at (`targetAt`); +/// `highlightDiff` is a style byte for each byte of `content[start..end]`, +/// the caller's to free: headers as comments, `@@` lines as keywords, each +/// hunk's code in the language of the file its section names (old and new +/// side each parsed whole), and over that an added or removed line's +/// grounds (`ground_add`, `ground_del`; its first byte `ground_emph`, the +/// strong row). A byte's low bits (`syn_bits`) are a `Syn`; `Grounds` are +/// a theme's colours for the rest. +pub const diff = @import("diff.zig"); +pub const highlightDiff = syntax.highlightDiff; +pub const syn_bits = syntax.syn_bits; +pub const ground_add = syntax.ground_add; +pub const ground_del = syntax.ground_del; +pub const ground_emph = syntax.ground_emph; +pub const ground_line = syntax.ground_line; +pub const Grounds = colors.Grounds; + /// The tree-sitter bindings a tree is read through: `tree.rootNode()`, and /// a node's `kind()`, `startByte()`, `endByte()`, `child(i)`, `parent()`. pub const ts = syntax.ts; |
