pub enum LuaVersion {
Lua51,
Lua52,
Lua53,
Lua54,
MacroLua,
Lua55,
}Expand description
Lua dialect the VM emulates. Drives lexer, parser, and runtime feature
gating. Lua55 is the primary; the others are compat modes; MacroLua
(v1.3 Phase ML) is an additive dialect built on top of the 5.4 base.
Enum ordering note: MacroLua is placed between Lua54 and
Lua55 on purpose. The capability predicates below use >= / <=
comparisons; placing MacroLua immediately after Lua54 means
MacroLua inherits every 5.4-and-earlier capability for free while
staying below the 5.5-only gate (global keyword, named vararg).
Variants§
Lua51
Lua 5.1 — no integer subtype, arg table, no goto.
Lua52
Lua 5.2 — adds goto / bit32 / \xXX escapes, retires setfenv.
Lua53
Lua 5.3 — adds native 64-bit integers, bitwise ops, string.pack.
Lua54
Lua 5.4 — adds <const> / <close> attributes and integer-for spec.
MacroLua
MacroLua (v1.3 Phase ML) — 5.4 base + compile-time macros
(@name(args), @quote{...}, @if, @gensym). Opt-in via
Vm::new(LuaVersion::MacroLua); PUC 5.1-5.5 lexer/parser
behavior is not affected. See docs/compatibility.md
“MacroLua extensions”.
Lua55
Lua 5.5 — adds global declarations and named vararg parameters.
Implementations§
Source§impl LuaVersion
impl LuaVersion
Sourcepub fn has_integers(self) -> bool
pub fn has_integers(self) -> bool
Integer subtype and integer literals (5.3+).
Sourcepub fn has_bitwise_ops(self) -> bool
pub fn has_bitwise_ops(self) -> bool
& | ~ << >> operators (5.3+).
Sourcepub fn has_attribs(self) -> bool
pub fn has_attribs(self) -> bool
<const> / <close> attributes on local declarations (5.4+).
Sourcepub fn has_hex_float(self) -> bool
pub fn has_hex_float(self) -> bool
Hexadecimal float literals 0x1p4 (5.2+).
Sourcepub fn has_extended_escapes(self) -> bool
pub fn has_extended_escapes(self) -> bool
String escapes \z, \xXX (5.2+) and \u{XXX} (5.3+).
Sourcepub fn has_unicode_escape(self) -> bool
pub fn has_unicode_escape(self) -> bool
\u{XXX} unicode escape specifically (5.3+).
Sourcepub fn has_empty_statement(self) -> bool
pub fn has_empty_statement(self) -> bool
Empty statement ; (5.2+).
Sourcepub fn has_global_decl(self) -> bool
pub fn has_global_decl(self) -> bool
global declarations; global is a reserved word (5.5+).
Sourcepub fn has_named_vararg(self) -> bool
pub fn has_named_vararg(self) -> bool
Named vararg parameter function f(...name) (5.5+).
Sourcepub fn has_collective_attrib(self) -> bool
pub fn has_collective_attrib(self) -> bool
Leading collective attribute in declarations: local <const> a, b (5.5+).
Sourcepub fn break_is_last_statement(self) -> bool
pub fn break_is_last_statement(self) -> bool
In 5.1 break is a “last statement” like return; later versions allow
it anywhere in a block.
Sourcepub fn rejects_nested_long_string(self) -> bool
pub fn rejects_nested_long_string(self) -> bool
In 5.1, [[ inside a level-0 long string is an error
(“nesting of [[…]] is deprecated”).
Sourcepub fn is_macro_lua(self) -> bool
pub fn is_macro_lua(self) -> bool
MacroLua dialect — compile-time macros enabled in lexer/parser. Base semantics = Lua 5.4 (audit-locked, v1.3 Phase ML).
Trait Implementations§
Source§impl Clone for LuaVersion
impl Clone for LuaVersion
Source§fn clone(&self) -> LuaVersion
fn clone(&self) -> LuaVersion
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for LuaVersion
Source§impl Debug for LuaVersion
impl Debug for LuaVersion
impl Eq for LuaVersion
Source§impl Ord for LuaVersion
impl Ord for LuaVersion
Source§fn cmp(&self, other: &LuaVersion) -> Ordering
fn cmp(&self, other: &LuaVersion) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for LuaVersion
impl PartialEq for LuaVersion
Source§fn eq(&self, other: &LuaVersion) -> bool
fn eq(&self, other: &LuaVersion) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for LuaVersion
impl PartialOrd for LuaVersion
impl StructuralPartialEq for LuaVersion
Auto Trait Implementations§
impl Freeze for LuaVersion
impl RefUnwindSafe for LuaVersion
impl Send for LuaVersion
impl Sync for LuaVersion
impl Unpin for LuaVersion
impl UnsafeUnpin for LuaVersion
impl UnwindSafe for LuaVersion
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.