mirror of
https://github.com/ilyakooo0/luau.git
synced 2024-10-03 21:48:26 +03:00
Compare commits
2 Commits
9054a6736b
...
907ae4d250
Author | SHA1 | Date | |
---|---|---|---|
907ae4d250 | |||
996ab8bc20 |
@ -465,6 +465,7 @@
|
||||
[%blok blok]
|
||||
[%asmnt varlist exprlist]
|
||||
[%label label]
|
||||
[%func-call functioncall]
|
||||
[%empty ~]
|
||||
==
|
||||
++ parse-stat
|
||||
@ -492,6 +493,10 @@
|
||||
(just '=')
|
||||
parse-exprlist
|
||||
==
|
||||
::
|
||||
%+ cook
|
||||
|= =functioncall [%func-call functioncall]
|
||||
parse-functioncall
|
||||
==
|
||||
++ print-stat
|
||||
|= [=stat]
|
||||
@ -507,7 +512,88 @@
|
||||
(commaed (turn +>.stat print-expr))
|
||||
==
|
||||
%label (print-label +.stat)
|
||||
%func-call (print-functioncall +.stat)
|
||||
==
|
||||
:: functioncall
|
||||
::
|
||||
+$ functioncall
|
||||
$%
|
||||
[%call func=prefix-expr =args]
|
||||
[%method obj=prefix-expr method=name =args]
|
||||
==
|
||||
++ print-functioncall
|
||||
|= call=functioncall
|
||||
^- tape
|
||||
?- -.call
|
||||
%call
|
||||
%- zing
|
||||
:~
|
||||
(print-prefix-expr func.call)
|
||||
(print-args args.call)
|
||||
==
|
||||
%method
|
||||
%- zing
|
||||
:~
|
||||
(print-prefix-expr obj.call)
|
||||
":"
|
||||
(trip method.call)
|
||||
(print-args args.call)
|
||||
==
|
||||
==
|
||||
++ parse-functioncall
|
||||
%+ knee *functioncall
|
||||
|.
|
||||
;~ pose
|
||||
%+ cook
|
||||
|= [func=prefix-expr =args] [%call func args]
|
||||
;~ (glue ws)
|
||||
parse-prefix-expr
|
||||
parse-args
|
||||
==
|
||||
::
|
||||
%+ cook
|
||||
|= [obj=prefix-expr * method=name =args]
|
||||
[%method obj method args]
|
||||
;~ (glue ws)
|
||||
parse-prefix-expr
|
||||
(just ':')
|
||||
parse-name
|
||||
parse-args
|
||||
==
|
||||
==
|
||||
:: args
|
||||
::
|
||||
+$ args exprlist
|
||||
++ print-args
|
||||
|= =args
|
||||
^- tape
|
||||
%- zing
|
||||
:~
|
||||
"("
|
||||
(print-exprlist args)
|
||||
")"
|
||||
==
|
||||
++ parse-args
|
||||
%+ knee *args
|
||||
|.
|
||||
;~ pose
|
||||
%+ cook
|
||||
|= [* =exprlist *] exprlist
|
||||
;~ (glue ws)
|
||||
(just '(')
|
||||
parse-exprlist
|
||||
(just ')')
|
||||
==
|
||||
::
|
||||
%+ cook
|
||||
|= =table ~[[%table table]]
|
||||
parse-table
|
||||
::
|
||||
%+ cook
|
||||
|= =string ~[[%string string]]
|
||||
parse-string
|
||||
==
|
||||
::
|
||||
:: label
|
||||
::
|
||||
+$ label name
|
||||
@ -532,17 +618,51 @@
|
||||
==
|
||||
:: Blok
|
||||
::
|
||||
+$ blok (lest stat)
|
||||
+$ blok [body=(lest stat) ret=(unit ret)]
|
||||
++ print-blok
|
||||
|= [=blok]
|
||||
^- tape
|
||||
%- zing
|
||||
%+ join "\0a"
|
||||
(turn blok print-stat)
|
||||
%+ weld
|
||||
(turn body.blok print-stat)
|
||||
?~ ret.blok ~
|
||||
~[(print-ret u.ret.blok)]
|
||||
++ parse-blok
|
||||
%+ knee *blok
|
||||
|.
|
||||
(most wss parse-stat)
|
||||
;~ plug
|
||||
(most wss parse-stat)
|
||||
::
|
||||
%- punt
|
||||
;~ pfix
|
||||
wss
|
||||
parse-ret
|
||||
==
|
||||
==
|
||||
:: ret
|
||||
::
|
||||
+$ ret exprlist
|
||||
++ print-ret
|
||||
|= =ret
|
||||
^- tape
|
||||
%- zing
|
||||
:~
|
||||
"return "
|
||||
(print-exprlist ret)
|
||||
==
|
||||
++ parse-ret
|
||||
%+ knee *ret
|
||||
|.
|
||||
%+ cook
|
||||
|= [[* =exprlist] *] exprlist
|
||||
;~ plug
|
||||
;~ (glue wss)
|
||||
(jest 'return')
|
||||
parse-exprlist
|
||||
==
|
||||
(punt (just ';'))
|
||||
==
|
||||
:: Helpers
|
||||
::
|
||||
++ commaed
|
||||
|
@ -44,3 +44,14 @@ foo = {
|
||||
3.0, 3.1416, 314.16e-2, 0.31416E1, 34e1,
|
||||
0x0.1E, 0xA23p-4, 0xA23p-4, 0X1.921FB54442D18P+1, 0x1.fp10
|
||||
}
|
||||
|
||||
do
|
||||
foo = 1
|
||||
return 8, foo;
|
||||
end
|
||||
|
||||
print('the way of the future')
|
||||
|
||||
print 'hello'
|
||||
|
||||
h{key1 = 'Sonmi~451'}
|
||||
|
Loading…
Reference in New Issue
Block a user