Skip to main content

cove_lex

Function cove_lex 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn cove_lex( source: *const u8, len: usize, ) -> *mut u8
Expand description

Lexes source and answers a colour for every part of it, as an answer block. See crate::lex_json.

The one entry point that neither checks nor runs anything: it is the lexer and nothing after it, so it costs a pass over the text. That is what lets a page call it on every keystroke, and it is why a page can call it on its own thread rather than on the worker a run needs — the reason the worker exists is that a Cove program can loop, and lexing cannot.

§Safety

As cove_compile.