Skip to documentation
SLOP

tiny.syn.highlightLine

Reference tiny.syn highlightLine

Defined in scan.line.

Marks up one line of a document and updates state with what the line leaves open.

Called byCallsscan.linehighlighttest sourcelib.syn.src.scan.testtest: activated syntax highlighting p...test sourcelib.syn.src.scan.testtest: foreign continuation equals a f...test sourcelib.syn.src.scan.testtest: rust lifetime and block opener ...test sourcelib.syn.src.scan.testtest: syn line state carries a new bl...+6 moreprivate sourcelib.syn.src.scan.linehighlightContinuingprivate sourcelib.syn.src.scan.linehighlightFlatprivate sourcelib.syn.src.scan.linepreparescan.linehighlightLine
Static calls · unresolved targets: 0 · external targets: 2.

Source

Source: lib/syn/src/scan/line.zig:64

zig
/// Marks up one line of a document and updates `state` with what the line leaves open. A caller/// walking a document line by line passes the same `State` to every call, so comments and strings/// that run over more than one line are marked correctly. The call replaces the storage's spans/// with this line's spans, each an offset into `text`. The call keeps no spans and returns/// `.discarded` when the line is longer than the text limit. That line is still scanned in full, so/// `state` comes out the same as it would with room to spare. A comment or string that `state`/// carries from a different language is dropped, and the line is scanned fresh. A comment or string/// that `state` carries from this language runs up to its closing delimiter as one comment or/// string span, and the rest of the line is scanned as usual. A line with no closing delimiter/// becomes one span, and the comment or string stays open. The storage must be activated before the/// call, and the call allocates nothing. The call keeps no reference to `text`.pub fn highlightLine(    language: Language,    text: []const u8,    state: *State,    spans: *SpanStorage,) syn.SpanMaterialization {    const materialization = prepare(spans, text.len);    state.rebind(language);    if (!highlightContinuing(language, text, state, spans)) {        state.retain(language, highlightFlat(language, text, spans));    }    return materialization;}

Source: lib/syn/src/root.zig:59

zig
pub const highlightLine = scan.highlightLine;

Also reachable as

scan.highlightLine.

Complete caller list

11 direct callers.

Audit

Definitions1
Public names3
Members0
Version26.7.0
Revisiondaab053ee433