pub fn lex_error(ls: &mut LexState, msg: &[u8], token: i32) -> LuaErrorExpand description
Build a syntax error, optionally annotated with the offending token text.
Corresponds to the static lexerror function in llex.c. In C this is
l_noret (diverges via luaD_throw); in Rust it returns a LuaError
value that callers wrap in Err(...).
ยงC source
// msg = luaG_addinfo(ls->L, msg, ls->source, ls->linenumber);
// if (token)
// luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token));
// luaD_throw(ls->L, LUA_ERRSYNTAX);
// }