Skip to main content

lookahead

Function lookahead 

Source
pub fn lookahead(
    state: &mut LuaState,
    ls: &mut LexState,
) -> Result<i32, LuaError>
Expand description

Peek at the next token without consuming the current one.

The lookahead token is cached in ls.lookahead and returned. Only one token of lookahead is supported; calling this twice without an intervening next is a logic error (asserted in debug builds).

ยงC source


//   lua_assert(ls->lookahead.token == TK_EOS);
//   ls->lookahead.token = llex(ls, &ls->lookahead.seminfo);
//   return ls->lookahead.token;
// }