aboutsummaryrefslogtreecommitdiff
path: root/spec/outputs/loops.lua
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
committerLi Jin <dragon-fly@qq.com>2021-10-12 10:04:44 +0800
commit60a979e224f26117f5be82bfca757a2483cef0fd (patch)
tree7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/loops.lua
parenta19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff)
downloadyuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2
yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip
fix test.
Diffstat (limited to 'spec/outputs/loops.lua')
-rw-r--r--spec/outputs/loops.lua352
1 files changed, 352 insertions, 0 deletions
diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua
new file mode 100644
index 0000000..a905e4e
--- /dev/null
+++ b/spec/outputs/loops.lua
@@ -0,0 +1,352 @@
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 if not true then
175 _continue_0 = true
176 break
177 end
178 break
179 _continue_0 = true
180 until true
181 if not _continue_0 then
182 break
183 end
184 end
185end
186local a = 1
187repeat
188 local _continue_0 = false
189 repeat
190 a = a + 1
191 if a == 5 then
192 _continue_0 = true
193 break
194 end
195 if a == 6 then
196 break
197 end
198 print(a)
199 _continue_0 = true
200 until true
201 if not _continue_0 then
202 break
203 end
204until a == 10
205a = 3
206while not (a == 0) do
207 a = a - 1
208end
209local done = false
210while not done do
211 done = true
212end
213repeat
214 print("hello")
215until true
216while not done do
217 x = 10
218 repeat
219 x = x - 1
220 until x == 0
221end
222while not cond do
223 print("okay")
224end
225for x = 1, 10 do
226 local _continue_0 = false
227 repeat
228 if x > 3 and x < 7 then
229 _continue_0 = true
230 break
231 end
232 print(x)
233 _continue_0 = true
234 until true
235 if not _continue_0 then
236 break
237 end
238end
239local list
240do
241 local _accum_0 = { }
242 local _len_0 = 1
243 for x = 1, 10 do
244 local _continue_0 = false
245 repeat
246 if x > 3 and x < 7 then
247 _continue_0 = true
248 break
249 end
250 _accum_0[_len_0] = x
251 _len_0 = _len_0 + 1
252 _continue_0 = true
253 until true
254 if not _continue_0 then
255 break
256 end
257 end
258 list = _accum_0
259end
260local _list_2 = {
261 1,
262 2,
263 3,
264 4,
265 5,
266 6
267}
268for _index_0 = 1, #_list_2 do
269 local a = _list_2[_index_0]
270 local _continue_0 = false
271 repeat
272 if a == 1 then
273 _continue_0 = true
274 break
275 end
276 if a == 3 then
277 _continue_0 = true
278 break
279 end
280 print(a)
281 _continue_0 = true
282 until true
283 if not _continue_0 then
284 break
285 end
286end
287for x = 1, 10 do
288 local _continue_0 = false
289 repeat
290 if x % 2 == 0 then
291 _continue_0 = true
292 break
293 end
294 for y = 2, 12 do
295 local _continue_1 = false
296 repeat
297 if y % 3 == 0 then
298 _continue_1 = true
299 break
300 end
301 _continue_1 = true
302 until true
303 if not _continue_1 then
304 break
305 end
306 end
307 _continue_0 = true
308 until true
309 if not _continue_0 then
310 break
311 end
312end
313while true do
314 local _continue_0 = false
315 repeat
316 if false then
317 _continue_0 = true
318 break
319 end
320 break
321 _continue_0 = true
322 until true
323 if not _continue_0 then
324 break
325 end
326end
327while true do
328 local _continue_0 = false
329 repeat
330 if false then
331 _continue_0 = true
332 break
333 end
334 return 22
335 _continue_0 = true
336 until true
337 if not _continue_0 then
338 break
339 end
340end
341do
342 local xxx = {
343 1,
344 2,
345 3,
346 4
347 }
348 for _index_0 = 1, #xxx do
349 local thing = xxx[_index_0]
350 print(thing)
351 end
352end