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 - [ ] 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

View File

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