diff options
| author | Li Jin <dragon-fly@qq.com> | 2025-05-27 11:26:15 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2025-05-27 11:26:15 +0800 |
| commit | 87267ca9e93606b70bdc0397349b176b8d142514 (patch) | |
| tree | 1d24aded412cc9543cbe4c282401129f9fb3229a /spec | |
| parent | a9d28cb615d2bdc09d2482d5262951f2afc8d6e1 (diff) | |
| download | yuescript-87267ca9e93606b70bdc0397349b176b8d142514.tar.gz yuescript-87267ca9e93606b70bdc0397349b176b8d142514.tar.bz2 yuescript-87267ca9e93606b70bdc0397349b176b8d142514.zip | |
Updated `repeat` syntax functions.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/inputs/loops.yue | 15 | ||||
| -rw-r--r-- | spec/outputs/5.1/loops.lua | 28 | ||||
| -rw-r--r-- | spec/outputs/loops.lua | 28 | ||||
| -rw-r--r-- | spec/outputs/with.lua | 13 |
4 files changed, 76 insertions, 8 deletions
diff --git a/spec/inputs/loops.yue b/spec/inputs/loops.yue index 9a91b42..5df10ca 100644 --- a/spec/inputs/loops.yue +++ b/spec/inputs/loops.yue | |||
| @@ -251,4 +251,17 @@ do | |||
| 251 | if value > 5 | 251 | if value > 5 |
| 252 | item | 252 | item |
| 253 | 253 | ||
| 254 | 254 | do | |
| 255 | repeat print 1 until true | ||
| 256 | |||
| 257 | x = repeat | ||
| 258 | a = func! | ||
| 259 | break a.x | ||
| 260 | until a.v | ||
| 261 | |||
| 262 | items = repeat | ||
| 263 | item = getItem! | ||
| 264 | break unless item | ||
| 265 | item if item.value > 0 | ||
| 266 | until false | ||
| 267 | |||
diff --git a/spec/outputs/5.1/loops.lua b/spec/outputs/5.1/loops.lua index bc720f6..e4f2871 100644 --- a/spec/outputs/5.1/loops.lua +++ b/spec/outputs/5.1/loops.lua | |||
| @@ -587,3 +587,31 @@ do | |||
| 587 | end | 587 | end |
| 588 | list = _accum_0 | 588 | list = _accum_0 |
| 589 | end | 589 | end |
| 590 | do | ||
| 591 | repeat | ||
| 592 | print(1) | ||
| 593 | until true | ||
| 594 | do | ||
| 595 | local _accum_0 | ||
| 596 | repeat | ||
| 597 | a = func() | ||
| 598 | _accum_0 = a.x | ||
| 599 | break | ||
| 600 | until a.v | ||
| 601 | x = _accum_0 | ||
| 602 | end | ||
| 603 | local items | ||
| 604 | local _accum_0 = { } | ||
| 605 | local _len_0 = 1 | ||
| 606 | repeat | ||
| 607 | local item = getItem() | ||
| 608 | if not item then | ||
| 609 | break | ||
| 610 | end | ||
| 611 | if item.value > 0 then | ||
| 612 | _accum_0[_len_0] = item | ||
| 613 | _len_0 = _len_0 + 1 | ||
| 614 | end | ||
| 615 | until false | ||
| 616 | items = _accum_0 | ||
| 617 | end | ||
diff --git a/spec/outputs/loops.lua b/spec/outputs/loops.lua index 9a47579..6ab4bbb 100644 --- a/spec/outputs/loops.lua +++ b/spec/outputs/loops.lua | |||
| @@ -468,3 +468,31 @@ do | |||
| 468 | end | 468 | end |
| 469 | list = _accum_0 | 469 | list = _accum_0 |
| 470 | end | 470 | end |
| 471 | do | ||
| 472 | repeat | ||
| 473 | print(1) | ||
| 474 | until true | ||
| 475 | do | ||
| 476 | local _accum_0 | ||
| 477 | repeat | ||
| 478 | a = func() | ||
| 479 | _accum_0 = a.x | ||
| 480 | break | ||
| 481 | until a.v | ||
| 482 | x = _accum_0 | ||
| 483 | end | ||
| 484 | local items | ||
| 485 | local _accum_0 = { } | ||
| 486 | local _len_0 = 1 | ||
| 487 | repeat | ||
| 488 | local item = getItem() | ||
| 489 | if not item then | ||
| 490 | break | ||
| 491 | end | ||
| 492 | if item.value > 0 then | ||
| 493 | _accum_0[_len_0] = item | ||
| 494 | _len_0 = _len_0 + 1 | ||
| 495 | end | ||
| 496 | until false | ||
| 497 | items = _accum_0 | ||
| 498 | end | ||
diff --git a/spec/outputs/with.lua b/spec/outputs/with.lua index 338d51f..530915e 100644 --- a/spec/outputs/with.lua +++ b/spec/outputs/with.lua | |||
| @@ -192,12 +192,12 @@ do | |||
| 192 | local _with_0 = item | 192 | local _with_0 = item |
| 193 | do | 193 | do |
| 194 | local _accum_0 | 194 | local _accum_0 |
| 195 | while true do | 195 | repeat |
| 196 | if _with_0.id > 0 then | 196 | if _with_0.id > 0 then |
| 197 | _accum_0 = _with_0.content | 197 | _accum_0 = _with_0.content |
| 198 | break | 198 | break |
| 199 | end | 199 | end |
| 200 | end | 200 | until true |
| 201 | _with_0 = _accum_0 | 201 | _with_0 = _accum_0 |
| 202 | end | 202 | end |
| 203 | return _with_0 | 203 | return _with_0 |
| @@ -207,12 +207,12 @@ do | |||
| 207 | local _with_0 = tb | 207 | local _with_0 = tb |
| 208 | do | 208 | do |
| 209 | local _accum_0 | 209 | local _accum_0 |
| 210 | while true do | 210 | repeat |
| 211 | if _with_0.v then | 211 | if _with_0.v then |
| 212 | _accum_0 = _with_0.a | 212 | _accum_0 = _with_0.a |
| 213 | break | 213 | break |
| 214 | end | 214 | end |
| 215 | end | 215 | until true |
| 216 | _with_0 = _accum_0 | 216 | _with_0 = _accum_0 |
| 217 | end | 217 | end |
| 218 | a = _with_0 | 218 | a = _with_0 |
| @@ -221,13 +221,12 @@ do | |||
| 221 | while true do | 221 | while true do |
| 222 | local _with_0 = tb | 222 | local _with_0 = tb |
| 223 | local _accum_1 | 223 | local _accum_1 |
| 224 | while true do | 224 | repeat |
| 225 | if _with_0 ~= nil then | 225 | if _with_0 ~= nil then |
| 226 | _accum_1 = 1 | 226 | _accum_1 = 1 |
| 227 | break | 227 | break |
| 228 | end | 228 | end |
| 229 | break | 229 | until true |
| 230 | end | ||
| 231 | _with_0 = _accum_1 | 230 | _with_0 = _accum_1 |
| 232 | _accum_0 = _with_0 | 231 | _accum_0 = _with_0 |
| 233 | break | 232 | break |
