mirror of
https://github.com/ilyakooo0/luau.git
synced 2024-07-07 07:56:37 +03:00
Added somw loops
This commit is contained in:
parent
4ed8acbbb1
commit
ad74107a2c
|
@ -467,6 +467,8 @@
|
|||
[%label label]
|
||||
[%goto label]
|
||||
[%func-call functioncall]
|
||||
[%while cond=expr body=blok]
|
||||
[%repeat body=blok cond=expr]
|
||||
[%break ~]
|
||||
[%empty ~]
|
||||
==
|
||||
|
@ -478,6 +480,25 @@
|
|||
::
|
||||
(cold [%break ~] (jest 'break'))
|
||||
::
|
||||
%+ cook
|
||||
|= [* cond=expr * body=blok *] [%while cond body]
|
||||
;~ (glue wss)
|
||||
(jest 'while')
|
||||
parse-expr
|
||||
(jest 'do')
|
||||
parse-blok
|
||||
(jest 'end')
|
||||
==
|
||||
::
|
||||
%+ cook
|
||||
|= [* body=blok * cond=expr] [%repeat body cond]
|
||||
;~ (glue wss)
|
||||
(jest 'repeat')
|
||||
parse-blok
|
||||
(jest 'until')
|
||||
parse-expr
|
||||
==
|
||||
::
|
||||
%+ cook
|
||||
|= [* =label] [%goto label]
|
||||
;~ (glue ws)
|
||||
|
@ -531,6 +552,22 @@
|
|||
"goto "
|
||||
(trip +.stat)
|
||||
==
|
||||
%while
|
||||
%- zing
|
||||
:~
|
||||
"while "
|
||||
(print-expr cond.stat)
|
||||
" do\0a"
|
||||
(print-blok body.stat)
|
||||
==
|
||||
%repeat
|
||||
%- zing
|
||||
:~
|
||||
"repeat\0a"
|
||||
(print-blok body.stat)
|
||||
"until "
|
||||
(print-expr cond.stat)
|
||||
==
|
||||
==
|
||||
:: functioncall
|
||||
::
|
||||
|
|
|
@ -59,3 +59,15 @@ h{key1 = 'Sonmi~451'}
|
|||
goto helli
|
||||
|
||||
break
|
||||
|
||||
while true do
|
||||
break
|
||||
end
|
||||
|
||||
repeat
|
||||
do
|
||||
foo = 9
|
||||
;
|
||||
end
|
||||
until true
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user