mirror of
https://github.com/ilyakooo0/luau.git
synced 2024-10-05 14:47:22 +03:00
Compare commits
2 Commits
019aeb2d86
...
1bea1efb8f
Author | SHA1 | Date | |
---|---|---|---|
1bea1efb8f | |||
c0191b63dd |
@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
- [ ] functioncall
|
- [ ] functioncall
|
||||||
- [ ] any string apart from the basic string with no escapes
|
- [ ] any string apart from the basic string with no escapes
|
||||||
|
- [ ] check if int fits in int or make it a float
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
++ parse-expr-list
|
++ parse-expr-list
|
||||||
%+ knee *(interlist binop expr)
|
%+ knee *(interlist binop expr)
|
||||||
|.
|
|.
|
||||||
%+ parse-interlist parse-binop parse-atomic-expr
|
%+ parse-interlist (ifix [ws ws] parse-binop) parse-atomic-expr
|
||||||
:: TODO: This is mock and should take operator priority into account.
|
:: TODO: This is mock and should take operator priority into account.
|
||||||
::
|
::
|
||||||
++ process-expr-list
|
++ process-expr-list
|
||||||
@ -310,18 +310,26 @@
|
|||||||
::
|
::
|
||||||
+$ numeral
|
+$ numeral
|
||||||
$%
|
$%
|
||||||
[%int @s]
|
[%int @u]
|
||||||
:: [%float @rd]
|
[%float @rd]
|
||||||
==
|
==
|
||||||
++ parse-numeral
|
++ parse-numeral
|
||||||
%+ knee *numeral
|
%+ knee *numeral
|
||||||
|.
|
|.
|
||||||
;~ pose
|
;~ pose
|
||||||
%+ cook
|
%+ cook
|
||||||
|= [is-neg=(unit *) x=@]
|
|= x=@rd [%float x]
|
||||||
[%int (new:si ?=(~ is-neg) x)]
|
parse-float
|
||||||
;~ plug
|
::
|
||||||
(punt (just '-'))
|
%+ cook
|
||||||
|
|= x=@u [%int x]
|
||||||
|
;~ pose
|
||||||
|
;~ pfix
|
||||||
|
(just '0')
|
||||||
|
(mask "xX")
|
||||||
|
hex
|
||||||
|
==
|
||||||
|
::
|
||||||
(bass 10 (plus dit))
|
(bass 10 (plus dit))
|
||||||
==
|
==
|
||||||
==
|
==
|
||||||
@ -329,7 +337,8 @@
|
|||||||
|= [num=numeral]
|
|= [num=numeral]
|
||||||
^- tape
|
^- tape
|
||||||
?- -.num
|
?- -.num
|
||||||
%int (show-s +.num)
|
%int (show-u +.num)
|
||||||
|
%float (show-float +.num)
|
||||||
==
|
==
|
||||||
:: exprlist
|
:: exprlist
|
||||||
::
|
::
|
||||||
@ -510,7 +519,6 @@
|
|||||||
^- tape
|
^- tape
|
||||||
%- zing
|
%- zing
|
||||||
%+ join "," l
|
%+ join "," l
|
||||||
:: ++ gawn (cold ~ (plus ;~(pose vul gah)))
|
|
||||||
++ parse-name
|
++ parse-name
|
||||||
%+ knee *name
|
%+ knee *name
|
||||||
|.
|
|.
|
||||||
@ -524,6 +532,8 @@
|
|||||||
;~(plug name-fst-char (star name-char))
|
;~(plug name-fst-char (star name-char))
|
||||||
++ show-s
|
++ show-s
|
||||||
|=(s=@s `tape`[?:((syn:si s) %$ '-') (slag 2 (scow %ui (abs:si s)))])
|
|=(s=@s `tape`[?:((syn:si s) %$ '-') (slag 2 (scow %ui (abs:si s)))])
|
||||||
|
++ show-u
|
||||||
|
|=(u=@u `tape`(slag 2 (scow %ui u)))
|
||||||
++ bind
|
++ bind
|
||||||
|* =mold
|
|* =mold
|
||||||
|* [prev=rule cont=$-(mold rule)]
|
|* [prev=rule cont=$-(mold rule)]
|
||||||
@ -542,4 +552,43 @@
|
|||||||
++ wss
|
++ wss
|
||||||
%+ cold ~
|
%+ cold ~
|
||||||
%- plus w
|
%- plus w
|
||||||
--
|
++ parse-float
|
||||||
|
%+ knee *@rd
|
||||||
|
|.
|
||||||
|
%+ cook ryld
|
||||||
|
%+ cook royl-cell:so
|
||||||
|
%+ sear
|
||||||
|
|= [int=@ frac=(unit [@ @]) exp=(unit [exp-sign=? exp=@])]
|
||||||
|
?: ?=([~ ~] [frac exp]) ~
|
||||||
|
%- some
|
||||||
|
:*
|
||||||
|
%d
|
||||||
|
&
|
||||||
|
int
|
||||||
|
(fall frac [0 0])
|
||||||
|
(fall exp [& 0])
|
||||||
|
==
|
||||||
|
=/ moo
|
||||||
|
|= a=tape
|
||||||
|
:- (lent a)
|
||||||
|
(scan a (bass 10 (plus sid:ab)))
|
||||||
|
;~ plug
|
||||||
|
;~ plug
|
||||||
|
dim:ag
|
||||||
|
::
|
||||||
|
(punt ;~(pfix dot (cook moo (plus (shim '0' '9')))))
|
||||||
|
::
|
||||||
|
%- punt
|
||||||
|
;~ pfix
|
||||||
|
(mask "eE")
|
||||||
|
;~(plug ;~(pose (cold | hep) (easy &)) dim:ag)
|
||||||
|
==
|
||||||
|
==
|
||||||
|
==
|
||||||
|
++ show-float
|
||||||
|
|= x=@rd
|
||||||
|
^- tape
|
||||||
|
%- r-co:co
|
||||||
|
%- rlyd
|
||||||
|
x
|
||||||
|
--
|
||||||
|
@ -4,36 +4,41 @@ baz = bar[nil]
|
|||||||
baz = bar
|
baz = bar
|
||||||
|
|
||||||
i = 3
|
i = 3
|
||||||
i, a[i] = i+1, 20>>9
|
i, a[i] = i + 1, 20 >> 9
|
||||||
|
|
||||||
hello = "hellodkndjвговшов"
|
hello = "hellodkndjвговшов"
|
||||||
|
|
||||||
x = {[hello] = 8, hello = 12}
|
x = { [hello] = 8, hello = 12 }
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
test_cases = {
|
test_cases = {
|
||||||
{ 0x7fffffff, "2147483647" },
|
{ 0x7fffffff, "2147483647" },
|
||||||
{ 2147483647, "2147483647" },
|
{ 2147483647, "2147483647" },
|
||||||
|
|
||||||
{ 0xffffffff, "4294967295" },
|
{ 0xffffffff, "4294967295" },
|
||||||
{ 4294967295, "4294967295" },
|
{ 4294967295, "4294967295" },
|
||||||
|
|
||||||
{ 0x7fffffffffffffff, "9.2233720368548e+18" },
|
{ 0x7fffffffffffffff, "9.2233720368548e+18" },
|
||||||
{ 9223372036854775807, "9.2233720368548e+18" },
|
{ 9223372036854775807, "9.2233720368548e+18" },
|
||||||
|
|
||||||
{ 0xffffffffffffffff, "1.844674407371e+19" },
|
{ 0xffffffffffffffff, "1.844674407371e+19" },
|
||||||
{ 18446744073709551615, "1.844674407371e+19" },
|
{ 18446744073709551615, "1.844674407371e+19" },
|
||||||
|
|
||||||
{ 0x100000000, "4294967296" },
|
{ 0x100000000, "4294967296" },
|
||||||
{ 4294967296, "4294967296" },
|
{ 4294967296, "4294967296" },
|
||||||
|
|
||||||
{ 0x100000000000, "17592186044416" },
|
{ 0x100000000000, "17592186044416" },
|
||||||
{ 17592186044416, "17592186044416" },
|
{ 17592186044416, "17592186044416" },
|
||||||
|
|
||||||
{ 0x80000000, "2147483648" },
|
{ 0x80000000, "2147483648" },
|
||||||
{ 2147483648, "2147483648" },
|
{ 2147483648, "2147483648" },
|
||||||
|
|
||||||
{ 0x800000000000, "1.4073748835533e+14" },
|
{ 0x800000000000, "1.4073748835533e+14" },
|
||||||
{ 140737488355328, "1.4073748835533e+14" },
|
{ 140737488355328, "1.4073748835533e+14" },
|
||||||
|
}
|
||||||
|
|
||||||
|
foo = {
|
||||||
|
3.0, 3.1416, 314.16e-2, 0.31416E1, 34e1,
|
||||||
|
0x0.1E, 0xA23p-4, 0X1.921FB54442D18P+1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user