Skip to main content

lex_error

Function lex_error 

Source
pub fn lex_error(ls: &mut LexState, msg: &[u8], token: i32) -> LuaError
Expand description

Build a syntax error, optionally annotated with the offending token text.

Returns the constructed LuaError by value rather than diverging. This is the lexer’s error-construction boundary: the lexer’s own callsites wrap it as return Err(lex_error(...)), and lua-parse does the same across the crate boundary, so the by-value return is a deliberate public contract — not a half-finished translation of a diverging C function. The error text format (source:line: message plus an optional near <token> suffix) is the behavioural invariant the oracle checks.