on master help sign in
Accept tabs
commit019aeb2d8622a099bcec23211c727b46fd926753 authoriko <mail@iko.soy> dateWed 15 May 2024, 19:02 (2 years ago) parent8516d6a
3 files changed+50−13
zod/luau/TODO.md+1 zod/luau/lib/lua.hoon+24−13 zod/luau/tests/foo.lua+25
zod/luau/TODO.md+1
@@ -1,3 +1,4 @@
11# Parser
22
33- [ ] functioncall
4+- [ ] any string apart from the basic string with no escapes
zod/luau/lib/lua.hoon+24−13
@@ -18,7 +18,7 @@
1818++ apex
1919 %+ knee *ast
2020 |.
21− %+ ifix [gaw gaw]
21+ %+ ifix [ws ws]
2222 ;~ pose
2323 (cook |=(=blok [%blok blok]) parse-blok)
2424 ==
@@ -151,7 +151,7 @@
151151 |.
152152 %+ cook
153153 |=([* =table *] table)
154− ;~ (glue gaw)
154+ ;~ (glue ws)
155155 (just '{')
156156 parse-field-list
157157 (just '}')
@@ -177,8 +177,8 @@
177177 --
178178 %+ cook
179179 |=([=field-list *] field-list)
180− ;~ (glue gaw)
181− (more (ifix [gaw gaw] field-sep) parse-field)
180+ ;~ (glue ws)
181+ (more (ifix [ws ws] field-sep) parse-field)
182182 (punt field-sep)
183183 ==
184184:: field
@@ -209,7 +209,7 @@
209209 ;~ pose
210210 %+ cook
211211 |=([* key=expr * * val=expr] [%keyed key val])
212− ;~ (glue gaw)
212+ ;~ (glue ws)
213213 (just '[')
214214 parse-expr
215215 (just ']')
@@ -219,7 +219,7 @@
219219 ::
220220 %+ cook
221221 |=([=name * =expr] [%keyed [%string name] expr])
222− ;~ (glue gaw)
222+ ;~ (glue ws)
223223 parse-name
224224 tis
225225 parse-expr
@@ -341,7 +341,7 @@
341341++ parse-exprlist
342342 %+ knee *exprlist
343343 |.
344− %+ most (ifix [gaw gaw] com) parse-expr
344+ %+ most (ifix [ws ws] com) parse-expr
345345:: Var
346346::
347347+$ var
@@ -380,7 +380,7 @@
380380 |= =prefix-expr
381381 %+ cook
382382 |=([* =expr *] [%indexed prefix-expr expr])
383− ;~ (glue gaw)
383+ ;~ (glue ws)
384384 (just '[')
385385 parse-expr
386386 (just ']')
@@ -418,7 +418,7 @@
418418++ parse-varlist
419419 %+ knee *varlist
420420 |.
421− %+ most (ifix [gaw gaw] com) parse-var
421+ %+ most (ifix [ws ws] com) parse-var
422422:: Prefix Expr
423423::
424424+$ prefix-expr
@@ -462,7 +462,7 @@
462462 ::
463463 %+ cook
464464 |=([* =blok *] [%blok blok])
465− ;~ (glue gawn)
465+ ;~ (glue wss)
466466 (jest 'do')
467467 (knee *blok |.(parse-blok))
468468 (jest 'end')
@@ -470,7 +470,7 @@
470470 ::
471471 %+ cook
472472 |=([=varlist * =exprlist] [%asmnt varlist exprlist])
473− ;~ (glue gaw)
473+ ;~ (glue ws)
474474 parse-varlist
475475 (just '=')
476476 parse-exprlist
@@ -502,7 +502,7 @@
502502++ parse-blok
503503 %+ knee *blok
504504 |.
505− (most gawn parse-stat)
505+ (most wss parse-stat)
506506:: Helpers
507507::
508508++ commaed
@@ -510,7 +510,7 @@
510510 ^- tape
511511 %- zing
512512 %+ join "," l
513−++ gawn (cold ~ (plus ;~(pose vul gah)))
513+:: ++ gawn (cold ~ (plus ;~(pose vul gah)))
514514++ parse-name
515515 %+ knee *name
516516 |.
@@ -531,4 +531,15 @@
531531 =/ prev-edge (prev nail)
532532 ?~ q.prev-edge prev-edge
533533 ((cont p.u.q.prev-edge) q.u.q.prev-edge)
534+++ w
535+ ;~ pose
536+ gah
537+ (just '\09')
538+ ==
539+++ ws
540+ %+ cold ~
541+ %- star w
542+++ wss
543+ %+ cold ~
544+ %- plus w
534545--
zod/luau/tests/foo.lua+25
@@ -12,3 +12,28 @@ x = {[hello] = 8, hello = 12}
1212
1313;
1414
15+test_cases = {
16+ { 0x7fffffff, "2147483647" },
17+ { 2147483647, "2147483647" },
18+
19+ { 0xffffffff, "4294967295" },
20+ { 4294967295, "4294967295" },
21+
22+ { 0x7fffffffffffffff, "9.2233720368548e+18" },
23+ { 9223372036854775807, "9.2233720368548e+18" },
24+
25+ { 0xffffffffffffffff, "1.844674407371e+19" },
26+ { 18446744073709551615, "1.844674407371e+19" },
27+
28+ { 0x100000000, "4294967296" },
29+ { 4294967296, "4294967296" },
30+
31+ { 0x100000000000, "17592186044416" },
32+ { 17592186044416, "17592186044416" },
33+
34+ { 0x80000000, "2147483648" },
35+ { 2147483648, "2147483648" },
36+
37+ { 0x800000000000, "1.4073748835533e+14" },
38+ { 140737488355328, "1.4073748835533e+14" },
39+}