mirror of
https://github.com/ilyakooo0/luau.git
synced 2024-10-03 21:48:26 +03:00
Compare commits
2 Commits
907ae4d250
...
ad74107a2c
Author | SHA1 | Date | |
---|---|---|---|
ad74107a2c | |||
4ed8acbbb1 |
@ -3,3 +3,4 @@
|
||||
- [ ] functioncall
|
||||
- [ ] any string apart from the basic string with no escapes
|
||||
- [ ] check if int fits in int or make it a float
|
||||
- [ ] strip out comments before parsing
|
||||
|
@ -465,7 +465,11 @@
|
||||
[%blok blok]
|
||||
[%asmnt varlist exprlist]
|
||||
[%label label]
|
||||
[%goto label]
|
||||
[%func-call functioncall]
|
||||
[%while cond=expr body=blok]
|
||||
[%repeat body=blok cond=expr]
|
||||
[%break ~]
|
||||
[%empty ~]
|
||||
==
|
||||
++ parse-stat
|
||||
@ -474,6 +478,34 @@
|
||||
;~ pose
|
||||
(cold [%empty ~] (just ';'))
|
||||
::
|
||||
(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)
|
||||
(jest 'goto')
|
||||
parse-name
|
||||
==
|
||||
::
|
||||
%+ cook
|
||||
|= =label [%label label]
|
||||
parse-label
|
||||
@ -513,6 +545,29 @@
|
||||
==
|
||||
%label (print-label +.stat)
|
||||
%func-call (print-functioncall +.stat)
|
||||
%break "break"
|
||||
%goto
|
||||
%- zing
|
||||
:~
|
||||
"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
|
||||
::
|
||||
|
@ -55,3 +55,19 @@ print('the way of the future')
|
||||
print 'hello'
|
||||
|
||||
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