Skip to main content

Module highlight

Module highlight 

Source
Expand description

Deterministic Rust source syntax highlighter → coloured spans an egui LayoutJob can render. Pure (no egui, no I/O), so it is unit-tested without a window and produces bit-identical spans for the same input (FC-7). A tiny hand-written tokenizer — not a full parser — classifying the things that matter for reading code: keywords, types, strings/chars, line+block comments, numbers, attributes, and punctuation.

Structs§

Span
A coloured run: a byte range [start, end) into the source + its Kind.

Enums§

Kind
The syntactic class of a span — maps to a theme colour at render time.

Functions§

highlight
Tokenize Rust src into a contiguous, ordered list of coloured Spans covering every byte (the concatenation of span ranges == the input). ASCII-byte driven; multi-byte UTF-8 inside a token is preserved (only token boundaries are decided on ASCII).