1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-26 15:08:05 +11:00
collapseos/blk/357
Virgil Dupras d8a6456206 (parsed): fix crash on parsing non-decimal staring with '-'
The address returned in the error condition would be off by one.
2020-05-25 21:15:07 -04:00

9 lines
325 B
Plaintext

: (parsed) ( a -- n f )
C@+ OVER C@ 0 ( a len firstchar startat )
SWAP '-' = IF 1+ THEN ( a len startat )
0 ROT ROT ( len ) ( startat ) DO ( a r )
OVER I + C@ ( a r c ) _pdacc ( a r f )
IF DROP 1- 0 UNLOOP EXIT THEN LOOP ( a r )
( negate if needed )
SWAP C@ '-' = IF 0 -^ THEN 1 ( r 1 ) ;