pub struct LexState {
pub current: i32,
pub linenumber: i32,
pub lastline: i32,
pub t: LexToken,
pub lookahead: LexToken,
pub fs: Option<Box<FuncState>>,
pub dyd: DynData,
pub source: Option<GcRef<LuaString>>,
pub envn: Option<GcRef<LuaString>>,
pub lex: LexState,
pub recursion_depth: u32,
}Expand description
C: LexState — per-chunk lexer + parser state.
PORT NOTE: This is a Phase A stub. In Phase B, LexState lives in
lua-lex and lua-parse imports it. FuncState will move here
or be passed separately. The fs field creates a circular-crate
dependency that Phase B must resolve (likely: both live in one crate).
Fields§
§current: i32C: current — current character (i32; -1 = EOZ)
linenumber: i32C: linenumber
lastline: i32C: lastline
t: LexTokenC: t — current token
lookahead: LexTokenC: lookahead — one-token lookahead
fs: Option<Box<FuncState>>C: fs — current FuncState (parser owns this)
dyd: DynDataC: dyd — parser dynamic data
source: Option<GcRef<LuaString>>C: source — chunk name
envn: Option<GcRef<LuaString>>C: envn — cached “_ENV” string
lex: LexStateUnderlying lexer state that owns the ZIO stream and lex buffer.
The parser drives the lexer by calling lex_next / lex_lookahead,
which forward to lua_lex::next / lua_lex::lookahead on this inner
state and then mirror the resulting token into self.t / self.lookahead.
recursion_depth: u32Parser recursion depth for C-Lua’s enterlevel / leavelevel guard.