pub struct LexState {Show 13 fields
pub current: i32,
pub linenumber: i32,
pub lastline: i32,
pub t: Token,
pub lookahead: Token,
pub fs: Option<()>,
pub z: ZIO,
pub buff: LexBuffer,
pub h: Option<GcRef<LuaTable>>,
pub long_str_anchor: HashMap<Vec<u8>, GcRef<LuaString>>,
pub dyd: Option<()>,
pub source: GcRef<LuaString>,
pub envn: GcRef<LuaString>,
}Expand description
Per-chunk lexer (and shared parser) state.
Corresponds to LexState in llex.h. Owns the input stream, token
buffer, and current/lookahead tokens.
§C mapping (types.tsv)
LexState.current → current: i32 (charint; -1 = EOZ)
LexState.linenumber → linenumber: i32
LexState.lastline → lastline: i32
LexState.t → t: Token (current token)
LexState.lookahead → lookahead: Token (one-token lookahead)
LexState.fs → fs: Option<Box<FuncState>> (parser state)
LexState.L → (removed; callers pass &mut LuaState)
LexState.z → z: ZIO (owned input stream)
LexState.buff → buff: LexBuffer (owned token-text buffer)
LexState.h → h: GcRef<LuaTable> (string-anchor table)
LexState.dyd → dyd: DynData (parser dynamic data)
LexState.source → source: GcRef<LuaString>
LexState.envn → envn: GcRef<LuaString>Fields§
§current: i32§linenumber: i32§lastline: i32§t: Token§lookahead: Token§fs: Option<()>§z: ZIO§buff: LexBuffer§h: Option<GcRef<LuaTable>>§long_str_anchor: HashMap<Vec<u8>, GcRef<LuaString>>Per-parse-session anchor for long strings. C-Lua’s ls->h is a Lua
table that deduplicates all literal strings within a chunk (both short
and long), so e.g. local s1 <const>="..." and local s2 <const>="..."
with identical 50-byte payloads share one TString object — which is
what makes string.format("%p", s1) == string.format("%p", s2) hold.
Short strings already share identity via the global interned_lt pool,
but long strings (>LUAI_MAXSHORTLEN = 40) are not globally interned and
need this session-level map. Keyed by the string bytes; populated lazily
by new_string.
dyd: Option<()>§source: GcRef<LuaString>§envn: GcRef<LuaString>Auto Trait Implementations§
impl Freeze for LexState
impl !RefUnwindSafe for LexState
impl !Send for LexState
impl !Sync for LexState
impl Unpin for LexState
impl UnsafeUnpin for LexState
impl !UnwindSafe for LexState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more