aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/5.1/loops.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2022-09-30 11:29:41 +0800
committerLi Jin <dragon-fly@qq.com>2022-09-30 11:29:41 +0800
commit5aa41b436b3fdf29f5a0046c68cb60b16fa09eb2 (patch)
tree5c5c0ecdab0d19544652bc05b70d8131e1645337 /spec/outputs/5.1/loops.lua
parenta6b6753fda9745f316f3236462b74794b35b85c9 (diff)
downloadyuescript-5aa41b436b3fdf29f5a0046c68cb60b16fa09eb2.tar.gz
yuescript-5aa41b436b3fdf29f5a0046c68cb60b16fa09eb2.tar.bz2
yuescript-5aa41b436b3fdf29f5a0046c68cb60b16fa09eb2.zip
fix issue #81, refactor continue with gotos.
Diffstat (limited to 'spec/outputs/5.1/loops.lua')
-rw-r--r--spec/outputs/5.1/loops.lua381
1 files changed, 381 insertions, 0 deletions
diff --git a/spec/outputs/5.1/loops.lua b/spec/outputs/5.1/loops.lua
new file mode 100644
index 0000000..a3b9548
--- /dev/null
+++ b/spec/outputs/5.1/loops.lua
@@ -0,0 +1,381 @@
1for x = 1, 10 do
2 print("yeah")
3end
4for x = 1, #something do
5 print("yeah")
6end
7for y = 100, 60, -3 do
8 print("count down", y)
9end
10for a = 1, 10 do
11 print("okay")
12end
13for a = 1, 10 do
14 for b = 2, 43 do
15 print(a, b)
16 end
17end
18for i in iter do
19 for j in yeah do
20 local x = 343 + i + j
21 print(i, j)
22 end
23end
24local _list_0 = something
25for _index_0 = 1, #_list_0 do
26 local x = _list_0[_index_0]
27 print(x)
28end
29for k, v in pairs(hello) do
30 print(k, v)
31end
32for x in y, z do
33 print(x)
34end
35for x in y, z, k do
36 print(x)
37end
38local _list_1 = modules
39for _index_0 = 1, #_list_1 do
40 local name, members = _list_1[_index_0]
41 print(name, member)
42end
43local x
44x = function()
45 for x in y do
46 local _ = y
47 end
48end
49local hello = {
50 1,
51 2,
52 3,
53 4,
54 5
55}
56do
57 local _accum_0 = { }
58 local _len_0 = 1
59 for _index_0 = 1, #hello do
60 local y = hello[_index_0]
61 if y % 2 == 0 then
62 _accum_0[_len_0] = y
63 end
64 _len_0 = _len_0 + 1
65 end
66 x = _accum_0
67end
68x = function()
69 for _index_0 = 1, #hello do
70 local x = hello[_index_0]
71 local _ = y
72 end
73end
74local t
75do
76 local _accum_0 = { }
77 local _len_0 = 1
78 for i = 10, 20 do
79 _accum_0[_len_0] = i * 2
80 _len_0 = _len_0 + 1
81 end
82 t = _accum_0
83end
84local hmm = 0
85local y
86do
87 local _accum_0 = { }
88 local _len_0 = 1
89 for j = 3, 30, 8 do
90 hmm = hmm + 1
91 _accum_0[_len_0] = j * hmm
92 _len_0 = _len_0 + 1
93 end
94 y = _accum_0
95end
96local _
97_ = function()
98 for k = 10, 40 do
99 _ = "okay"
100 end
101end
102_ = function()
103 local _accum_0 = { }
104 local _len_0 = 1
105 for k = 10, 40 do
106 _accum_0[_len_0] = "okay"
107 _len_0 = _len_0 + 1
108 end
109 return _accum_0
110end
111while true do
112 print("name")
113end
114while 5 + 5 do
115 print("okay world")
116 working(man)
117end
118while also do
119 i(work(too))
120 _ = "okay"
121end
122local i = 0
123do
124 local _accum_0 = { }
125 local _len_0 = 1
126 while i < 10 do
127 i = i + 1
128 _len_0 = _len_0 + 1
129 end
130 x = _accum_0
131end
132do
133 local _accum_0 = { }
134 local _len_0 = 1
135 local _list_2 = 3
136 for _index_0 = 1, #_list_2 do
137 local thing = _list_2[_index_0]
138 y = "hello"
139 _len_0 = _len_0 + 1
140 end
141 x = _accum_0
142end
143do
144 local _accum_0 = { }
145 local _len_0 = 1
146 for x = 1, 2 do
147 y = "hello"
148 _len_0 = _len_0 + 1
149 end
150 x = _accum_0
151end
152while true do
153 local _continue_0 = false
154 repeat
155 if false then
156 _continue_0 = true
157 break
158 end
159 print("yes")
160 if true then
161 break
162 end
163 print("no")
164 _continue_0 = true
165 until true
166 if not _continue_0 then
167 break
168 end
169end
170for i = 1, 10 do
171 while true do
172 local _continue_0 = false
173 repeat
174 do
175 if not true then
176 _continue_0 = true
177 break
178 end
179 break
180 end
181 _continue_0 = true
182 until true
183 if not _continue_0 then
184 break
185 end
186 end
187end
188local a = 1
189repeat
190 local _cond_0 = false
191 local _continue_0 = false
192 repeat
193 a = a + 1
194 if a == 5 then
195 _cond_0 = a == 10
196 _continue_0 = true
197 break
198 end
199 if a == 6 then
200 break
201 end
202 print(a)
203 _cond_0 = a == 10
204 _continue_0 = true
205 until true
206 if not _continue_0 then
207 break
208 end
209until _cond_0
210x = 0
211repeat
212 local _cond_0 = false
213 local _continue_0 = false
214 repeat
215 x = x + 1
216 y = x
217 if x < 5 then
218 _cond_0 = y == 10
219 _continue_0 = true
220 break
221 end
222 print(y)
223 _cond_0 = y == 10
224 _continue_0 = true
225 until true
226 if not _continue_0 then
227 break
228 end
229until _cond_0
230a = 3
231while not (a == 0) do
232 a = a - 1
233end
234local done = false
235while not done do
236 done = true
237end
238repeat
239 print("hello")
240until true
241while not done do
242 x = 10
243 repeat
244 x = x - 1
245 until x == 0
246end
247while not cond do
248 print("okay")
249end
250for x = 1, 10 do
251 local _continue_0 = false
252 repeat
253 if x > 3 and x < 7 then
254 _continue_0 = true
255 break
256 end
257 print(x)
258 _continue_0 = true
259 until true
260 if not _continue_0 then
261 break
262 end
263end
264local list
265do
266 local _accum_0 = { }
267 local _len_0 = 1
268 for x = 1, 10 do
269 local _continue_0 = false
270 repeat
271 if x > 3 and x < 7 then
272 _continue_0 = true
273 break
274 end
275 _accum_0[_len_0] = x
276 _len_0 = _len_0 + 1
277 _continue_0 = true
278 until true
279 if not _continue_0 then
280 break
281 end
282 end
283 list = _accum_0
284end
285local _list_2 = {
286 1,
287 2,
288 3,
289 4,
290 5,
291 6
292}
293for _index_0 = 1, #_list_2 do
294 local a = _list_2[_index_0]
295 local _continue_0 = false
296 repeat
297 if a == 1 then
298 _continue_0 = true
299 break
300 end
301 if a == 3 then
302 _continue_0 = true
303 break
304 end
305 print(a)
306 _continue_0 = true
307 until true
308 if not _continue_0 then
309 break
310 end
311end
312for x = 1, 10 do
313 local _continue_0 = false
314 repeat
315 if x % 2 == 0 then
316 _continue_0 = true
317 break
318 end
319 for y = 2, 12 do
320 local _continue_1 = false
321 repeat
322 if y % 3 == 0 then
323 _continue_1 = true
324 break
325 end
326 _continue_1 = true
327 until true
328 if not _continue_1 then
329 break
330 end
331 end
332 _continue_0 = true
333 until true
334 if not _continue_0 then
335 break
336 end
337end
338while true do
339 local _continue_0 = false
340 repeat
341 do
342 if false then
343 _continue_0 = true
344 break
345 end
346 break
347 end
348 _continue_0 = true
349 until true
350 if not _continue_0 then
351 break
352 end
353end
354while true do
355 local _continue_0 = false
356 repeat
357 if false then
358 _continue_0 = true
359 break
360 end
361 do
362 return 22
363 end
364 _continue_0 = true
365 until true
366 if not _continue_0 then
367 break
368 end
369end
370do
371 local xxx = {
372 1,
373 2,
374 3,
375 4
376 }
377 for _index_0 = 1, #xxx do
378 local thing = xxx[_index_0]
379 print(thing)
380 end
381end