| 132 | private final Op defaultop; |
| 133 | |
| 134 | private Version(int major, int minor, boolean isMua) { |
| 135 | HeaderType headertype; |
| 136 | StringType stringtype; |
| 137 | ConstantType constanttype; |
| 138 | UpvalueType upvaluetype; |
| 139 | FunctionType functiontype; |
| 140 | OpcodeMapType opcodemap; |
| 141 | this.major = major; |
| 142 | this.minor = minor; |
| 143 | this.isMua = isMua; |
| 144 | name = major + "." + minor + (isMua ? "M" : ""); |
| 145 | if(major == 5 && minor >= 0 && minor <= 4) { |
| 146 | switch(minor) { |
| 147 | case 0: |
| 148 | varargtype = new Setting<>(VarArgType.ARG); |
| 149 | useupvaluecountinheader = new Setting<>(false); |
| 150 | headertype = HeaderType.LUA50; |
| 151 | stringtype = StringType.LUA50; |
| 152 | constanttype = ConstantType.LUA50; |
| 153 | upvaluetype = UpvalueType.LUA50; |
| 154 | functiontype = FunctionType.LUA50; |
| 155 | opcodemap = OpcodeMapType.LUA50; |
| 156 | defaultop = Op.DEFAULT; |
| 157 | instructionformat = new Setting<>(InstructionFormat.LUA50); |
| 158 | outerblockscopeadjustment = new Setting<>(-1); |
| 159 | extendedrepeatscope = new Setting<Boolean>(true); |
| 160 | closeinscope = new Setting<Boolean>(true); |
| 161 | closesemantics = new Setting<CloseSemantics>(CloseSemantics.DEFAULT); |
| 162 | upvaluedeclarationtype = new Setting<>(UpvalueDeclarationType.INLINE); |
| 163 | fortarget = new Setting<>(Op.FORLOOP); |
| 164 | tfortarget = new Setting<>(null); |
| 165 | whileformat = new Setting<>(WhileFormat.BOTTOM_CONDITION); |
| 166 | allowpreceedingsemicolon = new Setting<>(false); |
| 167 | usenestinglongstrings = new Setting<>(true); |
| 168 | environmenttable = new Setting<>(null); |
| 169 | useifbreakrewrite = new Setting<>(false); |
| 170 | usegoto = new Setting<>(false); |
| 171 | rkoffset = new Setting<>(250); |
| 172 | break; |
| 173 | case 1: |
| 174 | varargtype = new Setting<>(VarArgType.HYBRID); |
| 175 | useupvaluecountinheader = new Setting<>(false); |
| 176 | headertype = HeaderType.LUA51; |
| 177 | stringtype = StringType.LUA50; |
| 178 | constanttype = ConstantType.LUA50; |
| 179 | upvaluetype = UpvalueType.LUA50; |
| 180 | functiontype = FunctionType.LUA51; |
| 181 | opcodemap = OpcodeMapType.LUA51; |
| 182 | defaultop = Op.DEFAULT; |
| 183 | instructionformat = new Setting<>(InstructionFormat.LUA51); |
| 184 | outerblockscopeadjustment = new Setting<>(-1); |
| 185 | extendedrepeatscope = new Setting<Boolean>(false); |
| 186 | closeinscope = new Setting<Boolean>(true); |
| 187 | closesemantics = new Setting<CloseSemantics>(CloseSemantics.DEFAULT); |
| 188 | upvaluedeclarationtype = new Setting<>(UpvalueDeclarationType.INLINE); |
| 189 | fortarget = new Setting<>(null); |
| 190 | tfortarget = new Setting<>(Op.TFORLOOP); |
| 191 | whileformat = new Setting<>(WhileFormat.TOP_CONDITION); |