diff options
Diffstat (limited to 'spec/outputs')
| -rw-r--r-- | spec/outputs/codes_from_doc_de.lua | 616 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_en.lua | 616 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_id-id.lua | 616 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_pt-br.lua | 616 | ||||
| -rw-r--r-- | spec/outputs/codes_from_doc_zh.lua | 616 | ||||
| -rw-r--r-- | spec/outputs/compile_doc.lua | 2 |
6 files changed, 1771 insertions, 1311 deletions
diff --git a/spec/outputs/codes_from_doc_de.lua b/spec/outputs/codes_from_doc_de.lua index 7de1a35..428f788 100644 --- a/spec/outputs/codes_from_doc_de.lua +++ b/spec/outputs/codes_from_doc_de.lua | |||
| @@ -3,6 +3,18 @@ do | |||
| 3 | print(var) | 3 | print(var) |
| 4 | end | 4 | end |
| 5 | print(var) | 5 | print(var) |
| 6 | local status, value | ||
| 7 | do | ||
| 8 | repeat | ||
| 9 | local n = 12 | ||
| 10 | if n > 10 then | ||
| 11 | status, value = "large", n | ||
| 12 | break | ||
| 13 | end | ||
| 14 | status, value = "small", n | ||
| 15 | break | ||
| 16 | until true | ||
| 17 | end | ||
| 6 | local counter | 18 | local counter |
| 7 | do | 19 | do |
| 8 | local i = 0 | 20 | local i = 0 |
| @@ -24,6 +36,18 @@ do | |||
| 24 | print(var) | 36 | print(var) |
| 25 | end | 37 | end |
| 26 | print(var) | 38 | print(var) |
| 39 | local status, value | ||
| 40 | do | ||
| 41 | repeat | ||
| 42 | local n = 12 | ||
| 43 | if n > 10 then | ||
| 44 | status, value = "large", n | ||
| 45 | break | ||
| 46 | end | ||
| 47 | status, value = "small", n | ||
| 48 | break | ||
| 49 | until true | ||
| 50 | end | ||
| 27 | local counter | 51 | local counter |
| 28 | do | 52 | do |
| 29 | local i = 0 | 53 | local i = 0 |
| @@ -146,268 +170,6 @@ end | |||
| 146 | do | 170 | do |
| 147 | print(123, "hallo") | 171 | print(123, "hallo") |
| 148 | end | 172 | end |
| 149 | do | ||
| 150 | local insert, concat = table.insert, table.concat | ||
| 151 | local C, Ct, Cmt | ||
| 152 | do | ||
| 153 | local _obj_0 = require("lpeg") | ||
| 154 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 155 | end | ||
| 156 | local x, y, z | ||
| 157 | do | ||
| 158 | local _obj_0 = require('mymodule') | ||
| 159 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 160 | end | ||
| 161 | local a, b, c | ||
| 162 | local _obj_0 = require('module') | ||
| 163 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 164 | end | ||
| 165 | do | ||
| 166 | local module = require('module') | ||
| 167 | local module_x = require('module_x') | ||
| 168 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 169 | local part = require("module.part") | ||
| 170 | end | ||
| 171 | do | ||
| 172 | local PlayerModule = require("player") | ||
| 173 | local C, Ct, Cmt | ||
| 174 | do | ||
| 175 | local _obj_0 = require("lpeg") | ||
| 176 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 177 | end | ||
| 178 | local one, two, ch | ||
| 179 | local _obj_0 = require("export") | ||
| 180 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 181 | end | ||
| 182 | do | ||
| 183 | local tostring <const> = tostring | ||
| 184 | local concat <const> = table.concat | ||
| 185 | print(concat({ | ||
| 186 | "a", | ||
| 187 | tostring(1) | ||
| 188 | })) | ||
| 189 | end | ||
| 190 | do | ||
| 191 | local print <const> = print | ||
| 192 | local math <const> = math | ||
| 193 | print("hallo") | ||
| 194 | math.random(3) | ||
| 195 | end | ||
| 196 | do | ||
| 197 | local print <const> = print | ||
| 198 | print(FLAG) | ||
| 199 | FLAG = 123 | ||
| 200 | end | ||
| 201 | local _module_0 = { } | ||
| 202 | local a, b, c = 1, 2, 3 | ||
| 203 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 204 | local cool = "Katze" | ||
| 205 | _module_0["cool"] = cool | ||
| 206 | local What | ||
| 207 | if this then | ||
| 208 | What = "abc" | ||
| 209 | else | ||
| 210 | What = "def" | ||
| 211 | end | ||
| 212 | _module_0["What"] = What | ||
| 213 | local y | ||
| 214 | y = function() | ||
| 215 | local hallo = 3434 | ||
| 216 | end | ||
| 217 | _module_0["y"] = y | ||
| 218 | local Something | ||
| 219 | local _class_0 | ||
| 220 | local _base_0 = { | ||
| 221 | umm = "cool" | ||
| 222 | } | ||
| 223 | if _base_0.__index == nil then | ||
| 224 | _base_0.__index = _base_0 | ||
| 225 | end | ||
| 226 | _class_0 = setmetatable({ | ||
| 227 | __init = function() end, | ||
| 228 | __base = _base_0, | ||
| 229 | __name = "Something" | ||
| 230 | }, { | ||
| 231 | __index = _base_0, | ||
| 232 | __call = function(cls, ...) | ||
| 233 | local _self_0 = setmetatable({ }, _base_0) | ||
| 234 | cls.__init(_self_0, ...) | ||
| 235 | return _self_0 | ||
| 236 | end | ||
| 237 | }) | ||
| 238 | _base_0.__class = _class_0 | ||
| 239 | Something = _class_0 | ||
| 240 | _module_0["Something"] = Something | ||
| 241 | return _module_0 | ||
| 242 | local _module_0 = { } | ||
| 243 | local loadstring, tolua | ||
| 244 | do | ||
| 245 | local _obj_0 = yue | ||
| 246 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 247 | end | ||
| 248 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 249 | local fieldA = tb.itemA.fieldA | ||
| 250 | if fieldA == nil then | ||
| 251 | fieldA = 'default' | ||
| 252 | end | ||
| 253 | _module_0["fieldA"] = fieldA | ||
| 254 | return _module_0 | ||
| 255 | local _module_0 = setmetatable({ }, { }) | ||
| 256 | _module_0.itemA = tb | ||
| 257 | getmetatable(_module_0).__index = items | ||
| 258 | _module_0["a-b-c"] = 123 | ||
| 259 | return _module_0 | ||
| 260 | local _module_0 = { } | ||
| 261 | local d, e, f = 3, 2, 1 | ||
| 262 | _module_0[#_module_0 + 1] = d | ||
| 263 | _module_0[#_module_0 + 1] = e | ||
| 264 | _module_0[#_module_0 + 1] = f | ||
| 265 | if this then | ||
| 266 | _module_0[#_module_0 + 1] = 123 | ||
| 267 | else | ||
| 268 | _module_0[#_module_0 + 1] = 456 | ||
| 269 | end | ||
| 270 | local _with_0 = tmp | ||
| 271 | local j = 2000 | ||
| 272 | _module_0[#_module_0 + 1] = _with_0 | ||
| 273 | return _module_0 | ||
| 274 | local _module_0 = nil | ||
| 275 | _module_0 = function() | ||
| 276 | print("hallo") | ||
| 277 | return 123 | ||
| 278 | end | ||
| 279 | return _module_0 | ||
| 280 | do | ||
| 281 | local insert, concat = table.insert, table.concat | ||
| 282 | local C, Ct, Cmt | ||
| 283 | do | ||
| 284 | local _obj_0 = require("lpeg") | ||
| 285 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 286 | end | ||
| 287 | local x, y, z | ||
| 288 | do | ||
| 289 | local _obj_0 = require('mymodule') | ||
| 290 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 291 | end | ||
| 292 | local a, b, c | ||
| 293 | local _obj_0 = require('module') | ||
| 294 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 295 | end | ||
| 296 | do | ||
| 297 | local module = require('module') | ||
| 298 | local module_x = require('module_x') | ||
| 299 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 300 | local part = require("module.part") | ||
| 301 | end | ||
| 302 | do | ||
| 303 | local PlayerModule = require("player") | ||
| 304 | local C, Ct, Cmt | ||
| 305 | do | ||
| 306 | local _obj_0 = require("lpeg") | ||
| 307 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 308 | end | ||
| 309 | local one, two, ch | ||
| 310 | local _obj_0 = require("export") | ||
| 311 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 312 | end | ||
| 313 | do | ||
| 314 | local tostring <const> = tostring | ||
| 315 | local concat <const> = table.concat | ||
| 316 | print(concat({ | ||
| 317 | "a", | ||
| 318 | tostring(1) | ||
| 319 | })) | ||
| 320 | end | ||
| 321 | do | ||
| 322 | local print <const> = print | ||
| 323 | local math <const> = math | ||
| 324 | print("hallo") | ||
| 325 | math.random(3) | ||
| 326 | end | ||
| 327 | do | ||
| 328 | local print <const> = print | ||
| 329 | print(FLAG) | ||
| 330 | FLAG = 123 | ||
| 331 | end | ||
| 332 | local _module_0 = { } | ||
| 333 | local a, b, c = 1, 2, 3 | ||
| 334 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 335 | local cool = "Katze" | ||
| 336 | _module_0["cool"] = cool | ||
| 337 | local What | ||
| 338 | if this then | ||
| 339 | What = "abc" | ||
| 340 | else | ||
| 341 | What = "def" | ||
| 342 | end | ||
| 343 | _module_0["What"] = What | ||
| 344 | local y | ||
| 345 | y = function() | ||
| 346 | local hallo = 3434 | ||
| 347 | end | ||
| 348 | _module_0["y"] = y | ||
| 349 | local Something | ||
| 350 | local _class_0 | ||
| 351 | local _base_0 = { | ||
| 352 | umm = "cool" | ||
| 353 | } | ||
| 354 | if _base_0.__index == nil then | ||
| 355 | _base_0.__index = _base_0 | ||
| 356 | end | ||
| 357 | _class_0 = setmetatable({ | ||
| 358 | __init = function() end, | ||
| 359 | __base = _base_0, | ||
| 360 | __name = "Something" | ||
| 361 | }, { | ||
| 362 | __index = _base_0, | ||
| 363 | __call = function(cls, ...) | ||
| 364 | local _self_0 = setmetatable({ }, _base_0) | ||
| 365 | cls.__init(_self_0, ...) | ||
| 366 | return _self_0 | ||
| 367 | end | ||
| 368 | }) | ||
| 369 | _base_0.__class = _class_0 | ||
| 370 | Something = _class_0 | ||
| 371 | _module_0["Something"] = Something | ||
| 372 | return _module_0 | ||
| 373 | local _module_0 = { } | ||
| 374 | local loadstring, tolua | ||
| 375 | do | ||
| 376 | local _obj_0 = yue | ||
| 377 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 378 | end | ||
| 379 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 380 | local fieldA = tb.itemA.fieldA | ||
| 381 | if fieldA == nil then | ||
| 382 | fieldA = 'default' | ||
| 383 | end | ||
| 384 | _module_0["fieldA"] = fieldA | ||
| 385 | return _module_0 | ||
| 386 | local _module_0 = setmetatable({ }, { }) | ||
| 387 | _module_0.itemA = tb | ||
| 388 | getmetatable(_module_0).__index = items | ||
| 389 | _module_0["a-b-c"] = 123 | ||
| 390 | return _module_0 | ||
| 391 | local _module_0 = { } | ||
| 392 | local d, e, f = 3, 2, 1 | ||
| 393 | _module_0[#_module_0 + 1] = d | ||
| 394 | _module_0[#_module_0 + 1] = e | ||
| 395 | _module_0[#_module_0 + 1] = f | ||
| 396 | if this then | ||
| 397 | _module_0[#_module_0 + 1] = 123 | ||
| 398 | else | ||
| 399 | _module_0[#_module_0 + 1] = 456 | ||
| 400 | end | ||
| 401 | local _with_0 = tmp | ||
| 402 | local j = 2000 | ||
| 403 | _module_0[#_module_0 + 1] = _with_0 | ||
| 404 | return _module_0 | ||
| 405 | local _module_0 = nil | ||
| 406 | _module_0 = function() | ||
| 407 | print("hallo") | ||
| 408 | return 123 | ||
| 409 | end | ||
| 410 | return _module_0 | ||
| 411 | xpcall(function() | 173 | xpcall(function() |
| 412 | return func(1, 2, 3) | 174 | return func(1, 2, 3) |
| 413 | end, function(err) | 175 | end, function(err) |
| @@ -2395,6 +2157,12 @@ local file | |||
| 2395 | local _with_0 = File("Lieblingsessen.txt") | 2157 | local _with_0 = File("Lieblingsessen.txt") |
| 2396 | _with_0:set_encoding("utf8") | 2158 | _with_0:set_encoding("utf8") |
| 2397 | file = _with_0 | 2159 | file = _with_0 |
| 2160 | local result | ||
| 2161 | local _with_0 = obj | ||
| 2162 | repeat | ||
| 2163 | result = _with_0.value | ||
| 2164 | break | ||
| 2165 | until true | ||
| 2398 | local create_person | 2166 | local create_person |
| 2399 | create_person = function(name, relatives) | 2167 | create_person = function(name, relatives) |
| 2400 | local _with_0 = Person() | 2168 | local _with_0 = Person() |
| @@ -2435,6 +2203,12 @@ local file | |||
| 2435 | local _with_0 = File("Lieblingsessen.txt") | 2203 | local _with_0 = File("Lieblingsessen.txt") |
| 2436 | _with_0:set_encoding("utf8") | 2204 | _with_0:set_encoding("utf8") |
| 2437 | file = _with_0 | 2205 | file = _with_0 |
| 2206 | local result | ||
| 2207 | local _with_0 = obj | ||
| 2208 | repeat | ||
| 2209 | result = _with_0.value | ||
| 2210 | break | ||
| 2211 | until true | ||
| 2438 | local create_person | 2212 | local create_person |
| 2439 | create_person = function(name, relatives) | 2213 | create_person = function(name, relatives) |
| 2440 | local _with_0 = Person() | 2214 | local _with_0 = Person() |
| @@ -3268,6 +3042,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3268 | break | 3042 | break |
| 3269 | end | 3043 | end |
| 3270 | end | 3044 | end |
| 3045 | local key, score | ||
| 3046 | for k, v in pairs(data) do | ||
| 3047 | if k == "target" then | ||
| 3048 | key, score = k, v * 10 | ||
| 3049 | break | ||
| 3050 | end | ||
| 3051 | end | ||
| 3271 | local func_a | 3052 | local func_a |
| 3272 | func_a = function() | 3053 | func_a = function() |
| 3273 | for i = 1, 10 do | 3054 | for i = 1, 10 do |
| @@ -3330,6 +3111,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3330 | break | 3111 | break |
| 3331 | end | 3112 | end |
| 3332 | end | 3113 | end |
| 3114 | local key, score | ||
| 3115 | for k, v in pairs(data) do | ||
| 3116 | if k == "target" then | ||
| 3117 | key, score = k, v * 10 | ||
| 3118 | break | ||
| 3119 | end | ||
| 3120 | end | ||
| 3333 | local func_a | 3121 | local func_a |
| 3334 | func_a = function() | 3122 | func_a = function() |
| 3335 | for i = 1, 10 do | 3123 | for i = 1, 10 do |
| @@ -4008,11 +3796,32 @@ end | |||
| 4008 | while not (running == false) do | 3796 | while not (running == false) do |
| 4009 | my_function() | 3797 | my_function() |
| 4010 | end | 3798 | end |
| 3799 | local value, doubled | ||
| 3800 | local _val_0, _val_1 | ||
| 3801 | while true do | ||
| 3802 | local n = get_next() | ||
| 3803 | if n > 10 then | ||
| 3804 | _val_0, _val_1 = n, n * 2 | ||
| 3805 | break | ||
| 3806 | end | ||
| 3807 | end | ||
| 3808 | value, doubled = _val_0, _val_1 | ||
| 4011 | local i = 10 | 3809 | local i = 10 |
| 4012 | repeat | 3810 | repeat |
| 4013 | print(i) | 3811 | print(i) |
| 4014 | i = i - 1 | 3812 | i = i - 1 |
| 4015 | until i == 0 | 3813 | until i == 0 |
| 3814 | local i = 1 | ||
| 3815 | local value, scaled | ||
| 3816 | local _val_0, _val_1 | ||
| 3817 | repeat | ||
| 3818 | if i > 3 then | ||
| 3819 | _val_0, _val_1 = i, i * 100 | ||
| 3820 | break | ||
| 3821 | end | ||
| 3822 | i = i + 1 | ||
| 3823 | until false | ||
| 3824 | value, scaled = _val_0, _val_1 | ||
| 4016 | local i = 10 | 3825 | local i = 10 |
| 4017 | while i > 0 do | 3826 | while i > 0 do |
| 4018 | print(i) | 3827 | print(i) |
| @@ -4029,11 +3838,32 @@ end | |||
| 4029 | while not (running == false) do | 3838 | while not (running == false) do |
| 4030 | my_function() | 3839 | my_function() |
| 4031 | end | 3840 | end |
| 3841 | local value, doubled | ||
| 3842 | local _val_0, _val_1 | ||
| 3843 | while true do | ||
| 3844 | local n = get_next() | ||
| 3845 | if n > 10 then | ||
| 3846 | _val_0, _val_1 = n, n * 2 | ||
| 3847 | break | ||
| 3848 | end | ||
| 3849 | end | ||
| 3850 | value, doubled = _val_0, _val_1 | ||
| 4032 | local i = 10 | 3851 | local i = 10 |
| 4033 | repeat | 3852 | repeat |
| 4034 | print(i) | 3853 | print(i) |
| 4035 | i = i - 1 | 3854 | i = i - 1 |
| 4036 | until i == 0 | 3855 | until i == 0 |
| 3856 | local i = 1 | ||
| 3857 | local value, scaled | ||
| 3858 | local _val_0, _val_1 | ||
| 3859 | repeat | ||
| 3860 | if i > 3 then | ||
| 3861 | _val_0, _val_1 = i, i * 100 | ||
| 3862 | break | ||
| 3863 | end | ||
| 3864 | i = i + 1 | ||
| 3865 | until false | ||
| 3866 | value, scaled = _val_0, _val_1 | ||
| 4037 | local my_object = { | 3867 | local my_object = { |
| 4038 | value = 1000, | 3868 | value = 1000, |
| 4039 | write = function(self) | 3869 | write = function(self) |
| @@ -5136,3 +4966,265 @@ fn = function() | |||
| 5136 | return str | 4966 | return str |
| 5137 | end | 4967 | end |
| 5138 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | 4968 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" |
| 4969 | do | ||
| 4970 | local insert, concat = table.insert, table.concat | ||
| 4971 | local C, Ct, Cmt | ||
| 4972 | do | ||
| 4973 | local _obj_0 = require("lpeg") | ||
| 4974 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4975 | end | ||
| 4976 | local x, y, z | ||
| 4977 | do | ||
| 4978 | local _obj_0 = require('mymodule') | ||
| 4979 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 4980 | end | ||
| 4981 | local a, b, c | ||
| 4982 | local _obj_0 = require('module') | ||
| 4983 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 4984 | end | ||
| 4985 | do | ||
| 4986 | local module = require('module') | ||
| 4987 | local module_x = require('module_x') | ||
| 4988 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 4989 | local part = require("module.part") | ||
| 4990 | end | ||
| 4991 | do | ||
| 4992 | local PlayerModule = require("player") | ||
| 4993 | local C, Ct, Cmt | ||
| 4994 | do | ||
| 4995 | local _obj_0 = require("lpeg") | ||
| 4996 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4997 | end | ||
| 4998 | local one, two, ch | ||
| 4999 | local _obj_0 = require("export") | ||
| 5000 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5001 | end | ||
| 5002 | do | ||
| 5003 | local tostring <const> = tostring | ||
| 5004 | local concat <const> = table.concat | ||
| 5005 | print(concat({ | ||
| 5006 | "a", | ||
| 5007 | tostring(1) | ||
| 5008 | })) | ||
| 5009 | end | ||
| 5010 | do | ||
| 5011 | local print <const> = print | ||
| 5012 | local math <const> = math | ||
| 5013 | print("hallo") | ||
| 5014 | math.random(3) | ||
| 5015 | end | ||
| 5016 | do | ||
| 5017 | local print <const> = print | ||
| 5018 | print(FLAG) | ||
| 5019 | FLAG = 123 | ||
| 5020 | end | ||
| 5021 | local _module_0 = { } | ||
| 5022 | local a, b, c = 1, 2, 3 | ||
| 5023 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5024 | local cool = "Katze" | ||
| 5025 | _module_0["cool"] = cool | ||
| 5026 | local What | ||
| 5027 | if this then | ||
| 5028 | What = "abc" | ||
| 5029 | else | ||
| 5030 | What = "def" | ||
| 5031 | end | ||
| 5032 | _module_0["What"] = What | ||
| 5033 | local y | ||
| 5034 | y = function() | ||
| 5035 | local hallo = 3434 | ||
| 5036 | end | ||
| 5037 | _module_0["y"] = y | ||
| 5038 | local Something | ||
| 5039 | local _class_0 | ||
| 5040 | local _base_0 = { | ||
| 5041 | umm = "cool" | ||
| 5042 | } | ||
| 5043 | if _base_0.__index == nil then | ||
| 5044 | _base_0.__index = _base_0 | ||
| 5045 | end | ||
| 5046 | _class_0 = setmetatable({ | ||
| 5047 | __init = function() end, | ||
| 5048 | __base = _base_0, | ||
| 5049 | __name = "Something" | ||
| 5050 | }, { | ||
| 5051 | __index = _base_0, | ||
| 5052 | __call = function(cls, ...) | ||
| 5053 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5054 | cls.__init(_self_0, ...) | ||
| 5055 | return _self_0 | ||
| 5056 | end | ||
| 5057 | }) | ||
| 5058 | _base_0.__class = _class_0 | ||
| 5059 | Something = _class_0 | ||
| 5060 | _module_0["Something"] = Something | ||
| 5061 | return _module_0 | ||
| 5062 | local _module_0 = { } | ||
| 5063 | local loadstring, tolua | ||
| 5064 | do | ||
| 5065 | local _obj_0 = yue | ||
| 5066 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5067 | end | ||
| 5068 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5069 | local fieldA = tb.itemA.fieldA | ||
| 5070 | if fieldA == nil then | ||
| 5071 | fieldA = 'default' | ||
| 5072 | end | ||
| 5073 | _module_0["fieldA"] = fieldA | ||
| 5074 | return _module_0 | ||
| 5075 | local _module_0 = setmetatable({ }, { }) | ||
| 5076 | _module_0.itemA = tb | ||
| 5077 | getmetatable(_module_0).__index = items | ||
| 5078 | _module_0["a-b-c"] = 123 | ||
| 5079 | return _module_0 | ||
| 5080 | local _module_0 = { } | ||
| 5081 | local d, e, f = 3, 2, 1 | ||
| 5082 | _module_0[#_module_0 + 1] = d | ||
| 5083 | _module_0[#_module_0 + 1] = e | ||
| 5084 | _module_0[#_module_0 + 1] = f | ||
| 5085 | if this then | ||
| 5086 | _module_0[#_module_0 + 1] = 123 | ||
| 5087 | else | ||
| 5088 | _module_0[#_module_0 + 1] = 456 | ||
| 5089 | end | ||
| 5090 | local _with_0 = tmp | ||
| 5091 | local j = 2000 | ||
| 5092 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5093 | return _module_0 | ||
| 5094 | local _module_0 = nil | ||
| 5095 | _module_0 = function() | ||
| 5096 | print("hallo") | ||
| 5097 | return 123 | ||
| 5098 | end | ||
| 5099 | return _module_0 | ||
| 5100 | do | ||
| 5101 | local insert, concat = table.insert, table.concat | ||
| 5102 | local C, Ct, Cmt | ||
| 5103 | do | ||
| 5104 | local _obj_0 = require("lpeg") | ||
| 5105 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5106 | end | ||
| 5107 | local x, y, z | ||
| 5108 | do | ||
| 5109 | local _obj_0 = require('mymodule') | ||
| 5110 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 5111 | end | ||
| 5112 | local a, b, c | ||
| 5113 | local _obj_0 = require('module') | ||
| 5114 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 5115 | end | ||
| 5116 | do | ||
| 5117 | local module = require('module') | ||
| 5118 | local module_x = require('module_x') | ||
| 5119 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 5120 | local part = require("module.part") | ||
| 5121 | end | ||
| 5122 | do | ||
| 5123 | local PlayerModule = require("player") | ||
| 5124 | local C, Ct, Cmt | ||
| 5125 | do | ||
| 5126 | local _obj_0 = require("lpeg") | ||
| 5127 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5128 | end | ||
| 5129 | local one, two, ch | ||
| 5130 | local _obj_0 = require("export") | ||
| 5131 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5132 | end | ||
| 5133 | do | ||
| 5134 | local tostring <const> = tostring | ||
| 5135 | local concat <const> = table.concat | ||
| 5136 | print(concat({ | ||
| 5137 | "a", | ||
| 5138 | tostring(1) | ||
| 5139 | })) | ||
| 5140 | end | ||
| 5141 | do | ||
| 5142 | local print <const> = print | ||
| 5143 | local math <const> = math | ||
| 5144 | print("hallo") | ||
| 5145 | math.random(3) | ||
| 5146 | end | ||
| 5147 | do | ||
| 5148 | local print <const> = print | ||
| 5149 | print(FLAG) | ||
| 5150 | FLAG = 123 | ||
| 5151 | end | ||
| 5152 | local _module_0 = { } | ||
| 5153 | local a, b, c = 1, 2, 3 | ||
| 5154 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5155 | local cool = "Katze" | ||
| 5156 | _module_0["cool"] = cool | ||
| 5157 | local What | ||
| 5158 | if this then | ||
| 5159 | What = "abc" | ||
| 5160 | else | ||
| 5161 | What = "def" | ||
| 5162 | end | ||
| 5163 | _module_0["What"] = What | ||
| 5164 | local y | ||
| 5165 | y = function() | ||
| 5166 | local hallo = 3434 | ||
| 5167 | end | ||
| 5168 | _module_0["y"] = y | ||
| 5169 | local Something | ||
| 5170 | local _class_0 | ||
| 5171 | local _base_0 = { | ||
| 5172 | umm = "cool" | ||
| 5173 | } | ||
| 5174 | if _base_0.__index == nil then | ||
| 5175 | _base_0.__index = _base_0 | ||
| 5176 | end | ||
| 5177 | _class_0 = setmetatable({ | ||
| 5178 | __init = function() end, | ||
| 5179 | __base = _base_0, | ||
| 5180 | __name = "Something" | ||
| 5181 | }, { | ||
| 5182 | __index = _base_0, | ||
| 5183 | __call = function(cls, ...) | ||
| 5184 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5185 | cls.__init(_self_0, ...) | ||
| 5186 | return _self_0 | ||
| 5187 | end | ||
| 5188 | }) | ||
| 5189 | _base_0.__class = _class_0 | ||
| 5190 | Something = _class_0 | ||
| 5191 | _module_0["Something"] = Something | ||
| 5192 | return _module_0 | ||
| 5193 | local _module_0 = { } | ||
| 5194 | local loadstring, tolua | ||
| 5195 | do | ||
| 5196 | local _obj_0 = yue | ||
| 5197 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5198 | end | ||
| 5199 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5200 | local fieldA = tb.itemA.fieldA | ||
| 5201 | if fieldA == nil then | ||
| 5202 | fieldA = 'default' | ||
| 5203 | end | ||
| 5204 | _module_0["fieldA"] = fieldA | ||
| 5205 | return _module_0 | ||
| 5206 | local _module_0 = setmetatable({ }, { }) | ||
| 5207 | _module_0.itemA = tb | ||
| 5208 | getmetatable(_module_0).__index = items | ||
| 5209 | _module_0["a-b-c"] = 123 | ||
| 5210 | return _module_0 | ||
| 5211 | local _module_0 = { } | ||
| 5212 | local d, e, f = 3, 2, 1 | ||
| 5213 | _module_0[#_module_0 + 1] = d | ||
| 5214 | _module_0[#_module_0 + 1] = e | ||
| 5215 | _module_0[#_module_0 + 1] = f | ||
| 5216 | if this then | ||
| 5217 | _module_0[#_module_0 + 1] = 123 | ||
| 5218 | else | ||
| 5219 | _module_0[#_module_0 + 1] = 456 | ||
| 5220 | end | ||
| 5221 | local _with_0 = tmp | ||
| 5222 | local j = 2000 | ||
| 5223 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5224 | return _module_0 | ||
| 5225 | local _module_0 = nil | ||
| 5226 | _module_0 = function() | ||
| 5227 | print("hallo") | ||
| 5228 | return 123 | ||
| 5229 | end | ||
| 5230 | return _module_0 | ||
diff --git a/spec/outputs/codes_from_doc_en.lua b/spec/outputs/codes_from_doc_en.lua index cd83bbf..4006605 100644 --- a/spec/outputs/codes_from_doc_en.lua +++ b/spec/outputs/codes_from_doc_en.lua | |||
| @@ -3,6 +3,18 @@ do | |||
| 3 | print(var) | 3 | print(var) |
| 4 | end | 4 | end |
| 5 | print(var) | 5 | print(var) |
| 6 | local status, value | ||
| 7 | do | ||
| 8 | repeat | ||
| 9 | local n = 12 | ||
| 10 | if n > 10 then | ||
| 11 | status, value = "large", n | ||
| 12 | break | ||
| 13 | end | ||
| 14 | status, value = "small", n | ||
| 15 | break | ||
| 16 | until true | ||
| 17 | end | ||
| 6 | local counter | 18 | local counter |
| 7 | do | 19 | do |
| 8 | local i = 0 | 20 | local i = 0 |
| @@ -24,6 +36,18 @@ do | |||
| 24 | print(var) | 36 | print(var) |
| 25 | end | 37 | end |
| 26 | print(var) | 38 | print(var) |
| 39 | local status, value | ||
| 40 | do | ||
| 41 | repeat | ||
| 42 | local n = 12 | ||
| 43 | if n > 10 then | ||
| 44 | status, value = "large", n | ||
| 45 | break | ||
| 46 | end | ||
| 47 | status, value = "small", n | ||
| 48 | break | ||
| 49 | until true | ||
| 50 | end | ||
| 27 | local counter | 51 | local counter |
| 28 | do | 52 | do |
| 29 | local i = 0 | 53 | local i = 0 |
| @@ -146,268 +170,6 @@ end | |||
| 146 | do | 170 | do |
| 147 | print(123, "hello") | 171 | print(123, "hello") |
| 148 | end | 172 | end |
| 149 | do | ||
| 150 | local insert, concat = table.insert, table.concat | ||
| 151 | local C, Ct, Cmt | ||
| 152 | do | ||
| 153 | local _obj_0 = require("lpeg") | ||
| 154 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 155 | end | ||
| 156 | local x, y, z | ||
| 157 | do | ||
| 158 | local _obj_0 = require('mymodule') | ||
| 159 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 160 | end | ||
| 161 | local a, b, c | ||
| 162 | local _obj_0 = require('module') | ||
| 163 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 164 | end | ||
| 165 | do | ||
| 166 | local module = require('module') | ||
| 167 | local module_x = require('module_x') | ||
| 168 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 169 | local part = require("module.part") | ||
| 170 | end | ||
| 171 | do | ||
| 172 | local PlayerModule = require("player") | ||
| 173 | local C, Ct, Cmt | ||
| 174 | do | ||
| 175 | local _obj_0 = require("lpeg") | ||
| 176 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 177 | end | ||
| 178 | local one, two, ch | ||
| 179 | local _obj_0 = require("export") | ||
| 180 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 181 | end | ||
| 182 | do | ||
| 183 | local tostring <const> = tostring | ||
| 184 | local concat <const> = table.concat | ||
| 185 | print(concat({ | ||
| 186 | "a", | ||
| 187 | tostring(1) | ||
| 188 | })) | ||
| 189 | end | ||
| 190 | do | ||
| 191 | local print <const> = print | ||
| 192 | local math <const> = math | ||
| 193 | print("hello") | ||
| 194 | math.random(3) | ||
| 195 | end | ||
| 196 | do | ||
| 197 | local print <const> = print | ||
| 198 | print(FLAG) | ||
| 199 | FLAG = 123 | ||
| 200 | end | ||
| 201 | local _module_0 = { } | ||
| 202 | local a, b, c = 1, 2, 3 | ||
| 203 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 204 | local cool = "cat" | ||
| 205 | _module_0["cool"] = cool | ||
| 206 | local What | ||
| 207 | if this then | ||
| 208 | What = "abc" | ||
| 209 | else | ||
| 210 | What = "def" | ||
| 211 | end | ||
| 212 | _module_0["What"] = What | ||
| 213 | local y | ||
| 214 | y = function() | ||
| 215 | local hallo = 3434 | ||
| 216 | end | ||
| 217 | _module_0["y"] = y | ||
| 218 | local Something | ||
| 219 | local _class_0 | ||
| 220 | local _base_0 = { | ||
| 221 | umm = "cool" | ||
| 222 | } | ||
| 223 | if _base_0.__index == nil then | ||
| 224 | _base_0.__index = _base_0 | ||
| 225 | end | ||
| 226 | _class_0 = setmetatable({ | ||
| 227 | __init = function() end, | ||
| 228 | __base = _base_0, | ||
| 229 | __name = "Something" | ||
| 230 | }, { | ||
| 231 | __index = _base_0, | ||
| 232 | __call = function(cls, ...) | ||
| 233 | local _self_0 = setmetatable({ }, _base_0) | ||
| 234 | cls.__init(_self_0, ...) | ||
| 235 | return _self_0 | ||
| 236 | end | ||
| 237 | }) | ||
| 238 | _base_0.__class = _class_0 | ||
| 239 | Something = _class_0 | ||
| 240 | _module_0["Something"] = Something | ||
| 241 | return _module_0 | ||
| 242 | local _module_0 = { } | ||
| 243 | local loadstring, tolua | ||
| 244 | do | ||
| 245 | local _obj_0 = yue | ||
| 246 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 247 | end | ||
| 248 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 249 | local fieldA = tb.itemA.fieldA | ||
| 250 | if fieldA == nil then | ||
| 251 | fieldA = 'default' | ||
| 252 | end | ||
| 253 | _module_0["fieldA"] = fieldA | ||
| 254 | return _module_0 | ||
| 255 | local _module_0 = setmetatable({ }, { }) | ||
| 256 | _module_0.itemA = tb | ||
| 257 | getmetatable(_module_0).__index = items | ||
| 258 | _module_0["a-b-c"] = 123 | ||
| 259 | return _module_0 | ||
| 260 | local _module_0 = { } | ||
| 261 | local d, e, f = 3, 2, 1 | ||
| 262 | _module_0[#_module_0 + 1] = d | ||
| 263 | _module_0[#_module_0 + 1] = e | ||
| 264 | _module_0[#_module_0 + 1] = f | ||
| 265 | if this then | ||
| 266 | _module_0[#_module_0 + 1] = 123 | ||
| 267 | else | ||
| 268 | _module_0[#_module_0 + 1] = 456 | ||
| 269 | end | ||
| 270 | local _with_0 = tmp | ||
| 271 | local j = 2000 | ||
| 272 | _module_0[#_module_0 + 1] = _with_0 | ||
| 273 | return _module_0 | ||
| 274 | local _module_0 = nil | ||
| 275 | _module_0 = function() | ||
| 276 | print("hello") | ||
| 277 | return 123 | ||
| 278 | end | ||
| 279 | return _module_0 | ||
| 280 | do | ||
| 281 | local insert, concat = table.insert, table.concat | ||
| 282 | local C, Ct, Cmt | ||
| 283 | do | ||
| 284 | local _obj_0 = require("lpeg") | ||
| 285 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 286 | end | ||
| 287 | local x, y, z | ||
| 288 | do | ||
| 289 | local _obj_0 = require('mymodule') | ||
| 290 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 291 | end | ||
| 292 | local a, b, c | ||
| 293 | local _obj_0 = require('module') | ||
| 294 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 295 | end | ||
| 296 | do | ||
| 297 | local module = require('module') | ||
| 298 | local module_x = require('module_x') | ||
| 299 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 300 | local part = require("module.part") | ||
| 301 | end | ||
| 302 | do | ||
| 303 | local PlayerModule = require("player") | ||
| 304 | local C, Ct, Cmt | ||
| 305 | do | ||
| 306 | local _obj_0 = require("lpeg") | ||
| 307 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 308 | end | ||
| 309 | local one, two, ch | ||
| 310 | local _obj_0 = require("export") | ||
| 311 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 312 | end | ||
| 313 | do | ||
| 314 | local tostring <const> = tostring | ||
| 315 | local concat <const> = table.concat | ||
| 316 | print(concat({ | ||
| 317 | "a", | ||
| 318 | tostring(1) | ||
| 319 | })) | ||
| 320 | end | ||
| 321 | do | ||
| 322 | local print <const> = print | ||
| 323 | local math <const> = math | ||
| 324 | print("hello") | ||
| 325 | math.random(3) | ||
| 326 | end | ||
| 327 | do | ||
| 328 | local print <const> = print | ||
| 329 | print(FLAG) | ||
| 330 | FLAG = 123 | ||
| 331 | end | ||
| 332 | local _module_0 = { } | ||
| 333 | local a, b, c = 1, 2, 3 | ||
| 334 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 335 | local cool = "cat" | ||
| 336 | _module_0["cool"] = cool | ||
| 337 | local What | ||
| 338 | if this then | ||
| 339 | What = "abc" | ||
| 340 | else | ||
| 341 | What = "def" | ||
| 342 | end | ||
| 343 | _module_0["What"] = What | ||
| 344 | local y | ||
| 345 | y = function() | ||
| 346 | local hallo = 3434 | ||
| 347 | end | ||
| 348 | _module_0["y"] = y | ||
| 349 | local Something | ||
| 350 | local _class_0 | ||
| 351 | local _base_0 = { | ||
| 352 | umm = "cool" | ||
| 353 | } | ||
| 354 | if _base_0.__index == nil then | ||
| 355 | _base_0.__index = _base_0 | ||
| 356 | end | ||
| 357 | _class_0 = setmetatable({ | ||
| 358 | __init = function() end, | ||
| 359 | __base = _base_0, | ||
| 360 | __name = "Something" | ||
| 361 | }, { | ||
| 362 | __index = _base_0, | ||
| 363 | __call = function(cls, ...) | ||
| 364 | local _self_0 = setmetatable({ }, _base_0) | ||
| 365 | cls.__init(_self_0, ...) | ||
| 366 | return _self_0 | ||
| 367 | end | ||
| 368 | }) | ||
| 369 | _base_0.__class = _class_0 | ||
| 370 | Something = _class_0 | ||
| 371 | _module_0["Something"] = Something | ||
| 372 | return _module_0 | ||
| 373 | local _module_0 = { } | ||
| 374 | local loadstring, tolua | ||
| 375 | do | ||
| 376 | local _obj_0 = yue | ||
| 377 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 378 | end | ||
| 379 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 380 | local fieldA = tb.itemA.fieldA | ||
| 381 | if fieldA == nil then | ||
| 382 | fieldA = 'default' | ||
| 383 | end | ||
| 384 | _module_0["fieldA"] = fieldA | ||
| 385 | return _module_0 | ||
| 386 | local _module_0 = setmetatable({ }, { }) | ||
| 387 | _module_0.itemA = tb | ||
| 388 | getmetatable(_module_0).__index = items | ||
| 389 | _module_0["a-b-c"] = 123 | ||
| 390 | return _module_0 | ||
| 391 | local _module_0 = { } | ||
| 392 | local d, e, f = 3, 2, 1 | ||
| 393 | _module_0[#_module_0 + 1] = d | ||
| 394 | _module_0[#_module_0 + 1] = e | ||
| 395 | _module_0[#_module_0 + 1] = f | ||
| 396 | if this then | ||
| 397 | _module_0[#_module_0 + 1] = 123 | ||
| 398 | else | ||
| 399 | _module_0[#_module_0 + 1] = 456 | ||
| 400 | end | ||
| 401 | local _with_0 = tmp | ||
| 402 | local j = 2000 | ||
| 403 | _module_0[#_module_0 + 1] = _with_0 | ||
| 404 | return _module_0 | ||
| 405 | local _module_0 = nil | ||
| 406 | _module_0 = function() | ||
| 407 | print("hello") | ||
| 408 | return 123 | ||
| 409 | end | ||
| 410 | return _module_0 | ||
| 411 | xpcall(function() | 173 | xpcall(function() |
| 412 | return func(1, 2, 3) | 174 | return func(1, 2, 3) |
| 413 | end, function(err) | 175 | end, function(err) |
| @@ -2395,6 +2157,12 @@ local file | |||
| 2395 | local _with_0 = File("favorite_foods.txt") | 2157 | local _with_0 = File("favorite_foods.txt") |
| 2396 | _with_0:set_encoding("utf8") | 2158 | _with_0:set_encoding("utf8") |
| 2397 | file = _with_0 | 2159 | file = _with_0 |
| 2160 | local result | ||
| 2161 | local _with_0 = obj | ||
| 2162 | repeat | ||
| 2163 | result = _with_0.value | ||
| 2164 | break | ||
| 2165 | until true | ||
| 2398 | local create_person | 2166 | local create_person |
| 2399 | create_person = function(name, relatives) | 2167 | create_person = function(name, relatives) |
| 2400 | local _with_0 = Person() | 2168 | local _with_0 = Person() |
| @@ -2435,6 +2203,12 @@ local file | |||
| 2435 | local _with_0 = File("favorite_foods.txt") | 2203 | local _with_0 = File("favorite_foods.txt") |
| 2436 | _with_0:set_encoding("utf8") | 2204 | _with_0:set_encoding("utf8") |
| 2437 | file = _with_0 | 2205 | file = _with_0 |
| 2206 | local result | ||
| 2207 | local _with_0 = obj | ||
| 2208 | repeat | ||
| 2209 | result = _with_0.value | ||
| 2210 | break | ||
| 2211 | until true | ||
| 2438 | local create_person | 2212 | local create_person |
| 2439 | create_person = function(name, relatives) | 2213 | create_person = function(name, relatives) |
| 2440 | local _with_0 = Person() | 2214 | local _with_0 = Person() |
| @@ -3268,6 +3042,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3268 | break | 3042 | break |
| 3269 | end | 3043 | end |
| 3270 | end | 3044 | end |
| 3045 | local key, score | ||
| 3046 | for k, v in pairs(data) do | ||
| 3047 | if k == "target" then | ||
| 3048 | key, score = k, v * 10 | ||
| 3049 | break | ||
| 3050 | end | ||
| 3051 | end | ||
| 3271 | local func_a | 3052 | local func_a |
| 3272 | func_a = function() | 3053 | func_a = function() |
| 3273 | for i = 1, 10 do | 3054 | for i = 1, 10 do |
| @@ -3330,6 +3111,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3330 | break | 3111 | break |
| 3331 | end | 3112 | end |
| 3332 | end | 3113 | end |
| 3114 | local key, score | ||
| 3115 | for k, v in pairs(data) do | ||
| 3116 | if k == "target" then | ||
| 3117 | key, score = k, v * 10 | ||
| 3118 | break | ||
| 3119 | end | ||
| 3120 | end | ||
| 3333 | local func_a | 3121 | local func_a |
| 3334 | func_a = function() | 3122 | func_a = function() |
| 3335 | for i = 1, 10 do | 3123 | for i = 1, 10 do |
| @@ -4008,11 +3796,32 @@ end | |||
| 4008 | while not (running == false) do | 3796 | while not (running == false) do |
| 4009 | my_function() | 3797 | my_function() |
| 4010 | end | 3798 | end |
| 3799 | local value, doubled | ||
| 3800 | local _val_0, _val_1 | ||
| 3801 | while true do | ||
| 3802 | local n = get_next() | ||
| 3803 | if n > 10 then | ||
| 3804 | _val_0, _val_1 = n, n * 2 | ||
| 3805 | break | ||
| 3806 | end | ||
| 3807 | end | ||
| 3808 | value, doubled = _val_0, _val_1 | ||
| 4011 | local i = 10 | 3809 | local i = 10 |
| 4012 | repeat | 3810 | repeat |
| 4013 | print(i) | 3811 | print(i) |
| 4014 | i = i - 1 | 3812 | i = i - 1 |
| 4015 | until i == 0 | 3813 | until i == 0 |
| 3814 | local i = 1 | ||
| 3815 | local value, scaled | ||
| 3816 | local _val_0, _val_1 | ||
| 3817 | repeat | ||
| 3818 | if i > 3 then | ||
| 3819 | _val_0, _val_1 = i, i * 100 | ||
| 3820 | break | ||
| 3821 | end | ||
| 3822 | i = i + 1 | ||
| 3823 | until false | ||
| 3824 | value, scaled = _val_0, _val_1 | ||
| 4016 | local i = 10 | 3825 | local i = 10 |
| 4017 | while i > 0 do | 3826 | while i > 0 do |
| 4018 | print(i) | 3827 | print(i) |
| @@ -4029,11 +3838,32 @@ end | |||
| 4029 | while not (running == false) do | 3838 | while not (running == false) do |
| 4030 | my_function() | 3839 | my_function() |
| 4031 | end | 3840 | end |
| 3841 | local value, doubled | ||
| 3842 | local _val_0, _val_1 | ||
| 3843 | while true do | ||
| 3844 | local n = get_next() | ||
| 3845 | if n > 10 then | ||
| 3846 | _val_0, _val_1 = n, n * 2 | ||
| 3847 | break | ||
| 3848 | end | ||
| 3849 | end | ||
| 3850 | value, doubled = _val_0, _val_1 | ||
| 4032 | local i = 10 | 3851 | local i = 10 |
| 4033 | repeat | 3852 | repeat |
| 4034 | print(i) | 3853 | print(i) |
| 4035 | i = i - 1 | 3854 | i = i - 1 |
| 4036 | until i == 0 | 3855 | until i == 0 |
| 3856 | local i = 1 | ||
| 3857 | local value, scaled | ||
| 3858 | local _val_0, _val_1 | ||
| 3859 | repeat | ||
| 3860 | if i > 3 then | ||
| 3861 | _val_0, _val_1 = i, i * 100 | ||
| 3862 | break | ||
| 3863 | end | ||
| 3864 | i = i + 1 | ||
| 3865 | until false | ||
| 3866 | value, scaled = _val_0, _val_1 | ||
| 4037 | local my_object = { | 3867 | local my_object = { |
| 4038 | value = 1000, | 3868 | value = 1000, |
| 4039 | write = function(self) | 3869 | write = function(self) |
| @@ -5136,3 +4966,265 @@ fn = function() | |||
| 5136 | return str | 4966 | return str |
| 5137 | end | 4967 | end |
| 5138 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | 4968 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" |
| 4969 | do | ||
| 4970 | local insert, concat = table.insert, table.concat | ||
| 4971 | local C, Ct, Cmt | ||
| 4972 | do | ||
| 4973 | local _obj_0 = require("lpeg") | ||
| 4974 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4975 | end | ||
| 4976 | local x, y, z | ||
| 4977 | do | ||
| 4978 | local _obj_0 = require('mymodule') | ||
| 4979 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 4980 | end | ||
| 4981 | local a, b, c | ||
| 4982 | local _obj_0 = require('module') | ||
| 4983 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 4984 | end | ||
| 4985 | do | ||
| 4986 | local module = require('module') | ||
| 4987 | local module_x = require('module_x') | ||
| 4988 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 4989 | local part = require("module.part") | ||
| 4990 | end | ||
| 4991 | do | ||
| 4992 | local PlayerModule = require("player") | ||
| 4993 | local C, Ct, Cmt | ||
| 4994 | do | ||
| 4995 | local _obj_0 = require("lpeg") | ||
| 4996 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4997 | end | ||
| 4998 | local one, two, ch | ||
| 4999 | local _obj_0 = require("export") | ||
| 5000 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5001 | end | ||
| 5002 | do | ||
| 5003 | local tostring <const> = tostring | ||
| 5004 | local concat <const> = table.concat | ||
| 5005 | print(concat({ | ||
| 5006 | "a", | ||
| 5007 | tostring(1) | ||
| 5008 | })) | ||
| 5009 | end | ||
| 5010 | do | ||
| 5011 | local print <const> = print | ||
| 5012 | local math <const> = math | ||
| 5013 | print("hello") | ||
| 5014 | math.random(3) | ||
| 5015 | end | ||
| 5016 | do | ||
| 5017 | local print <const> = print | ||
| 5018 | print(FLAG) | ||
| 5019 | FLAG = 123 | ||
| 5020 | end | ||
| 5021 | local _module_0 = { } | ||
| 5022 | local a, b, c = 1, 2, 3 | ||
| 5023 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5024 | local cool = "cat" | ||
| 5025 | _module_0["cool"] = cool | ||
| 5026 | local What | ||
| 5027 | if this then | ||
| 5028 | What = "abc" | ||
| 5029 | else | ||
| 5030 | What = "def" | ||
| 5031 | end | ||
| 5032 | _module_0["What"] = What | ||
| 5033 | local y | ||
| 5034 | y = function() | ||
| 5035 | local hallo = 3434 | ||
| 5036 | end | ||
| 5037 | _module_0["y"] = y | ||
| 5038 | local Something | ||
| 5039 | local _class_0 | ||
| 5040 | local _base_0 = { | ||
| 5041 | umm = "cool" | ||
| 5042 | } | ||
| 5043 | if _base_0.__index == nil then | ||
| 5044 | _base_0.__index = _base_0 | ||
| 5045 | end | ||
| 5046 | _class_0 = setmetatable({ | ||
| 5047 | __init = function() end, | ||
| 5048 | __base = _base_0, | ||
| 5049 | __name = "Something" | ||
| 5050 | }, { | ||
| 5051 | __index = _base_0, | ||
| 5052 | __call = function(cls, ...) | ||
| 5053 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5054 | cls.__init(_self_0, ...) | ||
| 5055 | return _self_0 | ||
| 5056 | end | ||
| 5057 | }) | ||
| 5058 | _base_0.__class = _class_0 | ||
| 5059 | Something = _class_0 | ||
| 5060 | _module_0["Something"] = Something | ||
| 5061 | return _module_0 | ||
| 5062 | local _module_0 = { } | ||
| 5063 | local loadstring, tolua | ||
| 5064 | do | ||
| 5065 | local _obj_0 = yue | ||
| 5066 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5067 | end | ||
| 5068 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5069 | local fieldA = tb.itemA.fieldA | ||
| 5070 | if fieldA == nil then | ||
| 5071 | fieldA = 'default' | ||
| 5072 | end | ||
| 5073 | _module_0["fieldA"] = fieldA | ||
| 5074 | return _module_0 | ||
| 5075 | local _module_0 = setmetatable({ }, { }) | ||
| 5076 | _module_0.itemA = tb | ||
| 5077 | getmetatable(_module_0).__index = items | ||
| 5078 | _module_0["a-b-c"] = 123 | ||
| 5079 | return _module_0 | ||
| 5080 | local _module_0 = { } | ||
| 5081 | local d, e, f = 3, 2, 1 | ||
| 5082 | _module_0[#_module_0 + 1] = d | ||
| 5083 | _module_0[#_module_0 + 1] = e | ||
| 5084 | _module_0[#_module_0 + 1] = f | ||
| 5085 | if this then | ||
| 5086 | _module_0[#_module_0 + 1] = 123 | ||
| 5087 | else | ||
| 5088 | _module_0[#_module_0 + 1] = 456 | ||
| 5089 | end | ||
| 5090 | local _with_0 = tmp | ||
| 5091 | local j = 2000 | ||
| 5092 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5093 | return _module_0 | ||
| 5094 | local _module_0 = nil | ||
| 5095 | _module_0 = function() | ||
| 5096 | print("hello") | ||
| 5097 | return 123 | ||
| 5098 | end | ||
| 5099 | return _module_0 | ||
| 5100 | do | ||
| 5101 | local insert, concat = table.insert, table.concat | ||
| 5102 | local C, Ct, Cmt | ||
| 5103 | do | ||
| 5104 | local _obj_0 = require("lpeg") | ||
| 5105 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5106 | end | ||
| 5107 | local x, y, z | ||
| 5108 | do | ||
| 5109 | local _obj_0 = require('mymodule') | ||
| 5110 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 5111 | end | ||
| 5112 | local a, b, c | ||
| 5113 | local _obj_0 = require('module') | ||
| 5114 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 5115 | end | ||
| 5116 | do | ||
| 5117 | local module = require('module') | ||
| 5118 | local module_x = require('module_x') | ||
| 5119 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 5120 | local part = require("module.part") | ||
| 5121 | end | ||
| 5122 | do | ||
| 5123 | local PlayerModule = require("player") | ||
| 5124 | local C, Ct, Cmt | ||
| 5125 | do | ||
| 5126 | local _obj_0 = require("lpeg") | ||
| 5127 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5128 | end | ||
| 5129 | local one, two, ch | ||
| 5130 | local _obj_0 = require("export") | ||
| 5131 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5132 | end | ||
| 5133 | do | ||
| 5134 | local tostring <const> = tostring | ||
| 5135 | local concat <const> = table.concat | ||
| 5136 | print(concat({ | ||
| 5137 | "a", | ||
| 5138 | tostring(1) | ||
| 5139 | })) | ||
| 5140 | end | ||
| 5141 | do | ||
| 5142 | local print <const> = print | ||
| 5143 | local math <const> = math | ||
| 5144 | print("hello") | ||
| 5145 | math.random(3) | ||
| 5146 | end | ||
| 5147 | do | ||
| 5148 | local print <const> = print | ||
| 5149 | print(FLAG) | ||
| 5150 | FLAG = 123 | ||
| 5151 | end | ||
| 5152 | local _module_0 = { } | ||
| 5153 | local a, b, c = 1, 2, 3 | ||
| 5154 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5155 | local cool = "cat" | ||
| 5156 | _module_0["cool"] = cool | ||
| 5157 | local What | ||
| 5158 | if this then | ||
| 5159 | What = "abc" | ||
| 5160 | else | ||
| 5161 | What = "def" | ||
| 5162 | end | ||
| 5163 | _module_0["What"] = What | ||
| 5164 | local y | ||
| 5165 | y = function() | ||
| 5166 | local hallo = 3434 | ||
| 5167 | end | ||
| 5168 | _module_0["y"] = y | ||
| 5169 | local Something | ||
| 5170 | local _class_0 | ||
| 5171 | local _base_0 = { | ||
| 5172 | umm = "cool" | ||
| 5173 | } | ||
| 5174 | if _base_0.__index == nil then | ||
| 5175 | _base_0.__index = _base_0 | ||
| 5176 | end | ||
| 5177 | _class_0 = setmetatable({ | ||
| 5178 | __init = function() end, | ||
| 5179 | __base = _base_0, | ||
| 5180 | __name = "Something" | ||
| 5181 | }, { | ||
| 5182 | __index = _base_0, | ||
| 5183 | __call = function(cls, ...) | ||
| 5184 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5185 | cls.__init(_self_0, ...) | ||
| 5186 | return _self_0 | ||
| 5187 | end | ||
| 5188 | }) | ||
| 5189 | _base_0.__class = _class_0 | ||
| 5190 | Something = _class_0 | ||
| 5191 | _module_0["Something"] = Something | ||
| 5192 | return _module_0 | ||
| 5193 | local _module_0 = { } | ||
| 5194 | local loadstring, tolua | ||
| 5195 | do | ||
| 5196 | local _obj_0 = yue | ||
| 5197 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5198 | end | ||
| 5199 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5200 | local fieldA = tb.itemA.fieldA | ||
| 5201 | if fieldA == nil then | ||
| 5202 | fieldA = 'default' | ||
| 5203 | end | ||
| 5204 | _module_0["fieldA"] = fieldA | ||
| 5205 | return _module_0 | ||
| 5206 | local _module_0 = setmetatable({ }, { }) | ||
| 5207 | _module_0.itemA = tb | ||
| 5208 | getmetatable(_module_0).__index = items | ||
| 5209 | _module_0["a-b-c"] = 123 | ||
| 5210 | return _module_0 | ||
| 5211 | local _module_0 = { } | ||
| 5212 | local d, e, f = 3, 2, 1 | ||
| 5213 | _module_0[#_module_0 + 1] = d | ||
| 5214 | _module_0[#_module_0 + 1] = e | ||
| 5215 | _module_0[#_module_0 + 1] = f | ||
| 5216 | if this then | ||
| 5217 | _module_0[#_module_0 + 1] = 123 | ||
| 5218 | else | ||
| 5219 | _module_0[#_module_0 + 1] = 456 | ||
| 5220 | end | ||
| 5221 | local _with_0 = tmp | ||
| 5222 | local j = 2000 | ||
| 5223 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5224 | return _module_0 | ||
| 5225 | local _module_0 = nil | ||
| 5226 | _module_0 = function() | ||
| 5227 | print("hello") | ||
| 5228 | return 123 | ||
| 5229 | end | ||
| 5230 | return _module_0 | ||
diff --git a/spec/outputs/codes_from_doc_id-id.lua b/spec/outputs/codes_from_doc_id-id.lua index b024989..7d95eaa 100644 --- a/spec/outputs/codes_from_doc_id-id.lua +++ b/spec/outputs/codes_from_doc_id-id.lua | |||
| @@ -3,6 +3,18 @@ do | |||
| 3 | print(var) | 3 | print(var) |
| 4 | end | 4 | end |
| 5 | print(var) | 5 | print(var) |
| 6 | local status, value | ||
| 7 | do | ||
| 8 | repeat | ||
| 9 | local n = 12 | ||
| 10 | if n > 10 then | ||
| 11 | status, value = "large", n | ||
| 12 | break | ||
| 13 | end | ||
| 14 | status, value = "small", n | ||
| 15 | break | ||
| 16 | until true | ||
| 17 | end | ||
| 6 | local counter | 18 | local counter |
| 7 | do | 19 | do |
| 8 | local i = 0 | 20 | local i = 0 |
| @@ -24,6 +36,18 @@ do | |||
| 24 | print(var) | 36 | print(var) |
| 25 | end | 37 | end |
| 26 | print(var) | 38 | print(var) |
| 39 | local status, value | ||
| 40 | do | ||
| 41 | repeat | ||
| 42 | local n = 12 | ||
| 43 | if n > 10 then | ||
| 44 | status, value = "large", n | ||
| 45 | break | ||
| 46 | end | ||
| 47 | status, value = "small", n | ||
| 48 | break | ||
| 49 | until true | ||
| 50 | end | ||
| 27 | local counter | 51 | local counter |
| 28 | do | 52 | do |
| 29 | local i = 0 | 53 | local i = 0 |
| @@ -146,268 +170,6 @@ end | |||
| 146 | do | 170 | do |
| 147 | print(123, "hello") | 171 | print(123, "hello") |
| 148 | end | 172 | end |
| 149 | do | ||
| 150 | local insert, concat = table.insert, table.concat | ||
| 151 | local C, Ct, Cmt | ||
| 152 | do | ||
| 153 | local _obj_0 = require("lpeg") | ||
| 154 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 155 | end | ||
| 156 | local x, y, z | ||
| 157 | do | ||
| 158 | local _obj_0 = require('mymodule') | ||
| 159 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 160 | end | ||
| 161 | local a, b, c | ||
| 162 | local _obj_0 = require('module') | ||
| 163 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 164 | end | ||
| 165 | do | ||
| 166 | local module = require('module') | ||
| 167 | local module_x = require('module_x') | ||
| 168 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 169 | local part = require("module.part") | ||
| 170 | end | ||
| 171 | do | ||
| 172 | local PlayerModule = require("player") | ||
| 173 | local C, Ct, Cmt | ||
| 174 | do | ||
| 175 | local _obj_0 = require("lpeg") | ||
| 176 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 177 | end | ||
| 178 | local one, two, ch | ||
| 179 | local _obj_0 = require("export") | ||
| 180 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 181 | end | ||
| 182 | do | ||
| 183 | local tostring <const> = tostring | ||
| 184 | local concat <const> = table.concat | ||
| 185 | print(concat({ | ||
| 186 | "a", | ||
| 187 | tostring(1) | ||
| 188 | })) | ||
| 189 | end | ||
| 190 | do | ||
| 191 | local print <const> = print | ||
| 192 | local math <const> = math | ||
| 193 | print("hello") | ||
| 194 | math.random(3) | ||
| 195 | end | ||
| 196 | do | ||
| 197 | local print <const> = print | ||
| 198 | print(FLAG) | ||
| 199 | FLAG = 123 | ||
| 200 | end | ||
| 201 | local _module_0 = { } | ||
| 202 | local a, b, c = 1, 2, 3 | ||
| 203 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 204 | local cool = "cat" | ||
| 205 | _module_0["cool"] = cool | ||
| 206 | local What | ||
| 207 | if this then | ||
| 208 | What = "abc" | ||
| 209 | else | ||
| 210 | What = "def" | ||
| 211 | end | ||
| 212 | _module_0["What"] = What | ||
| 213 | local y | ||
| 214 | y = function() | ||
| 215 | local hallo = 3434 | ||
| 216 | end | ||
| 217 | _module_0["y"] = y | ||
| 218 | local Something | ||
| 219 | local _class_0 | ||
| 220 | local _base_0 = { | ||
| 221 | umm = "cool" | ||
| 222 | } | ||
| 223 | if _base_0.__index == nil then | ||
| 224 | _base_0.__index = _base_0 | ||
| 225 | end | ||
| 226 | _class_0 = setmetatable({ | ||
| 227 | __init = function() end, | ||
| 228 | __base = _base_0, | ||
| 229 | __name = "Something" | ||
| 230 | }, { | ||
| 231 | __index = _base_0, | ||
| 232 | __call = function(cls, ...) | ||
| 233 | local _self_0 = setmetatable({ }, _base_0) | ||
| 234 | cls.__init(_self_0, ...) | ||
| 235 | return _self_0 | ||
| 236 | end | ||
| 237 | }) | ||
| 238 | _base_0.__class = _class_0 | ||
| 239 | Something = _class_0 | ||
| 240 | _module_0["Something"] = Something | ||
| 241 | return _module_0 | ||
| 242 | local _module_0 = { } | ||
| 243 | local loadstring, tolua | ||
| 244 | do | ||
| 245 | local _obj_0 = yue | ||
| 246 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 247 | end | ||
| 248 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 249 | local fieldA = tb.itemA.fieldA | ||
| 250 | if fieldA == nil then | ||
| 251 | fieldA = 'default' | ||
| 252 | end | ||
| 253 | _module_0["fieldA"] = fieldA | ||
| 254 | return _module_0 | ||
| 255 | local _module_0 = setmetatable({ }, { }) | ||
| 256 | _module_0.itemA = tb | ||
| 257 | getmetatable(_module_0).__index = items | ||
| 258 | _module_0["a-b-c"] = 123 | ||
| 259 | return _module_0 | ||
| 260 | local _module_0 = { } | ||
| 261 | local d, e, f = 3, 2, 1 | ||
| 262 | _module_0[#_module_0 + 1] = d | ||
| 263 | _module_0[#_module_0 + 1] = e | ||
| 264 | _module_0[#_module_0 + 1] = f | ||
| 265 | if this then | ||
| 266 | _module_0[#_module_0 + 1] = 123 | ||
| 267 | else | ||
| 268 | _module_0[#_module_0 + 1] = 456 | ||
| 269 | end | ||
| 270 | local _with_0 = tmp | ||
| 271 | local j = 2000 | ||
| 272 | _module_0[#_module_0 + 1] = _with_0 | ||
| 273 | return _module_0 | ||
| 274 | local _module_0 = nil | ||
| 275 | _module_0 = function() | ||
| 276 | print("hello") | ||
| 277 | return 123 | ||
| 278 | end | ||
| 279 | return _module_0 | ||
| 280 | do | ||
| 281 | local insert, concat = table.insert, table.concat | ||
| 282 | local C, Ct, Cmt | ||
| 283 | do | ||
| 284 | local _obj_0 = require("lpeg") | ||
| 285 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 286 | end | ||
| 287 | local x, y, z | ||
| 288 | do | ||
| 289 | local _obj_0 = require('mymodule') | ||
| 290 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 291 | end | ||
| 292 | local a, b, c | ||
| 293 | local _obj_0 = require('module') | ||
| 294 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 295 | end | ||
| 296 | do | ||
| 297 | local module = require('module') | ||
| 298 | local module_x = require('module_x') | ||
| 299 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 300 | local part = require("module.part") | ||
| 301 | end | ||
| 302 | do | ||
| 303 | local PlayerModule = require("player") | ||
| 304 | local C, Ct, Cmt | ||
| 305 | do | ||
| 306 | local _obj_0 = require("lpeg") | ||
| 307 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 308 | end | ||
| 309 | local one, two, ch | ||
| 310 | local _obj_0 = require("export") | ||
| 311 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 312 | end | ||
| 313 | do | ||
| 314 | local tostring <const> = tostring | ||
| 315 | local concat <const> = table.concat | ||
| 316 | print(concat({ | ||
| 317 | "a", | ||
| 318 | tostring(1) | ||
| 319 | })) | ||
| 320 | end | ||
| 321 | do | ||
| 322 | local print <const> = print | ||
| 323 | local math <const> = math | ||
| 324 | print("hello") | ||
| 325 | math.random(3) | ||
| 326 | end | ||
| 327 | do | ||
| 328 | local print <const> = print | ||
| 329 | print(FLAG) | ||
| 330 | FLAG = 123 | ||
| 331 | end | ||
| 332 | local _module_0 = { } | ||
| 333 | local a, b, c = 1, 2, 3 | ||
| 334 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 335 | local cool = "cat" | ||
| 336 | _module_0["cool"] = cool | ||
| 337 | local What | ||
| 338 | if this then | ||
| 339 | What = "abc" | ||
| 340 | else | ||
| 341 | What = "def" | ||
| 342 | end | ||
| 343 | _module_0["What"] = What | ||
| 344 | local y | ||
| 345 | y = function() | ||
| 346 | local hallo = 3434 | ||
| 347 | end | ||
| 348 | _module_0["y"] = y | ||
| 349 | local Something | ||
| 350 | local _class_0 | ||
| 351 | local _base_0 = { | ||
| 352 | umm = "cool" | ||
| 353 | } | ||
| 354 | if _base_0.__index == nil then | ||
| 355 | _base_0.__index = _base_0 | ||
| 356 | end | ||
| 357 | _class_0 = setmetatable({ | ||
| 358 | __init = function() end, | ||
| 359 | __base = _base_0, | ||
| 360 | __name = "Something" | ||
| 361 | }, { | ||
| 362 | __index = _base_0, | ||
| 363 | __call = function(cls, ...) | ||
| 364 | local _self_0 = setmetatable({ }, _base_0) | ||
| 365 | cls.__init(_self_0, ...) | ||
| 366 | return _self_0 | ||
| 367 | end | ||
| 368 | }) | ||
| 369 | _base_0.__class = _class_0 | ||
| 370 | Something = _class_0 | ||
| 371 | _module_0["Something"] = Something | ||
| 372 | return _module_0 | ||
| 373 | local _module_0 = { } | ||
| 374 | local loadstring, tolua | ||
| 375 | do | ||
| 376 | local _obj_0 = yue | ||
| 377 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 378 | end | ||
| 379 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 380 | local fieldA = tb.itemA.fieldA | ||
| 381 | if fieldA == nil then | ||
| 382 | fieldA = 'default' | ||
| 383 | end | ||
| 384 | _module_0["fieldA"] = fieldA | ||
| 385 | return _module_0 | ||
| 386 | local _module_0 = setmetatable({ }, { }) | ||
| 387 | _module_0.itemA = tb | ||
| 388 | getmetatable(_module_0).__index = items | ||
| 389 | _module_0["a-b-c"] = 123 | ||
| 390 | return _module_0 | ||
| 391 | local _module_0 = { } | ||
| 392 | local d, e, f = 3, 2, 1 | ||
| 393 | _module_0[#_module_0 + 1] = d | ||
| 394 | _module_0[#_module_0 + 1] = e | ||
| 395 | _module_0[#_module_0 + 1] = f | ||
| 396 | if this then | ||
| 397 | _module_0[#_module_0 + 1] = 123 | ||
| 398 | else | ||
| 399 | _module_0[#_module_0 + 1] = 456 | ||
| 400 | end | ||
| 401 | local _with_0 = tmp | ||
| 402 | local j = 2000 | ||
| 403 | _module_0[#_module_0 + 1] = _with_0 | ||
| 404 | return _module_0 | ||
| 405 | local _module_0 = nil | ||
| 406 | _module_0 = function() | ||
| 407 | print("hello") | ||
| 408 | return 123 | ||
| 409 | end | ||
| 410 | return _module_0 | ||
| 411 | xpcall(function() | 173 | xpcall(function() |
| 412 | return func(1, 2, 3) | 174 | return func(1, 2, 3) |
| 413 | end, function(err) | 175 | end, function(err) |
| @@ -2395,6 +2157,12 @@ local file | |||
| 2395 | local _with_0 = File("favorite_foods.txt") | 2157 | local _with_0 = File("favorite_foods.txt") |
| 2396 | _with_0:set_encoding("utf8") | 2158 | _with_0:set_encoding("utf8") |
| 2397 | file = _with_0 | 2159 | file = _with_0 |
| 2160 | local result | ||
| 2161 | local _with_0 = obj | ||
| 2162 | repeat | ||
| 2163 | result = _with_0.value | ||
| 2164 | break | ||
| 2165 | until true | ||
| 2398 | local create_person | 2166 | local create_person |
| 2399 | create_person = function(name, relatives) | 2167 | create_person = function(name, relatives) |
| 2400 | local _with_0 = Person() | 2168 | local _with_0 = Person() |
| @@ -2435,6 +2203,12 @@ local file | |||
| 2435 | local _with_0 = File("favorite_foods.txt") | 2203 | local _with_0 = File("favorite_foods.txt") |
| 2436 | _with_0:set_encoding("utf8") | 2204 | _with_0:set_encoding("utf8") |
| 2437 | file = _with_0 | 2205 | file = _with_0 |
| 2206 | local result | ||
| 2207 | local _with_0 = obj | ||
| 2208 | repeat | ||
| 2209 | result = _with_0.value | ||
| 2210 | break | ||
| 2211 | until true | ||
| 2438 | local create_person | 2212 | local create_person |
| 2439 | create_person = function(name, relatives) | 2213 | create_person = function(name, relatives) |
| 2440 | local _with_0 = Person() | 2214 | local _with_0 = Person() |
| @@ -3268,6 +3042,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3268 | break | 3042 | break |
| 3269 | end | 3043 | end |
| 3270 | end | 3044 | end |
| 3045 | local key, score | ||
| 3046 | for k, v in pairs(data) do | ||
| 3047 | if k == "target" then | ||
| 3048 | key, score = k, v * 10 | ||
| 3049 | break | ||
| 3050 | end | ||
| 3051 | end | ||
| 3271 | local func_a | 3052 | local func_a |
| 3272 | func_a = function() | 3053 | func_a = function() |
| 3273 | for i = 1, 10 do | 3054 | for i = 1, 10 do |
| @@ -3330,6 +3111,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3330 | break | 3111 | break |
| 3331 | end | 3112 | end |
| 3332 | end | 3113 | end |
| 3114 | local key, score | ||
| 3115 | for k, v in pairs(data) do | ||
| 3116 | if k == "target" then | ||
| 3117 | key, score = k, v * 10 | ||
| 3118 | break | ||
| 3119 | end | ||
| 3120 | end | ||
| 3333 | local func_a | 3121 | local func_a |
| 3334 | func_a = function() | 3122 | func_a = function() |
| 3335 | for i = 1, 10 do | 3123 | for i = 1, 10 do |
| @@ -4008,11 +3796,32 @@ end | |||
| 4008 | while not (running == false) do | 3796 | while not (running == false) do |
| 4009 | my_function() | 3797 | my_function() |
| 4010 | end | 3798 | end |
| 3799 | local value, doubled | ||
| 3800 | local _val_0, _val_1 | ||
| 3801 | while true do | ||
| 3802 | local n = get_next() | ||
| 3803 | if n > 10 then | ||
| 3804 | _val_0, _val_1 = n, n * 2 | ||
| 3805 | break | ||
| 3806 | end | ||
| 3807 | end | ||
| 3808 | value, doubled = _val_0, _val_1 | ||
| 4011 | local i = 10 | 3809 | local i = 10 |
| 4012 | repeat | 3810 | repeat |
| 4013 | print(i) | 3811 | print(i) |
| 4014 | i = i - 1 | 3812 | i = i - 1 |
| 4015 | until i == 0 | 3813 | until i == 0 |
| 3814 | local i = 1 | ||
| 3815 | local value, scaled | ||
| 3816 | local _val_0, _val_1 | ||
| 3817 | repeat | ||
| 3818 | if i > 3 then | ||
| 3819 | _val_0, _val_1 = i, i * 100 | ||
| 3820 | break | ||
| 3821 | end | ||
| 3822 | i = i + 1 | ||
| 3823 | until false | ||
| 3824 | value, scaled = _val_0, _val_1 | ||
| 4016 | local i = 10 | 3825 | local i = 10 |
| 4017 | while i > 0 do | 3826 | while i > 0 do |
| 4018 | print(i) | 3827 | print(i) |
| @@ -4029,11 +3838,32 @@ end | |||
| 4029 | while not (running == false) do | 3838 | while not (running == false) do |
| 4030 | my_function() | 3839 | my_function() |
| 4031 | end | 3840 | end |
| 3841 | local value, doubled | ||
| 3842 | local _val_0, _val_1 | ||
| 3843 | while true do | ||
| 3844 | local n = get_next() | ||
| 3845 | if n > 10 then | ||
| 3846 | _val_0, _val_1 = n, n * 2 | ||
| 3847 | break | ||
| 3848 | end | ||
| 3849 | end | ||
| 3850 | value, doubled = _val_0, _val_1 | ||
| 4032 | local i = 10 | 3851 | local i = 10 |
| 4033 | repeat | 3852 | repeat |
| 4034 | print(i) | 3853 | print(i) |
| 4035 | i = i - 1 | 3854 | i = i - 1 |
| 4036 | until i == 0 | 3855 | until i == 0 |
| 3856 | local i = 1 | ||
| 3857 | local value, scaled | ||
| 3858 | local _val_0, _val_1 | ||
| 3859 | repeat | ||
| 3860 | if i > 3 then | ||
| 3861 | _val_0, _val_1 = i, i * 100 | ||
| 3862 | break | ||
| 3863 | end | ||
| 3864 | i = i + 1 | ||
| 3865 | until false | ||
| 3866 | value, scaled = _val_0, _val_1 | ||
| 4037 | local my_object = { | 3867 | local my_object = { |
| 4038 | value = 1000, | 3868 | value = 1000, |
| 4039 | write = function(self) | 3869 | write = function(self) |
| @@ -5136,3 +4966,265 @@ fn = function() | |||
| 5136 | return str | 4966 | return str |
| 5137 | end | 4967 | end |
| 5138 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | 4968 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" |
| 4969 | do | ||
| 4970 | local insert, concat = table.insert, table.concat | ||
| 4971 | local C, Ct, Cmt | ||
| 4972 | do | ||
| 4973 | local _obj_0 = require("lpeg") | ||
| 4974 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4975 | end | ||
| 4976 | local x, y, z | ||
| 4977 | do | ||
| 4978 | local _obj_0 = require('mymodule') | ||
| 4979 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 4980 | end | ||
| 4981 | local a, b, c | ||
| 4982 | local _obj_0 = require('module') | ||
| 4983 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 4984 | end | ||
| 4985 | do | ||
| 4986 | local module = require('module') | ||
| 4987 | local module_x = require('module_x') | ||
| 4988 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 4989 | local part = require("module.part") | ||
| 4990 | end | ||
| 4991 | do | ||
| 4992 | local PlayerModule = require("player") | ||
| 4993 | local C, Ct, Cmt | ||
| 4994 | do | ||
| 4995 | local _obj_0 = require("lpeg") | ||
| 4996 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4997 | end | ||
| 4998 | local one, two, ch | ||
| 4999 | local _obj_0 = require("export") | ||
| 5000 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5001 | end | ||
| 5002 | do | ||
| 5003 | local tostring <const> = tostring | ||
| 5004 | local concat <const> = table.concat | ||
| 5005 | print(concat({ | ||
| 5006 | "a", | ||
| 5007 | tostring(1) | ||
| 5008 | })) | ||
| 5009 | end | ||
| 5010 | do | ||
| 5011 | local print <const> = print | ||
| 5012 | local math <const> = math | ||
| 5013 | print("hello") | ||
| 5014 | math.random(3) | ||
| 5015 | end | ||
| 5016 | do | ||
| 5017 | local print <const> = print | ||
| 5018 | print(FLAG) | ||
| 5019 | FLAG = 123 | ||
| 5020 | end | ||
| 5021 | local _module_0 = { } | ||
| 5022 | local a, b, c = 1, 2, 3 | ||
| 5023 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5024 | local cool = "cat" | ||
| 5025 | _module_0["cool"] = cool | ||
| 5026 | local What | ||
| 5027 | if this then | ||
| 5028 | What = "abc" | ||
| 5029 | else | ||
| 5030 | What = "def" | ||
| 5031 | end | ||
| 5032 | _module_0["What"] = What | ||
| 5033 | local y | ||
| 5034 | y = function() | ||
| 5035 | local hallo = 3434 | ||
| 5036 | end | ||
| 5037 | _module_0["y"] = y | ||
| 5038 | local Something | ||
| 5039 | local _class_0 | ||
| 5040 | local _base_0 = { | ||
| 5041 | umm = "cool" | ||
| 5042 | } | ||
| 5043 | if _base_0.__index == nil then | ||
| 5044 | _base_0.__index = _base_0 | ||
| 5045 | end | ||
| 5046 | _class_0 = setmetatable({ | ||
| 5047 | __init = function() end, | ||
| 5048 | __base = _base_0, | ||
| 5049 | __name = "Something" | ||
| 5050 | }, { | ||
| 5051 | __index = _base_0, | ||
| 5052 | __call = function(cls, ...) | ||
| 5053 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5054 | cls.__init(_self_0, ...) | ||
| 5055 | return _self_0 | ||
| 5056 | end | ||
| 5057 | }) | ||
| 5058 | _base_0.__class = _class_0 | ||
| 5059 | Something = _class_0 | ||
| 5060 | _module_0["Something"] = Something | ||
| 5061 | return _module_0 | ||
| 5062 | local _module_0 = { } | ||
| 5063 | local loadstring, tolua | ||
| 5064 | do | ||
| 5065 | local _obj_0 = yue | ||
| 5066 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5067 | end | ||
| 5068 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5069 | local fieldA = tb.itemA.fieldA | ||
| 5070 | if fieldA == nil then | ||
| 5071 | fieldA = 'default' | ||
| 5072 | end | ||
| 5073 | _module_0["fieldA"] = fieldA | ||
| 5074 | return _module_0 | ||
| 5075 | local _module_0 = setmetatable({ }, { }) | ||
| 5076 | _module_0.itemA = tb | ||
| 5077 | getmetatable(_module_0).__index = items | ||
| 5078 | _module_0["a-b-c"] = 123 | ||
| 5079 | return _module_0 | ||
| 5080 | local _module_0 = { } | ||
| 5081 | local d, e, f = 3, 2, 1 | ||
| 5082 | _module_0[#_module_0 + 1] = d | ||
| 5083 | _module_0[#_module_0 + 1] = e | ||
| 5084 | _module_0[#_module_0 + 1] = f | ||
| 5085 | if this then | ||
| 5086 | _module_0[#_module_0 + 1] = 123 | ||
| 5087 | else | ||
| 5088 | _module_0[#_module_0 + 1] = 456 | ||
| 5089 | end | ||
| 5090 | local _with_0 = tmp | ||
| 5091 | local j = 2000 | ||
| 5092 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5093 | return _module_0 | ||
| 5094 | local _module_0 = nil | ||
| 5095 | _module_0 = function() | ||
| 5096 | print("hello") | ||
| 5097 | return 123 | ||
| 5098 | end | ||
| 5099 | return _module_0 | ||
| 5100 | do | ||
| 5101 | local insert, concat = table.insert, table.concat | ||
| 5102 | local C, Ct, Cmt | ||
| 5103 | do | ||
| 5104 | local _obj_0 = require("lpeg") | ||
| 5105 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5106 | end | ||
| 5107 | local x, y, z | ||
| 5108 | do | ||
| 5109 | local _obj_0 = require('mymodule') | ||
| 5110 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 5111 | end | ||
| 5112 | local a, b, c | ||
| 5113 | local _obj_0 = require('module') | ||
| 5114 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 5115 | end | ||
| 5116 | do | ||
| 5117 | local module = require('module') | ||
| 5118 | local module_x = require('module_x') | ||
| 5119 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 5120 | local part = require("module.part") | ||
| 5121 | end | ||
| 5122 | do | ||
| 5123 | local PlayerModule = require("player") | ||
| 5124 | local C, Ct, Cmt | ||
| 5125 | do | ||
| 5126 | local _obj_0 = require("lpeg") | ||
| 5127 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5128 | end | ||
| 5129 | local one, two, ch | ||
| 5130 | local _obj_0 = require("export") | ||
| 5131 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5132 | end | ||
| 5133 | do | ||
| 5134 | local tostring <const> = tostring | ||
| 5135 | local concat <const> = table.concat | ||
| 5136 | print(concat({ | ||
| 5137 | "a", | ||
| 5138 | tostring(1) | ||
| 5139 | })) | ||
| 5140 | end | ||
| 5141 | do | ||
| 5142 | local print <const> = print | ||
| 5143 | local math <const> = math | ||
| 5144 | print("hello") | ||
| 5145 | math.random(3) | ||
| 5146 | end | ||
| 5147 | do | ||
| 5148 | local print <const> = print | ||
| 5149 | print(FLAG) | ||
| 5150 | FLAG = 123 | ||
| 5151 | end | ||
| 5152 | local _module_0 = { } | ||
| 5153 | local a, b, c = 1, 2, 3 | ||
| 5154 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5155 | local cool = "cat" | ||
| 5156 | _module_0["cool"] = cool | ||
| 5157 | local What | ||
| 5158 | if this then | ||
| 5159 | What = "abc" | ||
| 5160 | else | ||
| 5161 | What = "def" | ||
| 5162 | end | ||
| 5163 | _module_0["What"] = What | ||
| 5164 | local y | ||
| 5165 | y = function() | ||
| 5166 | local hallo = 3434 | ||
| 5167 | end | ||
| 5168 | _module_0["y"] = y | ||
| 5169 | local Something | ||
| 5170 | local _class_0 | ||
| 5171 | local _base_0 = { | ||
| 5172 | umm = "cool" | ||
| 5173 | } | ||
| 5174 | if _base_0.__index == nil then | ||
| 5175 | _base_0.__index = _base_0 | ||
| 5176 | end | ||
| 5177 | _class_0 = setmetatable({ | ||
| 5178 | __init = function() end, | ||
| 5179 | __base = _base_0, | ||
| 5180 | __name = "Something" | ||
| 5181 | }, { | ||
| 5182 | __index = _base_0, | ||
| 5183 | __call = function(cls, ...) | ||
| 5184 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5185 | cls.__init(_self_0, ...) | ||
| 5186 | return _self_0 | ||
| 5187 | end | ||
| 5188 | }) | ||
| 5189 | _base_0.__class = _class_0 | ||
| 5190 | Something = _class_0 | ||
| 5191 | _module_0["Something"] = Something | ||
| 5192 | return _module_0 | ||
| 5193 | local _module_0 = { } | ||
| 5194 | local loadstring, tolua | ||
| 5195 | do | ||
| 5196 | local _obj_0 = yue | ||
| 5197 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5198 | end | ||
| 5199 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5200 | local fieldA = tb.itemA.fieldA | ||
| 5201 | if fieldA == nil then | ||
| 5202 | fieldA = 'default' | ||
| 5203 | end | ||
| 5204 | _module_0["fieldA"] = fieldA | ||
| 5205 | return _module_0 | ||
| 5206 | local _module_0 = setmetatable({ }, { }) | ||
| 5207 | _module_0.itemA = tb | ||
| 5208 | getmetatable(_module_0).__index = items | ||
| 5209 | _module_0["a-b-c"] = 123 | ||
| 5210 | return _module_0 | ||
| 5211 | local _module_0 = { } | ||
| 5212 | local d, e, f = 3, 2, 1 | ||
| 5213 | _module_0[#_module_0 + 1] = d | ||
| 5214 | _module_0[#_module_0 + 1] = e | ||
| 5215 | _module_0[#_module_0 + 1] = f | ||
| 5216 | if this then | ||
| 5217 | _module_0[#_module_0 + 1] = 123 | ||
| 5218 | else | ||
| 5219 | _module_0[#_module_0 + 1] = 456 | ||
| 5220 | end | ||
| 5221 | local _with_0 = tmp | ||
| 5222 | local j = 2000 | ||
| 5223 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5224 | return _module_0 | ||
| 5225 | local _module_0 = nil | ||
| 5226 | _module_0 = function() | ||
| 5227 | print("hello") | ||
| 5228 | return 123 | ||
| 5229 | end | ||
| 5230 | return _module_0 | ||
diff --git a/spec/outputs/codes_from_doc_pt-br.lua b/spec/outputs/codes_from_doc_pt-br.lua index f5643c8..caa15d6 100644 --- a/spec/outputs/codes_from_doc_pt-br.lua +++ b/spec/outputs/codes_from_doc_pt-br.lua | |||
| @@ -3,6 +3,18 @@ do | |||
| 3 | print(var) | 3 | print(var) |
| 4 | end | 4 | end |
| 5 | print(var) | 5 | print(var) |
| 6 | local status, value | ||
| 7 | do | ||
| 8 | repeat | ||
| 9 | local n = 12 | ||
| 10 | if n > 10 then | ||
| 11 | status, value = "large", n | ||
| 12 | break | ||
| 13 | end | ||
| 14 | status, value = "small", n | ||
| 15 | break | ||
| 16 | until true | ||
| 17 | end | ||
| 6 | local counter | 18 | local counter |
| 7 | do | 19 | do |
| 8 | local i = 0 | 20 | local i = 0 |
| @@ -24,6 +36,18 @@ do | |||
| 24 | print(var) | 36 | print(var) |
| 25 | end | 37 | end |
| 26 | print(var) | 38 | print(var) |
| 39 | local status, value | ||
| 40 | do | ||
| 41 | repeat | ||
| 42 | local n = 12 | ||
| 43 | if n > 10 then | ||
| 44 | status, value = "large", n | ||
| 45 | break | ||
| 46 | end | ||
| 47 | status, value = "small", n | ||
| 48 | break | ||
| 49 | until true | ||
| 50 | end | ||
| 27 | local counter | 51 | local counter |
| 28 | do | 52 | do |
| 29 | local i = 0 | 53 | local i = 0 |
| @@ -146,268 +170,6 @@ end | |||
| 146 | do | 170 | do |
| 147 | print(123, "hello") | 171 | print(123, "hello") |
| 148 | end | 172 | end |
| 149 | do | ||
| 150 | local insert, concat = table.insert, table.concat | ||
| 151 | local C, Ct, Cmt | ||
| 152 | do | ||
| 153 | local _obj_0 = require("lpeg") | ||
| 154 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 155 | end | ||
| 156 | local x, y, z | ||
| 157 | do | ||
| 158 | local _obj_0 = require('mymodule') | ||
| 159 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 160 | end | ||
| 161 | local a, b, c | ||
| 162 | local _obj_0 = require('module') | ||
| 163 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 164 | end | ||
| 165 | do | ||
| 166 | local module = require('module') | ||
| 167 | local module_x = require('module_x') | ||
| 168 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 169 | local part = require("module.part") | ||
| 170 | end | ||
| 171 | do | ||
| 172 | local PlayerModule = require("player") | ||
| 173 | local C, Ct, Cmt | ||
| 174 | do | ||
| 175 | local _obj_0 = require("lpeg") | ||
| 176 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 177 | end | ||
| 178 | local one, two, ch | ||
| 179 | local _obj_0 = require("export") | ||
| 180 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 181 | end | ||
| 182 | do | ||
| 183 | local tostring <const> = tostring | ||
| 184 | local concat <const> = table.concat | ||
| 185 | print(concat({ | ||
| 186 | "a", | ||
| 187 | tostring(1) | ||
| 188 | })) | ||
| 189 | end | ||
| 190 | do | ||
| 191 | local print <const> = print | ||
| 192 | local math <const> = math | ||
| 193 | print("hello") | ||
| 194 | math.random(3) | ||
| 195 | end | ||
| 196 | do | ||
| 197 | local print <const> = print | ||
| 198 | print(FLAG) | ||
| 199 | FLAG = 123 | ||
| 200 | end | ||
| 201 | local _module_0 = { } | ||
| 202 | local a, b, c = 1, 2, 3 | ||
| 203 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 204 | local cool = "cat" | ||
| 205 | _module_0["cool"] = cool | ||
| 206 | local What | ||
| 207 | if this then | ||
| 208 | What = "abc" | ||
| 209 | else | ||
| 210 | What = "def" | ||
| 211 | end | ||
| 212 | _module_0["What"] = What | ||
| 213 | local y | ||
| 214 | y = function() | ||
| 215 | local hallo = 3434 | ||
| 216 | end | ||
| 217 | _module_0["y"] = y | ||
| 218 | local Something | ||
| 219 | local _class_0 | ||
| 220 | local _base_0 = { | ||
| 221 | umm = "cool" | ||
| 222 | } | ||
| 223 | if _base_0.__index == nil then | ||
| 224 | _base_0.__index = _base_0 | ||
| 225 | end | ||
| 226 | _class_0 = setmetatable({ | ||
| 227 | __init = function() end, | ||
| 228 | __base = _base_0, | ||
| 229 | __name = "Something" | ||
| 230 | }, { | ||
| 231 | __index = _base_0, | ||
| 232 | __call = function(cls, ...) | ||
| 233 | local _self_0 = setmetatable({ }, _base_0) | ||
| 234 | cls.__init(_self_0, ...) | ||
| 235 | return _self_0 | ||
| 236 | end | ||
| 237 | }) | ||
| 238 | _base_0.__class = _class_0 | ||
| 239 | Something = _class_0 | ||
| 240 | _module_0["Something"] = Something | ||
| 241 | return _module_0 | ||
| 242 | local _module_0 = { } | ||
| 243 | local loadstring, tolua | ||
| 244 | do | ||
| 245 | local _obj_0 = yue | ||
| 246 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 247 | end | ||
| 248 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 249 | local fieldA = tb.itemA.fieldA | ||
| 250 | if fieldA == nil then | ||
| 251 | fieldA = 'default' | ||
| 252 | end | ||
| 253 | _module_0["fieldA"] = fieldA | ||
| 254 | return _module_0 | ||
| 255 | local _module_0 = setmetatable({ }, { }) | ||
| 256 | _module_0.itemA = tb | ||
| 257 | getmetatable(_module_0).__index = items | ||
| 258 | _module_0["a-b-c"] = 123 | ||
| 259 | return _module_0 | ||
| 260 | local _module_0 = { } | ||
| 261 | local d, e, f = 3, 2, 1 | ||
| 262 | _module_0[#_module_0 + 1] = d | ||
| 263 | _module_0[#_module_0 + 1] = e | ||
| 264 | _module_0[#_module_0 + 1] = f | ||
| 265 | if this then | ||
| 266 | _module_0[#_module_0 + 1] = 123 | ||
| 267 | else | ||
| 268 | _module_0[#_module_0 + 1] = 456 | ||
| 269 | end | ||
| 270 | local _with_0 = tmp | ||
| 271 | local j = 2000 | ||
| 272 | _module_0[#_module_0 + 1] = _with_0 | ||
| 273 | return _module_0 | ||
| 274 | local _module_0 = nil | ||
| 275 | _module_0 = function() | ||
| 276 | print("hello") | ||
| 277 | return 123 | ||
| 278 | end | ||
| 279 | return _module_0 | ||
| 280 | do | ||
| 281 | local insert, concat = table.insert, table.concat | ||
| 282 | local C, Ct, Cmt | ||
| 283 | do | ||
| 284 | local _obj_0 = require("lpeg") | ||
| 285 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 286 | end | ||
| 287 | local x, y, z | ||
| 288 | do | ||
| 289 | local _obj_0 = require('mymodule') | ||
| 290 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 291 | end | ||
| 292 | local a, b, c | ||
| 293 | local _obj_0 = require('module') | ||
| 294 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 295 | end | ||
| 296 | do | ||
| 297 | local module = require('module') | ||
| 298 | local module_x = require('module_x') | ||
| 299 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 300 | local part = require("module.part") | ||
| 301 | end | ||
| 302 | do | ||
| 303 | local PlayerModule = require("player") | ||
| 304 | local C, Ct, Cmt | ||
| 305 | do | ||
| 306 | local _obj_0 = require("lpeg") | ||
| 307 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 308 | end | ||
| 309 | local one, two, ch | ||
| 310 | local _obj_0 = require("export") | ||
| 311 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 312 | end | ||
| 313 | do | ||
| 314 | local tostring <const> = tostring | ||
| 315 | local concat <const> = table.concat | ||
| 316 | print(concat({ | ||
| 317 | "a", | ||
| 318 | tostring(1) | ||
| 319 | })) | ||
| 320 | end | ||
| 321 | do | ||
| 322 | local print <const> = print | ||
| 323 | local math <const> = math | ||
| 324 | print("hello") | ||
| 325 | math.random(3) | ||
| 326 | end | ||
| 327 | do | ||
| 328 | local print <const> = print | ||
| 329 | print(FLAG) | ||
| 330 | FLAG = 123 | ||
| 331 | end | ||
| 332 | local _module_0 = { } | ||
| 333 | local a, b, c = 1, 2, 3 | ||
| 334 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 335 | local cool = "cat" | ||
| 336 | _module_0["cool"] = cool | ||
| 337 | local What | ||
| 338 | if this then | ||
| 339 | What = "abc" | ||
| 340 | else | ||
| 341 | What = "def" | ||
| 342 | end | ||
| 343 | _module_0["What"] = What | ||
| 344 | local y | ||
| 345 | y = function() | ||
| 346 | local hallo = 3434 | ||
| 347 | end | ||
| 348 | _module_0["y"] = y | ||
| 349 | local Something | ||
| 350 | local _class_0 | ||
| 351 | local _base_0 = { | ||
| 352 | umm = "cool" | ||
| 353 | } | ||
| 354 | if _base_0.__index == nil then | ||
| 355 | _base_0.__index = _base_0 | ||
| 356 | end | ||
| 357 | _class_0 = setmetatable({ | ||
| 358 | __init = function() end, | ||
| 359 | __base = _base_0, | ||
| 360 | __name = "Something" | ||
| 361 | }, { | ||
| 362 | __index = _base_0, | ||
| 363 | __call = function(cls, ...) | ||
| 364 | local _self_0 = setmetatable({ }, _base_0) | ||
| 365 | cls.__init(_self_0, ...) | ||
| 366 | return _self_0 | ||
| 367 | end | ||
| 368 | }) | ||
| 369 | _base_0.__class = _class_0 | ||
| 370 | Something = _class_0 | ||
| 371 | _module_0["Something"] = Something | ||
| 372 | return _module_0 | ||
| 373 | local _module_0 = { } | ||
| 374 | local loadstring, tolua | ||
| 375 | do | ||
| 376 | local _obj_0 = yue | ||
| 377 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 378 | end | ||
| 379 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 380 | local fieldA = tb.itemA.fieldA | ||
| 381 | if fieldA == nil then | ||
| 382 | fieldA = 'default' | ||
| 383 | end | ||
| 384 | _module_0["fieldA"] = fieldA | ||
| 385 | return _module_0 | ||
| 386 | local _module_0 = setmetatable({ }, { }) | ||
| 387 | _module_0.itemA = tb | ||
| 388 | getmetatable(_module_0).__index = items | ||
| 389 | _module_0["a-b-c"] = 123 | ||
| 390 | return _module_0 | ||
| 391 | local _module_0 = { } | ||
| 392 | local d, e, f = 3, 2, 1 | ||
| 393 | _module_0[#_module_0 + 1] = d | ||
| 394 | _module_0[#_module_0 + 1] = e | ||
| 395 | _module_0[#_module_0 + 1] = f | ||
| 396 | if this then | ||
| 397 | _module_0[#_module_0 + 1] = 123 | ||
| 398 | else | ||
| 399 | _module_0[#_module_0 + 1] = 456 | ||
| 400 | end | ||
| 401 | local _with_0 = tmp | ||
| 402 | local j = 2000 | ||
| 403 | _module_0[#_module_0 + 1] = _with_0 | ||
| 404 | return _module_0 | ||
| 405 | local _module_0 = nil | ||
| 406 | _module_0 = function() | ||
| 407 | print("hello") | ||
| 408 | return 123 | ||
| 409 | end | ||
| 410 | return _module_0 | ||
| 411 | xpcall(function() | 173 | xpcall(function() |
| 412 | return func(1, 2, 3) | 174 | return func(1, 2, 3) |
| 413 | end, function(err) | 175 | end, function(err) |
| @@ -2395,6 +2157,12 @@ local file | |||
| 2395 | local _with_0 = File("favorite_foods.txt") | 2157 | local _with_0 = File("favorite_foods.txt") |
| 2396 | _with_0:set_encoding("utf8") | 2158 | _with_0:set_encoding("utf8") |
| 2397 | file = _with_0 | 2159 | file = _with_0 |
| 2160 | local result | ||
| 2161 | local _with_0 = obj | ||
| 2162 | repeat | ||
| 2163 | result = _with_0.value | ||
| 2164 | break | ||
| 2165 | until true | ||
| 2398 | local create_person | 2166 | local create_person |
| 2399 | create_person = function(name, relatives) | 2167 | create_person = function(name, relatives) |
| 2400 | local _with_0 = Person() | 2168 | local _with_0 = Person() |
| @@ -2435,6 +2203,12 @@ local file | |||
| 2435 | local _with_0 = File("favorite_foods.txt") | 2203 | local _with_0 = File("favorite_foods.txt") |
| 2436 | _with_0:set_encoding("utf8") | 2204 | _with_0:set_encoding("utf8") |
| 2437 | file = _with_0 | 2205 | file = _with_0 |
| 2206 | local result | ||
| 2207 | local _with_0 = obj | ||
| 2208 | repeat | ||
| 2209 | result = _with_0.value | ||
| 2210 | break | ||
| 2211 | until true | ||
| 2438 | local create_person | 2212 | local create_person |
| 2439 | create_person = function(name, relatives) | 2213 | create_person = function(name, relatives) |
| 2440 | local _with_0 = Person() | 2214 | local _with_0 = Person() |
| @@ -3268,6 +3042,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3268 | break | 3042 | break |
| 3269 | end | 3043 | end |
| 3270 | end | 3044 | end |
| 3045 | local key, score | ||
| 3046 | for k, v in pairs(data) do | ||
| 3047 | if k == "target" then | ||
| 3048 | key, score = k, v * 10 | ||
| 3049 | break | ||
| 3050 | end | ||
| 3051 | end | ||
| 3271 | local func_a | 3052 | local func_a |
| 3272 | func_a = function() | 3053 | func_a = function() |
| 3273 | for i = 1, 10 do | 3054 | for i = 1, 10 do |
| @@ -3330,6 +3111,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3330 | break | 3111 | break |
| 3331 | end | 3112 | end |
| 3332 | end | 3113 | end |
| 3114 | local key, score | ||
| 3115 | for k, v in pairs(data) do | ||
| 3116 | if k == "target" then | ||
| 3117 | key, score = k, v * 10 | ||
| 3118 | break | ||
| 3119 | end | ||
| 3120 | end | ||
| 3333 | local func_a | 3121 | local func_a |
| 3334 | func_a = function() | 3122 | func_a = function() |
| 3335 | for i = 1, 10 do | 3123 | for i = 1, 10 do |
| @@ -4008,11 +3796,32 @@ end | |||
| 4008 | while not (running == false) do | 3796 | while not (running == false) do |
| 4009 | my_function() | 3797 | my_function() |
| 4010 | end | 3798 | end |
| 3799 | local value, doubled | ||
| 3800 | local _val_0, _val_1 | ||
| 3801 | while true do | ||
| 3802 | local n = get_next() | ||
| 3803 | if n > 10 then | ||
| 3804 | _val_0, _val_1 = n, n * 2 | ||
| 3805 | break | ||
| 3806 | end | ||
| 3807 | end | ||
| 3808 | value, doubled = _val_0, _val_1 | ||
| 4011 | local i = 10 | 3809 | local i = 10 |
| 4012 | repeat | 3810 | repeat |
| 4013 | print(i) | 3811 | print(i) |
| 4014 | i = i - 1 | 3812 | i = i - 1 |
| 4015 | until i == 0 | 3813 | until i == 0 |
| 3814 | local i = 1 | ||
| 3815 | local value, scaled | ||
| 3816 | local _val_0, _val_1 | ||
| 3817 | repeat | ||
| 3818 | if i > 3 then | ||
| 3819 | _val_0, _val_1 = i, i * 100 | ||
| 3820 | break | ||
| 3821 | end | ||
| 3822 | i = i + 1 | ||
| 3823 | until false | ||
| 3824 | value, scaled = _val_0, _val_1 | ||
| 4016 | local i = 10 | 3825 | local i = 10 |
| 4017 | while i > 0 do | 3826 | while i > 0 do |
| 4018 | print(i) | 3827 | print(i) |
| @@ -4029,11 +3838,32 @@ end | |||
| 4029 | while not (running == false) do | 3838 | while not (running == false) do |
| 4030 | my_function() | 3839 | my_function() |
| 4031 | end | 3840 | end |
| 3841 | local value, doubled | ||
| 3842 | local _val_0, _val_1 | ||
| 3843 | while true do | ||
| 3844 | local n = get_next() | ||
| 3845 | if n > 10 then | ||
| 3846 | _val_0, _val_1 = n, n * 2 | ||
| 3847 | break | ||
| 3848 | end | ||
| 3849 | end | ||
| 3850 | value, doubled = _val_0, _val_1 | ||
| 4032 | local i = 10 | 3851 | local i = 10 |
| 4033 | repeat | 3852 | repeat |
| 4034 | print(i) | 3853 | print(i) |
| 4035 | i = i - 1 | 3854 | i = i - 1 |
| 4036 | until i == 0 | 3855 | until i == 0 |
| 3856 | local i = 1 | ||
| 3857 | local value, scaled | ||
| 3858 | local _val_0, _val_1 | ||
| 3859 | repeat | ||
| 3860 | if i > 3 then | ||
| 3861 | _val_0, _val_1 = i, i * 100 | ||
| 3862 | break | ||
| 3863 | end | ||
| 3864 | i = i + 1 | ||
| 3865 | until false | ||
| 3866 | value, scaled = _val_0, _val_1 | ||
| 4037 | local my_object = { | 3867 | local my_object = { |
| 4038 | value = 1000, | 3868 | value = 1000, |
| 4039 | write = function(self) | 3869 | write = function(self) |
| @@ -5136,3 +4966,265 @@ fn = function() | |||
| 5136 | return str | 4966 | return str |
| 5137 | end | 4967 | end |
| 5138 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'Ele disse: \"" .. tostring(Hello) .. "!\"'" | 4968 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'Ele disse: \"" .. tostring(Hello) .. "!\"'" |
| 4969 | do | ||
| 4970 | local insert, concat = table.insert, table.concat | ||
| 4971 | local C, Ct, Cmt | ||
| 4972 | do | ||
| 4973 | local _obj_0 = require("lpeg") | ||
| 4974 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4975 | end | ||
| 4976 | local x, y, z | ||
| 4977 | do | ||
| 4978 | local _obj_0 = require('mymodule') | ||
| 4979 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 4980 | end | ||
| 4981 | local a, b, c | ||
| 4982 | local _obj_0 = require('module') | ||
| 4983 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 4984 | end | ||
| 4985 | do | ||
| 4986 | local module = require('module') | ||
| 4987 | local module_x = require('module_x') | ||
| 4988 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 4989 | local part = require("module.part") | ||
| 4990 | end | ||
| 4991 | do | ||
| 4992 | local PlayerModule = require("player") | ||
| 4993 | local C, Ct, Cmt | ||
| 4994 | do | ||
| 4995 | local _obj_0 = require("lpeg") | ||
| 4996 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4997 | end | ||
| 4998 | local one, two, ch | ||
| 4999 | local _obj_0 = require("export") | ||
| 5000 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5001 | end | ||
| 5002 | do | ||
| 5003 | local tostring <const> = tostring | ||
| 5004 | local concat <const> = table.concat | ||
| 5005 | print(concat({ | ||
| 5006 | "a", | ||
| 5007 | tostring(1) | ||
| 5008 | })) | ||
| 5009 | end | ||
| 5010 | do | ||
| 5011 | local print <const> = print | ||
| 5012 | local math <const> = math | ||
| 5013 | print("hello") | ||
| 5014 | math.random(3) | ||
| 5015 | end | ||
| 5016 | do | ||
| 5017 | local print <const> = print | ||
| 5018 | print(FLAG) | ||
| 5019 | FLAG = 123 | ||
| 5020 | end | ||
| 5021 | local _module_0 = { } | ||
| 5022 | local a, b, c = 1, 2, 3 | ||
| 5023 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5024 | local cool = "cat" | ||
| 5025 | _module_0["cool"] = cool | ||
| 5026 | local What | ||
| 5027 | if this then | ||
| 5028 | What = "abc" | ||
| 5029 | else | ||
| 5030 | What = "def" | ||
| 5031 | end | ||
| 5032 | _module_0["What"] = What | ||
| 5033 | local y | ||
| 5034 | y = function() | ||
| 5035 | local hallo = 3434 | ||
| 5036 | end | ||
| 5037 | _module_0["y"] = y | ||
| 5038 | local Something | ||
| 5039 | local _class_0 | ||
| 5040 | local _base_0 = { | ||
| 5041 | umm = "cool" | ||
| 5042 | } | ||
| 5043 | if _base_0.__index == nil then | ||
| 5044 | _base_0.__index = _base_0 | ||
| 5045 | end | ||
| 5046 | _class_0 = setmetatable({ | ||
| 5047 | __init = function() end, | ||
| 5048 | __base = _base_0, | ||
| 5049 | __name = "Something" | ||
| 5050 | }, { | ||
| 5051 | __index = _base_0, | ||
| 5052 | __call = function(cls, ...) | ||
| 5053 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5054 | cls.__init(_self_0, ...) | ||
| 5055 | return _self_0 | ||
| 5056 | end | ||
| 5057 | }) | ||
| 5058 | _base_0.__class = _class_0 | ||
| 5059 | Something = _class_0 | ||
| 5060 | _module_0["Something"] = Something | ||
| 5061 | return _module_0 | ||
| 5062 | local _module_0 = { } | ||
| 5063 | local loadstring, tolua | ||
| 5064 | do | ||
| 5065 | local _obj_0 = yue | ||
| 5066 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5067 | end | ||
| 5068 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5069 | local fieldA = tb.itemA.fieldA | ||
| 5070 | if fieldA == nil then | ||
| 5071 | fieldA = 'default' | ||
| 5072 | end | ||
| 5073 | _module_0["fieldA"] = fieldA | ||
| 5074 | return _module_0 | ||
| 5075 | local _module_0 = setmetatable({ }, { }) | ||
| 5076 | _module_0.itemA = tb | ||
| 5077 | getmetatable(_module_0).__index = items | ||
| 5078 | _module_0["a-b-c"] = 123 | ||
| 5079 | return _module_0 | ||
| 5080 | local _module_0 = { } | ||
| 5081 | local d, e, f = 3, 2, 1 | ||
| 5082 | _module_0[#_module_0 + 1] = d | ||
| 5083 | _module_0[#_module_0 + 1] = e | ||
| 5084 | _module_0[#_module_0 + 1] = f | ||
| 5085 | if this then | ||
| 5086 | _module_0[#_module_0 + 1] = 123 | ||
| 5087 | else | ||
| 5088 | _module_0[#_module_0 + 1] = 456 | ||
| 5089 | end | ||
| 5090 | local _with_0 = tmp | ||
| 5091 | local j = 2000 | ||
| 5092 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5093 | return _module_0 | ||
| 5094 | local _module_0 = nil | ||
| 5095 | _module_0 = function() | ||
| 5096 | print("hello") | ||
| 5097 | return 123 | ||
| 5098 | end | ||
| 5099 | return _module_0 | ||
| 5100 | do | ||
| 5101 | local insert, concat = table.insert, table.concat | ||
| 5102 | local C, Ct, Cmt | ||
| 5103 | do | ||
| 5104 | local _obj_0 = require("lpeg") | ||
| 5105 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5106 | end | ||
| 5107 | local x, y, z | ||
| 5108 | do | ||
| 5109 | local _obj_0 = require('mymodule') | ||
| 5110 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 5111 | end | ||
| 5112 | local a, b, c | ||
| 5113 | local _obj_0 = require('module') | ||
| 5114 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 5115 | end | ||
| 5116 | do | ||
| 5117 | local module = require('module') | ||
| 5118 | local module_x = require('module_x') | ||
| 5119 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 5120 | local part = require("module.part") | ||
| 5121 | end | ||
| 5122 | do | ||
| 5123 | local PlayerModule = require("player") | ||
| 5124 | local C, Ct, Cmt | ||
| 5125 | do | ||
| 5126 | local _obj_0 = require("lpeg") | ||
| 5127 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5128 | end | ||
| 5129 | local one, two, ch | ||
| 5130 | local _obj_0 = require("export") | ||
| 5131 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5132 | end | ||
| 5133 | do | ||
| 5134 | local tostring <const> = tostring | ||
| 5135 | local concat <const> = table.concat | ||
| 5136 | print(concat({ | ||
| 5137 | "a", | ||
| 5138 | tostring(1) | ||
| 5139 | })) | ||
| 5140 | end | ||
| 5141 | do | ||
| 5142 | local print <const> = print | ||
| 5143 | local math <const> = math | ||
| 5144 | print("hello") | ||
| 5145 | math.random(3) | ||
| 5146 | end | ||
| 5147 | do | ||
| 5148 | local print <const> = print | ||
| 5149 | print(FLAG) | ||
| 5150 | FLAG = 123 | ||
| 5151 | end | ||
| 5152 | local _module_0 = { } | ||
| 5153 | local a, b, c = 1, 2, 3 | ||
| 5154 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5155 | local cool = "cat" | ||
| 5156 | _module_0["cool"] = cool | ||
| 5157 | local What | ||
| 5158 | if this then | ||
| 5159 | What = "abc" | ||
| 5160 | else | ||
| 5161 | What = "def" | ||
| 5162 | end | ||
| 5163 | _module_0["What"] = What | ||
| 5164 | local y | ||
| 5165 | y = function() | ||
| 5166 | local hallo = 3434 | ||
| 5167 | end | ||
| 5168 | _module_0["y"] = y | ||
| 5169 | local Something | ||
| 5170 | local _class_0 | ||
| 5171 | local _base_0 = { | ||
| 5172 | umm = "cool" | ||
| 5173 | } | ||
| 5174 | if _base_0.__index == nil then | ||
| 5175 | _base_0.__index = _base_0 | ||
| 5176 | end | ||
| 5177 | _class_0 = setmetatable({ | ||
| 5178 | __init = function() end, | ||
| 5179 | __base = _base_0, | ||
| 5180 | __name = "Something" | ||
| 5181 | }, { | ||
| 5182 | __index = _base_0, | ||
| 5183 | __call = function(cls, ...) | ||
| 5184 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5185 | cls.__init(_self_0, ...) | ||
| 5186 | return _self_0 | ||
| 5187 | end | ||
| 5188 | }) | ||
| 5189 | _base_0.__class = _class_0 | ||
| 5190 | Something = _class_0 | ||
| 5191 | _module_0["Something"] = Something | ||
| 5192 | return _module_0 | ||
| 5193 | local _module_0 = { } | ||
| 5194 | local loadstring, tolua | ||
| 5195 | do | ||
| 5196 | local _obj_0 = yue | ||
| 5197 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5198 | end | ||
| 5199 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5200 | local fieldA = tb.itemA.fieldA | ||
| 5201 | if fieldA == nil then | ||
| 5202 | fieldA = 'default' | ||
| 5203 | end | ||
| 5204 | _module_0["fieldA"] = fieldA | ||
| 5205 | return _module_0 | ||
| 5206 | local _module_0 = setmetatable({ }, { }) | ||
| 5207 | _module_0.itemA = tb | ||
| 5208 | getmetatable(_module_0).__index = items | ||
| 5209 | _module_0["a-b-c"] = 123 | ||
| 5210 | return _module_0 | ||
| 5211 | local _module_0 = { } | ||
| 5212 | local d, e, f = 3, 2, 1 | ||
| 5213 | _module_0[#_module_0 + 1] = d | ||
| 5214 | _module_0[#_module_0 + 1] = e | ||
| 5215 | _module_0[#_module_0 + 1] = f | ||
| 5216 | if this then | ||
| 5217 | _module_0[#_module_0 + 1] = 123 | ||
| 5218 | else | ||
| 5219 | _module_0[#_module_0 + 1] = 456 | ||
| 5220 | end | ||
| 5221 | local _with_0 = tmp | ||
| 5222 | local j = 2000 | ||
| 5223 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5224 | return _module_0 | ||
| 5225 | local _module_0 = nil | ||
| 5226 | _module_0 = function() | ||
| 5227 | print("hello") | ||
| 5228 | return 123 | ||
| 5229 | end | ||
| 5230 | return _module_0 | ||
diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index 087782e..4ff3866 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua | |||
| @@ -3,6 +3,18 @@ do | |||
| 3 | print(var) | 3 | print(var) |
| 4 | end | 4 | end |
| 5 | print(var) | 5 | print(var) |
| 6 | local status, value | ||
| 7 | do | ||
| 8 | repeat | ||
| 9 | local n = 12 | ||
| 10 | if n > 10 then | ||
| 11 | status, value = "large", n | ||
| 12 | break | ||
| 13 | end | ||
| 14 | status, value = "small", n | ||
| 15 | break | ||
| 16 | until true | ||
| 17 | end | ||
| 6 | local counter | 18 | local counter |
| 7 | do | 19 | do |
| 8 | local i = 0 | 20 | local i = 0 |
| @@ -24,6 +36,18 @@ do | |||
| 24 | print(var) | 36 | print(var) |
| 25 | end | 37 | end |
| 26 | print(var) | 38 | print(var) |
| 39 | local status, value | ||
| 40 | do | ||
| 41 | repeat | ||
| 42 | local n = 12 | ||
| 43 | if n > 10 then | ||
| 44 | status, value = "large", n | ||
| 45 | break | ||
| 46 | end | ||
| 47 | status, value = "small", n | ||
| 48 | break | ||
| 49 | until true | ||
| 50 | end | ||
| 27 | local counter | 51 | local counter |
| 28 | do | 52 | do |
| 29 | local i = 0 | 53 | local i = 0 |
| @@ -146,268 +170,6 @@ end | |||
| 146 | do | 170 | do |
| 147 | print(123, "hello") | 171 | print(123, "hello") |
| 148 | end | 172 | end |
| 149 | do | ||
| 150 | local insert, concat = table.insert, table.concat | ||
| 151 | local C, Ct, Cmt | ||
| 152 | do | ||
| 153 | local _obj_0 = require("lpeg") | ||
| 154 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 155 | end | ||
| 156 | local x, y, z | ||
| 157 | do | ||
| 158 | local _obj_0 = require('mymodule') | ||
| 159 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 160 | end | ||
| 161 | local a, b, c | ||
| 162 | local _obj_0 = require('module') | ||
| 163 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 164 | end | ||
| 165 | do | ||
| 166 | local module = require('module') | ||
| 167 | local module_x = require('module_x') | ||
| 168 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 169 | local part = require("module.part") | ||
| 170 | end | ||
| 171 | do | ||
| 172 | local PlayerModule = require("player") | ||
| 173 | local C, Ct, Cmt | ||
| 174 | do | ||
| 175 | local _obj_0 = require("lpeg") | ||
| 176 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 177 | end | ||
| 178 | local one, two, ch | ||
| 179 | local _obj_0 = require("export") | ||
| 180 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 181 | end | ||
| 182 | do | ||
| 183 | local tostring <const> = tostring | ||
| 184 | local concat <const> = table.concat | ||
| 185 | print(concat({ | ||
| 186 | "a", | ||
| 187 | tostring(1) | ||
| 188 | })) | ||
| 189 | end | ||
| 190 | do | ||
| 191 | local print <const> = print | ||
| 192 | local math <const> = math | ||
| 193 | print("hello") | ||
| 194 | math.random(3) | ||
| 195 | end | ||
| 196 | do | ||
| 197 | local print <const> = print | ||
| 198 | print(FLAG) | ||
| 199 | FLAG = 123 | ||
| 200 | end | ||
| 201 | local _module_0 = { } | ||
| 202 | local a, b, c = 1, 2, 3 | ||
| 203 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 204 | local cool = "cat" | ||
| 205 | _module_0["cool"] = cool | ||
| 206 | local What | ||
| 207 | if this then | ||
| 208 | What = "abc" | ||
| 209 | else | ||
| 210 | What = "def" | ||
| 211 | end | ||
| 212 | _module_0["What"] = What | ||
| 213 | local y | ||
| 214 | y = function() | ||
| 215 | local hallo = 3434 | ||
| 216 | end | ||
| 217 | _module_0["y"] = y | ||
| 218 | local Something | ||
| 219 | local _class_0 | ||
| 220 | local _base_0 = { | ||
| 221 | umm = "cool" | ||
| 222 | } | ||
| 223 | if _base_0.__index == nil then | ||
| 224 | _base_0.__index = _base_0 | ||
| 225 | end | ||
| 226 | _class_0 = setmetatable({ | ||
| 227 | __init = function() end, | ||
| 228 | __base = _base_0, | ||
| 229 | __name = "Something" | ||
| 230 | }, { | ||
| 231 | __index = _base_0, | ||
| 232 | __call = function(cls, ...) | ||
| 233 | local _self_0 = setmetatable({ }, _base_0) | ||
| 234 | cls.__init(_self_0, ...) | ||
| 235 | return _self_0 | ||
| 236 | end | ||
| 237 | }) | ||
| 238 | _base_0.__class = _class_0 | ||
| 239 | Something = _class_0 | ||
| 240 | _module_0["Something"] = Something | ||
| 241 | return _module_0 | ||
| 242 | local _module_0 = { } | ||
| 243 | local loadstring, tolua | ||
| 244 | do | ||
| 245 | local _obj_0 = yue | ||
| 246 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 247 | end | ||
| 248 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 249 | local fieldA = tb.itemA.fieldA | ||
| 250 | if fieldA == nil then | ||
| 251 | fieldA = '默认值' | ||
| 252 | end | ||
| 253 | _module_0["fieldA"] = fieldA | ||
| 254 | return _module_0 | ||
| 255 | local _module_0 = setmetatable({ }, { }) | ||
| 256 | _module_0.itemA = tb | ||
| 257 | getmetatable(_module_0).__index = items | ||
| 258 | _module_0["a-b-c"] = 123 | ||
| 259 | return _module_0 | ||
| 260 | local _module_0 = { } | ||
| 261 | local d, e, f = 3, 2, 1 | ||
| 262 | _module_0[#_module_0 + 1] = d | ||
| 263 | _module_0[#_module_0 + 1] = e | ||
| 264 | _module_0[#_module_0 + 1] = f | ||
| 265 | if this then | ||
| 266 | _module_0[#_module_0 + 1] = 123 | ||
| 267 | else | ||
| 268 | _module_0[#_module_0 + 1] = 456 | ||
| 269 | end | ||
| 270 | local _with_0 = tmp | ||
| 271 | local j = 2000 | ||
| 272 | _module_0[#_module_0 + 1] = _with_0 | ||
| 273 | return _module_0 | ||
| 274 | local _module_0 = nil | ||
| 275 | _module_0 = function() | ||
| 276 | print("你好") | ||
| 277 | return 123 | ||
| 278 | end | ||
| 279 | return _module_0 | ||
| 280 | do | ||
| 281 | local insert, concat = table.insert, table.concat | ||
| 282 | local C, Ct, Cmt | ||
| 283 | do | ||
| 284 | local _obj_0 = require("lpeg") | ||
| 285 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 286 | end | ||
| 287 | local x, y, z | ||
| 288 | do | ||
| 289 | local _obj_0 = require('mymodule') | ||
| 290 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 291 | end | ||
| 292 | local a, b, c | ||
| 293 | local _obj_0 = require('module') | ||
| 294 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 295 | end | ||
| 296 | do | ||
| 297 | local module = require('module') | ||
| 298 | local module_x = require('module_x') | ||
| 299 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 300 | local part = require("module.part") | ||
| 301 | end | ||
| 302 | do | ||
| 303 | local PlayerModule = require("player") | ||
| 304 | local C, Ct, Cmt | ||
| 305 | do | ||
| 306 | local _obj_0 = require("lpeg") | ||
| 307 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 308 | end | ||
| 309 | local one, two, ch | ||
| 310 | local _obj_0 = require("export") | ||
| 311 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 312 | end | ||
| 313 | do | ||
| 314 | local tostring <const> = tostring | ||
| 315 | local concat <const> = table.concat | ||
| 316 | print(concat({ | ||
| 317 | "a", | ||
| 318 | tostring(1) | ||
| 319 | })) | ||
| 320 | end | ||
| 321 | do | ||
| 322 | local print <const> = print | ||
| 323 | local math <const> = math | ||
| 324 | print("hello") | ||
| 325 | math.random(3) | ||
| 326 | end | ||
| 327 | do | ||
| 328 | local print <const> = print | ||
| 329 | print(FLAG) | ||
| 330 | FLAG = 123 | ||
| 331 | end | ||
| 332 | local _module_0 = { } | ||
| 333 | local a, b, c = 1, 2, 3 | ||
| 334 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 335 | local cool = "cat" | ||
| 336 | _module_0["cool"] = cool | ||
| 337 | local What | ||
| 338 | if this then | ||
| 339 | What = "abc" | ||
| 340 | else | ||
| 341 | What = "def" | ||
| 342 | end | ||
| 343 | _module_0["What"] = What | ||
| 344 | local y | ||
| 345 | y = function() | ||
| 346 | local hallo = 3434 | ||
| 347 | end | ||
| 348 | _module_0["y"] = y | ||
| 349 | local Something | ||
| 350 | local _class_0 | ||
| 351 | local _base_0 = { | ||
| 352 | umm = "cool" | ||
| 353 | } | ||
| 354 | if _base_0.__index == nil then | ||
| 355 | _base_0.__index = _base_0 | ||
| 356 | end | ||
| 357 | _class_0 = setmetatable({ | ||
| 358 | __init = function() end, | ||
| 359 | __base = _base_0, | ||
| 360 | __name = "Something" | ||
| 361 | }, { | ||
| 362 | __index = _base_0, | ||
| 363 | __call = function(cls, ...) | ||
| 364 | local _self_0 = setmetatable({ }, _base_0) | ||
| 365 | cls.__init(_self_0, ...) | ||
| 366 | return _self_0 | ||
| 367 | end | ||
| 368 | }) | ||
| 369 | _base_0.__class = _class_0 | ||
| 370 | Something = _class_0 | ||
| 371 | _module_0["Something"] = Something | ||
| 372 | return _module_0 | ||
| 373 | local _module_0 = { } | ||
| 374 | local loadstring, tolua | ||
| 375 | do | ||
| 376 | local _obj_0 = yue | ||
| 377 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 378 | end | ||
| 379 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 380 | local fieldA = tb.itemA.fieldA | ||
| 381 | if fieldA == nil then | ||
| 382 | fieldA = '默认值' | ||
| 383 | end | ||
| 384 | _module_0["fieldA"] = fieldA | ||
| 385 | return _module_0 | ||
| 386 | local _module_0 = setmetatable({ }, { }) | ||
| 387 | _module_0.itemA = tb | ||
| 388 | getmetatable(_module_0).__index = items | ||
| 389 | _module_0["a-b-c"] = 123 | ||
| 390 | return _module_0 | ||
| 391 | local _module_0 = { } | ||
| 392 | local d, e, f = 3, 2, 1 | ||
| 393 | _module_0[#_module_0 + 1] = d | ||
| 394 | _module_0[#_module_0 + 1] = e | ||
| 395 | _module_0[#_module_0 + 1] = f | ||
| 396 | if this then | ||
| 397 | _module_0[#_module_0 + 1] = 123 | ||
| 398 | else | ||
| 399 | _module_0[#_module_0 + 1] = 456 | ||
| 400 | end | ||
| 401 | local _with_0 = tmp | ||
| 402 | local j = 2000 | ||
| 403 | _module_0[#_module_0 + 1] = _with_0 | ||
| 404 | return _module_0 | ||
| 405 | local _module_0 = nil | ||
| 406 | _module_0 = function() | ||
| 407 | print("你好") | ||
| 408 | return 123 | ||
| 409 | end | ||
| 410 | return _module_0 | ||
| 411 | xpcall(function() | 173 | xpcall(function() |
| 412 | return func(1, 2, 3) | 174 | return func(1, 2, 3) |
| 413 | end, function(err) | 175 | end, function(err) |
| @@ -2395,6 +2157,12 @@ local file | |||
| 2395 | local _with_0 = File("favorite_foods.txt") | 2157 | local _with_0 = File("favorite_foods.txt") |
| 2396 | _with_0:set_encoding("utf8") | 2158 | _with_0:set_encoding("utf8") |
| 2397 | file = _with_0 | 2159 | file = _with_0 |
| 2160 | local result | ||
| 2161 | local _with_0 = obj | ||
| 2162 | repeat | ||
| 2163 | result = _with_0.value | ||
| 2164 | break | ||
| 2165 | until true | ||
| 2398 | local create_person | 2166 | local create_person |
| 2399 | create_person = function(name, relatives) | 2167 | create_person = function(name, relatives) |
| 2400 | local _with_0 = Person() | 2168 | local _with_0 = Person() |
| @@ -2435,6 +2203,12 @@ local file | |||
| 2435 | local _with_0 = File("favorite_foods.txt") | 2203 | local _with_0 = File("favorite_foods.txt") |
| 2436 | _with_0:set_encoding("utf8") | 2204 | _with_0:set_encoding("utf8") |
| 2437 | file = _with_0 | 2205 | file = _with_0 |
| 2206 | local result | ||
| 2207 | local _with_0 = obj | ||
| 2208 | repeat | ||
| 2209 | result = _with_0.value | ||
| 2210 | break | ||
| 2211 | until true | ||
| 2438 | local create_person | 2212 | local create_person |
| 2439 | create_person = function(name, relatives) | 2213 | create_person = function(name, relatives) |
| 2440 | local _with_0 = Person() | 2214 | local _with_0 = Person() |
| @@ -3268,6 +3042,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3268 | break | 3042 | break |
| 3269 | end | 3043 | end |
| 3270 | end | 3044 | end |
| 3045 | local key, score | ||
| 3046 | for k, v in pairs(data) do | ||
| 3047 | if k == "target" then | ||
| 3048 | key, score = k, v * 10 | ||
| 3049 | break | ||
| 3050 | end | ||
| 3051 | end | ||
| 3271 | local func_a | 3052 | local func_a |
| 3272 | func_a = function() | 3053 | func_a = function() |
| 3273 | for i = 1, 10 do | 3054 | for i = 1, 10 do |
| @@ -3330,6 +3111,13 @@ for _index_0 = 1, #_list_0 do | |||
| 3330 | break | 3111 | break |
| 3331 | end | 3112 | end |
| 3332 | end | 3113 | end |
| 3114 | local key, score | ||
| 3115 | for k, v in pairs(data) do | ||
| 3116 | if k == "target" then | ||
| 3117 | key, score = k, v * 10 | ||
| 3118 | break | ||
| 3119 | end | ||
| 3120 | end | ||
| 3333 | local func_a | 3121 | local func_a |
| 3334 | func_a = function() | 3122 | func_a = function() |
| 3335 | for i = 1, 10 do | 3123 | for i = 1, 10 do |
| @@ -4008,11 +3796,32 @@ end | |||
| 4008 | while not (running == false) do | 3796 | while not (running == false) do |
| 4009 | my_function() | 3797 | my_function() |
| 4010 | end | 3798 | end |
| 3799 | local value, doubled | ||
| 3800 | local _val_0, _val_1 | ||
| 3801 | while true do | ||
| 3802 | local n = get_next() | ||
| 3803 | if n > 10 then | ||
| 3804 | _val_0, _val_1 = n, n * 2 | ||
| 3805 | break | ||
| 3806 | end | ||
| 3807 | end | ||
| 3808 | value, doubled = _val_0, _val_1 | ||
| 4011 | local i = 10 | 3809 | local i = 10 |
| 4012 | repeat | 3810 | repeat |
| 4013 | print(i) | 3811 | print(i) |
| 4014 | i = i - 1 | 3812 | i = i - 1 |
| 4015 | until i == 0 | 3813 | until i == 0 |
| 3814 | local i = 1 | ||
| 3815 | local value, scaled | ||
| 3816 | local _val_0, _val_1 | ||
| 3817 | repeat | ||
| 3818 | if i > 3 then | ||
| 3819 | _val_0, _val_1 = i, i * 100 | ||
| 3820 | break | ||
| 3821 | end | ||
| 3822 | i = i + 1 | ||
| 3823 | until false | ||
| 3824 | value, scaled = _val_0, _val_1 | ||
| 4016 | local i = 10 | 3825 | local i = 10 |
| 4017 | while i > 0 do | 3826 | while i > 0 do |
| 4018 | print(i) | 3827 | print(i) |
| @@ -4029,11 +3838,32 @@ end | |||
| 4029 | while not (running == false) do | 3838 | while not (running == false) do |
| 4030 | my_function() | 3839 | my_function() |
| 4031 | end | 3840 | end |
| 3841 | local value, doubled | ||
| 3842 | local _val_0, _val_1 | ||
| 3843 | while true do | ||
| 3844 | local n = get_next() | ||
| 3845 | if n > 10 then | ||
| 3846 | _val_0, _val_1 = n, n * 2 | ||
| 3847 | break | ||
| 3848 | end | ||
| 3849 | end | ||
| 3850 | value, doubled = _val_0, _val_1 | ||
| 4032 | local i = 10 | 3851 | local i = 10 |
| 4033 | repeat | 3852 | repeat |
| 4034 | print(i) | 3853 | print(i) |
| 4035 | i = i - 1 | 3854 | i = i - 1 |
| 4036 | until i == 0 | 3855 | until i == 0 |
| 3856 | local i = 1 | ||
| 3857 | local value, scaled | ||
| 3858 | local _val_0, _val_1 | ||
| 3859 | repeat | ||
| 3860 | if i > 3 then | ||
| 3861 | _val_0, _val_1 = i, i * 100 | ||
| 3862 | break | ||
| 3863 | end | ||
| 3864 | i = i + 1 | ||
| 3865 | until false | ||
| 3866 | value, scaled = _val_0, _val_1 | ||
| 4037 | local my_object = { | 3867 | local my_object = { |
| 4038 | value = 1000, | 3868 | value = 1000, |
| 4039 | write = function(self) | 3869 | write = function(self) |
| @@ -5136,3 +4966,265 @@ fn = function() | |||
| 5136 | return str | 4966 | return str |
| 5137 | end | 4967 | end |
| 5138 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | 4968 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" |
| 4969 | do | ||
| 4970 | local insert, concat = table.insert, table.concat | ||
| 4971 | local C, Ct, Cmt | ||
| 4972 | do | ||
| 4973 | local _obj_0 = require("lpeg") | ||
| 4974 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4975 | end | ||
| 4976 | local x, y, z | ||
| 4977 | do | ||
| 4978 | local _obj_0 = require('mymodule') | ||
| 4979 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 4980 | end | ||
| 4981 | local a, b, c | ||
| 4982 | local _obj_0 = require('module') | ||
| 4983 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 4984 | end | ||
| 4985 | do | ||
| 4986 | local module = require('module') | ||
| 4987 | local module_x = require('module_x') | ||
| 4988 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 4989 | local part = require("module.part") | ||
| 4990 | end | ||
| 4991 | do | ||
| 4992 | local PlayerModule = require("player") | ||
| 4993 | local C, Ct, Cmt | ||
| 4994 | do | ||
| 4995 | local _obj_0 = require("lpeg") | ||
| 4996 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 4997 | end | ||
| 4998 | local one, two, ch | ||
| 4999 | local _obj_0 = require("export") | ||
| 5000 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5001 | end | ||
| 5002 | do | ||
| 5003 | local tostring <const> = tostring | ||
| 5004 | local concat <const> = table.concat | ||
| 5005 | print(concat({ | ||
| 5006 | "a", | ||
| 5007 | tostring(1) | ||
| 5008 | })) | ||
| 5009 | end | ||
| 5010 | do | ||
| 5011 | local print <const> = print | ||
| 5012 | local math <const> = math | ||
| 5013 | print("hello") | ||
| 5014 | math.random(3) | ||
| 5015 | end | ||
| 5016 | do | ||
| 5017 | local print <const> = print | ||
| 5018 | print(FLAG) | ||
| 5019 | FLAG = 123 | ||
| 5020 | end | ||
| 5021 | local _module_0 = { } | ||
| 5022 | local a, b, c = 1, 2, 3 | ||
| 5023 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5024 | local cool = "cat" | ||
| 5025 | _module_0["cool"] = cool | ||
| 5026 | local What | ||
| 5027 | if this then | ||
| 5028 | What = "abc" | ||
| 5029 | else | ||
| 5030 | What = "def" | ||
| 5031 | end | ||
| 5032 | _module_0["What"] = What | ||
| 5033 | local y | ||
| 5034 | y = function() | ||
| 5035 | local hallo = 3434 | ||
| 5036 | end | ||
| 5037 | _module_0["y"] = y | ||
| 5038 | local Something | ||
| 5039 | local _class_0 | ||
| 5040 | local _base_0 = { | ||
| 5041 | umm = "cool" | ||
| 5042 | } | ||
| 5043 | if _base_0.__index == nil then | ||
| 5044 | _base_0.__index = _base_0 | ||
| 5045 | end | ||
| 5046 | _class_0 = setmetatable({ | ||
| 5047 | __init = function() end, | ||
| 5048 | __base = _base_0, | ||
| 5049 | __name = "Something" | ||
| 5050 | }, { | ||
| 5051 | __index = _base_0, | ||
| 5052 | __call = function(cls, ...) | ||
| 5053 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5054 | cls.__init(_self_0, ...) | ||
| 5055 | return _self_0 | ||
| 5056 | end | ||
| 5057 | }) | ||
| 5058 | _base_0.__class = _class_0 | ||
| 5059 | Something = _class_0 | ||
| 5060 | _module_0["Something"] = Something | ||
| 5061 | return _module_0 | ||
| 5062 | local _module_0 = { } | ||
| 5063 | local loadstring, tolua | ||
| 5064 | do | ||
| 5065 | local _obj_0 = yue | ||
| 5066 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5067 | end | ||
| 5068 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5069 | local fieldA = tb.itemA.fieldA | ||
| 5070 | if fieldA == nil then | ||
| 5071 | fieldA = '默认值' | ||
| 5072 | end | ||
| 5073 | _module_0["fieldA"] = fieldA | ||
| 5074 | return _module_0 | ||
| 5075 | local _module_0 = setmetatable({ }, { }) | ||
| 5076 | _module_0.itemA = tb | ||
| 5077 | getmetatable(_module_0).__index = items | ||
| 5078 | _module_0["a-b-c"] = 123 | ||
| 5079 | return _module_0 | ||
| 5080 | local _module_0 = { } | ||
| 5081 | local d, e, f = 3, 2, 1 | ||
| 5082 | _module_0[#_module_0 + 1] = d | ||
| 5083 | _module_0[#_module_0 + 1] = e | ||
| 5084 | _module_0[#_module_0 + 1] = f | ||
| 5085 | if this then | ||
| 5086 | _module_0[#_module_0 + 1] = 123 | ||
| 5087 | else | ||
| 5088 | _module_0[#_module_0 + 1] = 456 | ||
| 5089 | end | ||
| 5090 | local _with_0 = tmp | ||
| 5091 | local j = 2000 | ||
| 5092 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5093 | return _module_0 | ||
| 5094 | local _module_0 = nil | ||
| 5095 | _module_0 = function() | ||
| 5096 | print("你好") | ||
| 5097 | return 123 | ||
| 5098 | end | ||
| 5099 | return _module_0 | ||
| 5100 | do | ||
| 5101 | local insert, concat = table.insert, table.concat | ||
| 5102 | local C, Ct, Cmt | ||
| 5103 | do | ||
| 5104 | local _obj_0 = require("lpeg") | ||
| 5105 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5106 | end | ||
| 5107 | local x, y, z | ||
| 5108 | do | ||
| 5109 | local _obj_0 = require('mymodule') | ||
| 5110 | x, y, z = _obj_0.x, _obj_0.y, _obj_0.z | ||
| 5111 | end | ||
| 5112 | local a, b, c | ||
| 5113 | local _obj_0 = require('module') | ||
| 5114 | a, b, c = _obj_0.a, _obj_0.b, _obj_0.c | ||
| 5115 | end | ||
| 5116 | do | ||
| 5117 | local module = require('module') | ||
| 5118 | local module_x = require('module_x') | ||
| 5119 | local d_a_s_h_e_s = require("d-a-s-h-e-s") | ||
| 5120 | local part = require("module.part") | ||
| 5121 | end | ||
| 5122 | do | ||
| 5123 | local PlayerModule = require("player") | ||
| 5124 | local C, Ct, Cmt | ||
| 5125 | do | ||
| 5126 | local _obj_0 = require("lpeg") | ||
| 5127 | C, Ct, Cmt = _obj_0.C, _obj_0.Ct, _obj_0.Cmt | ||
| 5128 | end | ||
| 5129 | local one, two, ch | ||
| 5130 | local _obj_0 = require("export") | ||
| 5131 | one, two, ch = _obj_0[1], _obj_0[2], _obj_0.Something.umm[1] | ||
| 5132 | end | ||
| 5133 | do | ||
| 5134 | local tostring <const> = tostring | ||
| 5135 | local concat <const> = table.concat | ||
| 5136 | print(concat({ | ||
| 5137 | "a", | ||
| 5138 | tostring(1) | ||
| 5139 | })) | ||
| 5140 | end | ||
| 5141 | do | ||
| 5142 | local print <const> = print | ||
| 5143 | local math <const> = math | ||
| 5144 | print("hello") | ||
| 5145 | math.random(3) | ||
| 5146 | end | ||
| 5147 | do | ||
| 5148 | local print <const> = print | ||
| 5149 | print(FLAG) | ||
| 5150 | FLAG = 123 | ||
| 5151 | end | ||
| 5152 | local _module_0 = { } | ||
| 5153 | local a, b, c = 1, 2, 3 | ||
| 5154 | _module_0["a"], _module_0["b"], _module_0["c"] = a, b, c | ||
| 5155 | local cool = "cat" | ||
| 5156 | _module_0["cool"] = cool | ||
| 5157 | local What | ||
| 5158 | if this then | ||
| 5159 | What = "abc" | ||
| 5160 | else | ||
| 5161 | What = "def" | ||
| 5162 | end | ||
| 5163 | _module_0["What"] = What | ||
| 5164 | local y | ||
| 5165 | y = function() | ||
| 5166 | local hallo = 3434 | ||
| 5167 | end | ||
| 5168 | _module_0["y"] = y | ||
| 5169 | local Something | ||
| 5170 | local _class_0 | ||
| 5171 | local _base_0 = { | ||
| 5172 | umm = "cool" | ||
| 5173 | } | ||
| 5174 | if _base_0.__index == nil then | ||
| 5175 | _base_0.__index = _base_0 | ||
| 5176 | end | ||
| 5177 | _class_0 = setmetatable({ | ||
| 5178 | __init = function() end, | ||
| 5179 | __base = _base_0, | ||
| 5180 | __name = "Something" | ||
| 5181 | }, { | ||
| 5182 | __index = _base_0, | ||
| 5183 | __call = function(cls, ...) | ||
| 5184 | local _self_0 = setmetatable({ }, _base_0) | ||
| 5185 | cls.__init(_self_0, ...) | ||
| 5186 | return _self_0 | ||
| 5187 | end | ||
| 5188 | }) | ||
| 5189 | _base_0.__class = _class_0 | ||
| 5190 | Something = _class_0 | ||
| 5191 | _module_0["Something"] = Something | ||
| 5192 | return _module_0 | ||
| 5193 | local _module_0 = { } | ||
| 5194 | local loadstring, tolua | ||
| 5195 | do | ||
| 5196 | local _obj_0 = yue | ||
| 5197 | loadstring, tolua = _obj_0.loadstring, _obj_0.to_lua | ||
| 5198 | end | ||
| 5199 | _module_0["loadstring"], _module_0["tolua"] = loadstring, tolua | ||
| 5200 | local fieldA = tb.itemA.fieldA | ||
| 5201 | if fieldA == nil then | ||
| 5202 | fieldA = '默认值' | ||
| 5203 | end | ||
| 5204 | _module_0["fieldA"] = fieldA | ||
| 5205 | return _module_0 | ||
| 5206 | local _module_0 = setmetatable({ }, { }) | ||
| 5207 | _module_0.itemA = tb | ||
| 5208 | getmetatable(_module_0).__index = items | ||
| 5209 | _module_0["a-b-c"] = 123 | ||
| 5210 | return _module_0 | ||
| 5211 | local _module_0 = { } | ||
| 5212 | local d, e, f = 3, 2, 1 | ||
| 5213 | _module_0[#_module_0 + 1] = d | ||
| 5214 | _module_0[#_module_0 + 1] = e | ||
| 5215 | _module_0[#_module_0 + 1] = f | ||
| 5216 | if this then | ||
| 5217 | _module_0[#_module_0 + 1] = 123 | ||
| 5218 | else | ||
| 5219 | _module_0[#_module_0 + 1] = 456 | ||
| 5220 | end | ||
| 5221 | local _with_0 = tmp | ||
| 5222 | local j = 2000 | ||
| 5223 | _module_0[#_module_0 + 1] = _with_0 | ||
| 5224 | return _module_0 | ||
| 5225 | local _module_0 = nil | ||
| 5226 | _module_0 = function() | ||
| 5227 | print("你好") | ||
| 5228 | return 123 | ||
| 5229 | end | ||
| 5230 | return _module_0 | ||
diff --git a/spec/outputs/compile_doc.lua b/spec/outputs/compile_doc.lua index 6a5efd5..8d5c11a 100644 --- a/spec/outputs/compile_doc.lua +++ b/spec/outputs/compile_doc.lua | |||
| @@ -11,7 +11,6 @@ getFiles = function(locale) | |||
| 11 | "doc/docs/" .. tostring(locale) .. "doc/advanced/do.md", | 11 | "doc/docs/" .. tostring(locale) .. "doc/advanced/do.md", |
| 12 | "doc/docs/" .. tostring(locale) .. "doc/advanced/line-decorators.md", | 12 | "doc/docs/" .. tostring(locale) .. "doc/advanced/line-decorators.md", |
| 13 | "doc/docs/" .. tostring(locale) .. "doc/advanced/macro.md", | 13 | "doc/docs/" .. tostring(locale) .. "doc/advanced/macro.md", |
| 14 | "doc/docs/" .. tostring(locale) .. "doc/advanced/module.md", | ||
| 15 | "doc/docs/" .. tostring(locale) .. "doc/advanced/try.md", | 14 | "doc/docs/" .. tostring(locale) .. "doc/advanced/try.md", |
| 16 | "doc/docs/" .. tostring(locale) .. "doc/data-structures/table-literals.md", | 15 | "doc/docs/" .. tostring(locale) .. "doc/data-structures/table-literals.md", |
| 17 | "doc/docs/" .. tostring(locale) .. "doc/data-structures/comprehensions.md", | 16 | "doc/docs/" .. tostring(locale) .. "doc/data-structures/comprehensions.md", |
| @@ -38,6 +37,7 @@ getFiles = function(locale) | |||
| 38 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/attributes.md", | 37 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/attributes.md", |
| 39 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/operator.md", | 38 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/operator.md", |
| 40 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/literals.md", | 39 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/literals.md", |
| 40 | "doc/docs/" .. tostring(locale) .. "doc/language-basics/module.md", | ||
| 41 | "doc/docs/" .. tostring(locale) .. "doc/reference/license-mit.md", | 41 | "doc/docs/" .. tostring(locale) .. "doc/reference/license-mit.md", |
| 42 | "doc/docs/" .. tostring(locale) .. "doc/reference/the-yuescript-library.md" | 42 | "doc/docs/" .. tostring(locale) .. "doc/reference/the-yuescript-library.md" |
| 43 | } | 43 | } |
