1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 09:38:06 +11:00

Optimize parsing words

This commit is contained in:
Virgil Dupras 2020-05-02 20:32:20 -04:00
parent 931c812394
commit 8009270e79
4 changed files with 4 additions and 6 deletions

View File

@ -3,8 +3,8 @@
: (parsec) ( a -- n f )
( apostrophe is ASCII 39 )
DUP C@ 39 = NOT IF 0 EXIT THEN ( a 0 )
DUP 2+ C@ 39 = NOT IF 0 EXIT THEN ( a 0 )
DUP C@ 39 = OVER 2+ C@ 39 = AND ( a f )
NOT IF 0 EXIT THEN ( a 0 )
( surrounded by apos, good, return )
1+ C@ 1 ( n 1 )
;

View File

@ -2,8 +2,7 @@
: _ ( c -- n )
( '0' is ASCII 48 )
48 -
DUP 0< IF EXIT THEN ( bad )
DUP 10 < IF EXIT THEN ( good )
DUP 0< ( bad ) OVER 10 < ( good ) OR IF EXIT THEN
( 'a' is ASCII 97. 59 = 97 - 48 )
49 -
DUP 0< IF EXIT THEN ( bad )

View File

@ -2,8 +2,7 @@
: _ ( c -- n )
( '0' is ASCII 48 )
48 -
DUP 0< IF EXIT THEN ( bad )
DUP 2 < IF EXIT THEN ( good )
DUP 0< ( bad ) OVER 2 < ( good ) OR IF EXIT THEN
( bad )
255 -
;

Binary file not shown.