on master help sign in
Added hex ints
commitc0191b63dd30879d6358911bc045f6d240d798aa authoriko <mail@iko.soy> dateWed 15 May 2024, 23:02 (2 years ago) parent019aeb2
2 files changed+13−6
zod/luau/TODO.md+1 zod/luau/lib/lua.hoon+12−6
zod/luau/TODO.md+1
@@ -2,3 +2,4 @@
22
33- [ ] functioncall
44- [ ] any string apart from the basic string with no escapes
5+- [ ] check if int fits in int or make it a float
zod/luau/lib/lua.hoon+12−6
@@ -310,7 +310,7 @@
310310::
311311+$ numeral
312312 $%
313− [%int @s]
313+ [%int @u]
314314 :: [%float @rd]
315315 ==
316316++ parse-numeral
@@ -318,10 +318,14 @@
318318 |.
319319 ;~ pose
320320 %+ cook
321− |= [is-neg=(unit *) x=@]
322− [%int (new:si ?=(~ is-neg) x)]
323− ;~ plug
324− (punt (just '-'))
321+ |= x=@u [%int x]
322+ ;~ pose
323+ ;~ pfix
324+ (just '0')
325+ (mask "xX")
326+ hex
327+ ==
328+ ::
325329 (bass 10 (plus dit))
326330 ==
327331 ==
@@ -329,7 +333,7 @@
329333 |= [num=numeral]
330334 ^- tape
331335 ?- -.num
332− %int (show-s +.num)
336+ %int (show-u +.num)
333337 ==
334338:: exprlist
335339::
@@ -524,6 +528,8 @@
524528 ;~(plug name-fst-char (star name-char))
525529++ show-s
526530 |=(s=@s `tape`[?:((syn:si s) %$ '-') (slag 2 (scow %ui (abs:si s)))])
531+++ show-u
532+ |=(u=@u `tape`(slag 2 (scow %ui u)))
527533++ bind
528534 |* =mold
529535 |* [prev=rule cont=$-(mold rule)]