11#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
22#[ repr( u64 ) ]
33pub enum LuaFeatures {
4+ // std lua
45 Goto = 1 , // "goto"
5- ComplexNumber , // "0x1.2p3i"
6- LLInteger , // "0LL"
7- BinaryInteger , // "0b1010"
86 BitwiseOperation , // "5 & 2"
97 IntegerFloorDivision , // "5 // 2"
8+ LocalAttrib , // "local a<const> = 1"
109 GlobalDeclaration , // "global a = 1"
10+ NamedVararg , // "function f(a, b, c, ...args) end"
11+
1112 // non-standard symbols
1213 DoubleSlash , // "//"
1314 SlashStar , // "/**/"
1415
15- // luajit2-extension symbols
16+ // luajit
17+ ComplexNumber , // "0x1.2p3i"
18+ LLInteger , // "0LL"
19+ BinaryInteger , // "0b1010"
20+
21+ // luajit2-extension
1622 PlusAssign , // "+="
1723 MinusAssign , // "-="
1824 StarAssign , // "*="
@@ -39,7 +45,9 @@ pub enum LuaFeatures {
3945
4046 // luajit3
4147 StringInterpolation , // "`"
42- NilCoalescingAssign , // "??="
48+ // luajit not consider this syntax
49+ // NilCoalescingAssign, // "??="
50+ UnderscoreNumber , // "1_23"
4351}
4452
4553#[ derive( Debug , Clone , Copy , PartialEq , Eq , Default ) ]
@@ -72,13 +80,15 @@ impl LuaFeaturesSet {
7280 }
7381
7482 pub fn features_lua54 ( ) -> Self {
75- let set = LuaFeaturesSet :: features_lua53 ( ) ;
83+ let mut set = LuaFeaturesSet :: features_lua53 ( ) ;
84+ set. add ( LuaFeatures :: LocalAttrib ) ;
7685 set
7786 }
7887
7988 pub fn features_lua55 ( ) -> Self {
8089 let mut set = LuaFeaturesSet :: features_lua54 ( ) ;
8190 set. add ( LuaFeatures :: GlobalDeclaration ) ;
91+ set. add ( LuaFeatures :: NamedVararg ) ;
8292 set
8393 }
8494
@@ -122,12 +132,13 @@ impl LuaFeaturesSet {
122132
123133 pub fn features_luajit3 ( ) -> Self {
124134 let mut set = LuaFeaturesSet :: features_luajit_extension ( ) ;
125- // lua5.3+
126- set. add ( LuaFeatures :: IntegerFloorDivision ) ;
127135
128136 // luajit3
129- set. add ( LuaFeatures :: NilCoalescingAssign ) ;
137+ set. add ( LuaFeatures :: IntegerFloorDivision ) ;
138+ // set.add(LuaFeatures::NilCoalescingAssign);
130139 set. add ( LuaFeatures :: StringInterpolation ) ;
140+ set. add ( LuaFeatures :: UnderscoreNumber ) ;
141+ set. add ( LuaFeatures :: NamedVararg ) ;
131142 set
132143 }
133144
0 commit comments