summaryrefslogtreecommitdiff
path: root/core/lib_syntax.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 05:29:51 -0300
committerGabriel Schneider <[email protected]>2026-11-21 05:29:51 -0300
commit63538d28cee238ff53c731f965c22e615d43bec1 (patch)
treefb00203f05512a9f14d0e8089a2f4b1919edffc9 /core/lib_syntax.zig
parent638122f18a66669c433e332c91fc8b068019681e (diff)
parentd04f4acfb9af968caaa53d6cf10a486622c95400 (diff)
downloadpardes-63538d28cee238ff53c731f965c22e615d43bec1.tar.gz
pardes-63538d28cee238ff53c731f965c22e615d43bec1.zip
integration: the library for a browser reader on the gathered line: pardes-syntax-lib (`wqlkznns`: a dependent package names its languages, the patch view without the editor as formatPatch, build.zig's wasmModule and abi/wasm.zig, the manual) and pardes-reorg (`ukkqwpqu`: the terminals' line, the wire at 26); no conflict; its gate: .scratch/sketch/reorg/merge47, the numbers in PARDES.md (2026-11-21)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/lib_syntax.zig')
-rw-r--r--core/lib_syntax.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/core/lib_syntax.zig b/core/lib_syntax.zig
index f4f85820..0bb3f510 100644
--- a/core/lib_syntax.zig
+++ b/core/lib_syntax.zig
@@ -13,6 +13,7 @@
const syntax = @import("syntax.zig");
const colors = @import("colors.zig");
const modal = @import("modal.zig");
+const hunks = @import("hunks.zig");
/// Every grammar pardes knows (`all`), by name or alias (`byName`) and by
/// path (`byPath`). The build's `grammars` option says which of them are
@@ -70,6 +71,22 @@ pub const ground_emph = syntax.ground_emph;
pub const ground_line = syntax.ground_line;
pub const Grounds = colors.Grounds;
+/// A unified diff stacked as pardes's patch view (its +Diff) shows it:
+/// `formatPatch` gives a `Patch`, its text and a `PatchRow` a line: a
+/// hunk's `path:line`, the declarations it stands in (or git's function
+/// line), its lines with both their numbers, each byte's style (a `Syn`
+/// when `colors` are given, the grounds, the words a changed line changed).
+/// What it takes of the program is a `PatchCtx`: an arena, and optionally
+/// the files the diff names (`source`, a `PatchSource`), their declarations
+/// (`PatchCtx.parsed`), the colours (`PatchCtx.languages`, highlightDiff's)
+/// and a text's width; with none of them it names no grammar and no
+/// tree-sitter.
+pub const formatPatch = hunks.format;
+pub const PatchCtx = hunks.Ctx;
+pub const PatchSource = hunks.Source;
+pub const Patch = hunks.Patch;
+pub const PatchRow = hunks.Row;
+
/// 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;