on master help sign in
Added hex ints
c0191b6iko
zod/luau/TODO.md+1
@@ -2,3 +2,4 @@
2
2
3- [ ] functioncall
3- [ ] functioncall
4- [ ] any string apart from the basic string with no escapes
4- [ ] 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 @@
310::
310::
311+$ numeral
311+$ numeral
312 $%
312 $%
313− [%int @s]
313+ [%int @u]
314 :: [%float @rd]
314 :: [%float @rd]
315 ==
315 ==
316++ parse-numeral
316++ parse-numeral
@@ -318,10 +318,14 @@
318 |.
318 |.
319 ;~ pose
319 ;~ pose
320 %+ cook
320 %+ cook
321− |= [is-neg=(unit *) x=@]
322− [%int (new:si ?=(~ is-neg) x)]
321+ |= x=@u [%int x]
323− ;~ plug
322+ ;~ pose
323+ ;~ pfix
324− (punt (just '-'))
324+ (just '0')
325+ (mask "xX")
326+ hex
327+ ==
328+ ::
325 (bass 10 (plus dit))
329 (bass 10 (plus dit))
326 ==
330 ==
327 ==
331 ==
@@ -329,7 +333,7 @@
329 |= [num=numeral]
333 |= [num=numeral]
330 ^- tape
334 ^- tape
331 ?- -.num
335 ?- -.num
332− %int (show-s +.num)
336+ %int (show-u +.num)
333 ==
337 ==
334:: exprlist
338:: exprlist
335::
339::
@@ -524,6 +528,8 @@
524 ;~(plug name-fst-char (star name-char))
528 ;~(plug name-fst-char (star name-char))
525++ show-s
529++ show-s
526 |=(s=@s `tape`[?:((syn:si s) %$ '-') (slag 2 (scow %ui (abs:si s)))])
530 |=(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)))
527++ bind
533++ bind
528 |* =mold
534 |* =mold
529 |* [prev=rule cont=$-(mold rule)]
535 |* [prev=rule cont=$-(mold rule)]