Added hex ints

This commit is contained in:
iko 2024-05-15 23:02:51 +03:00
parent 019aeb2d86
commit c0191b63dd
Signed by untrusted user: iko
GPG Key ID: 82C257048D1026F2
2 changed files with 13 additions and 6 deletions

View File

@ -2,3 +2,4 @@
- [ ] functioncall
- [ ] any string apart from the basic string with no escapes
- [ ] check if int fits in int or make it a float

View File

@ -310,7 +310,7 @@
::
+$ numeral
$%
[%int @s]
[%int @u]
:: [%float @rd]
==
++ parse-numeral
@ -318,10 +318,14 @@
|.
;~ pose
%+ cook
|= [is-neg=(unit *) x=@]
[%int (new:si ?=(~ is-neg) x)]
;~ plug
(punt (just '-'))
|= x=@u [%int x]
;~ pose
;~ pfix
(just '0')
(mask "xX")
hex
==
::
(bass 10 (plus dit))
==
==
@ -329,7 +333,7 @@
|= [num=numeral]
^- tape
?- -.num
%int (show-s +.num)
%int (show-u +.num)
==
:: exprlist
::
@ -524,6 +528,8 @@
;~(plug name-fst-char (star name-char))
++ show-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
|* =mold
|* [prev=rule cont=$-(mold rule)]