pub struct LexState {Show 13 fields
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,
pub global_strict: bool,
pub declared_globals: Vec<(GcRef<LuaString>, bool)>,
}Expand description
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: i32§linenumber: i32§lastline: i32§t: LexToken§lookahead: LexToken§fs: Option<Box<FuncState>>§dyd: DynData§source: Option<GcRef<LuaString>>§envn: Option<GcRef<LuaString>>§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.
global_strict: boolLua 5.5 global-declaration mode (manual §2.2). A chunk begins with an
implicit global * (false here): every free name is a global, as in
5.4. The first explicit global name, … declaration flips this to
true (“strict”), after which a free name must appear in
Self::declared_globals or it is a compile-time error. global *
flips it back to false. Only ever set on the 5.5 path (the lexer emits
TK_GLOBAL only there), so pre-5.5 versions are unaffected.
declared_globals: Vec<(GcRef<LuaString>, bool)>Names declared via global, each paired with whether it was declared
<const> (read-only). Consulted by name resolution under
Self::global_strict.