Skip to main content

Crate strop_syntax

Crate strop_syntax 

Source
Expand description

strop-syntax: tree-sitter highlighting. Parsers statically linked (0002 §2.2 — never dlopen’d grammars); queries are data (0001 §5.11), embedded defaults now, runtime overrides when config lands (0005).

The whole pipeline is rope-backed: parsing walks rope chunks, and query predicates (#eq?/#match?/…) read node text through a tree_sitter::TextProvider over the same chunks — no full-text String is materialized on any input or render path, and language detection never touches the filesystem.

Modules§

languages
The curated language registry (0002 §2.2: statically linked, always). All highlight queries are Helix-vendored (queries/ per language, MPL-2.0) — one upstream, one review surface, divergence watched weekly (0002 §7). Adding a language is one row here plus one crate in Cargo.toml — never a download, never a dlopen. C++ included specifically: its scanner is C++, the musl static-libstdc++ path the release gate guards (0002 §5).

Structs§

Highlighter
One language’s parser + highlight query. The tree tracks the buffer’s journal (0022 §1): edits apply as a cheap pointer walk at commit time and reparsing is incremental against the kept tree — a full parse is the cold-start path, not the rule.
Span
A colored span, in byte offsets.

Enums§

Class
Semantic classes the renderer maps to palette colors. Kept small and stable; the query capture names map onto these.
HighlightError
Highlighting failed out loud: no hidden full-text reparse fallback, no swallowed error, no panic — the caller decides what the failure means for its surface.