diff options
| author | Li Jin <dragon-fly@qq.com> | 2023-06-07 09:42:50 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2023-06-07 09:42:50 +0800 |
| commit | 2a3e50752ade96c3b5d6b1103937bef0f6b31157 (patch) | |
| tree | f7ae2654ac96009a9e5dbe9667e480cc920a2868 /spec/outputs | |
| parent | 738154d37dd4ec20b09acd0f9f81601d0dc069ba (diff) | |
| download | yuescript-2a3e50752ade96c3b5d6b1103937bef0f6b31157.tar.gz yuescript-2a3e50752ade96c3b5d6b1103937bef0f6b31157.tar.bz2 yuescript-2a3e50752ade96c3b5d6b1103937bef0f6b31157.zip | |
add new syntax of in-expression.
Diffstat (limited to 'spec/outputs')
| -rw-r--r-- | spec/outputs/in_expression.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/outputs/in_expression.lua b/spec/outputs/in_expression.lua new file mode 100644 index 0000000..061431f --- /dev/null +++ b/spec/outputs/in_expression.lua | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | f((function() | ||
| 2 | local _val_0 = -a ^ 2 | ||
| 3 | return 1 == _val_0 or 2 == _val_0 or 3 == _val_0 | ||
| 4 | end)()) | ||
| 5 | local a, b = (function(...) | ||
| 6 | local _val_0 = x(...) | ||
| 7 | return not (1 <= _val_0 and _val_0 <= 3) | ||
| 8 | end)(...), 2 | ||
| 9 | local d | ||
| 10 | do | ||
| 11 | local _val_0 = (tb.x.y(...)) | ||
| 12 | d = not (1 <= _val_0 and _val_0 <= 3) | ||
| 13 | end | ||
| 14 | if (1 == a) and (2 == b or 3 == b or 4 == b) or (function() | ||
| 15 | local _val_0 = c | ||
| 16 | return 1 <= _val_0 and _val_0 <= 10 | ||
| 17 | end)() then | ||
| 18 | print(a, b, c) | ||
| 19 | end | ||
| 20 | do | ||
| 21 | local _exp_0 = val | ||
| 22 | if 1 == _exp_0 or 2 == _exp_0 or 3 == _exp_0 then | ||
| 23 | print("1, 2, 3") | ||
| 24 | elseif not (0 < _exp_0 and _exp_0 <= 100) then | ||
| 25 | print("not (0 < val <= 100)") | ||
| 26 | elseif (200 <= _exp_0 and _exp_0 < 300) then | ||
| 27 | print("200 <= val < 300)") | ||
| 28 | elseif not (333 == _exp_0 or 444 == _exp_0 or 555 == _exp_0) then | ||
| 29 | print("not 333, 444 or 555") | ||
| 30 | end | ||
| 31 | end | ||
| 32 | do | ||
| 33 | local _val_0 = y | ||
| 34 | return not (a < _val_0 and _val_0 < b) | ||
| 35 | end | ||
| 36 | return nil | ||
