1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-17 07:48:08 +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 ) : (parsec) ( a -- n f )
( apostrophe is ASCII 39 ) ( apostrophe is ASCII 39 )
DUP C@ 39 = NOT IF 0 EXIT THEN ( a 0 ) DUP C@ 39 = OVER 2+ C@ 39 = AND ( a f )
DUP 2+ C@ 39 = NOT IF 0 EXIT THEN ( a 0 ) NOT IF 0 EXIT THEN ( a 0 )
( surrounded by apos, good, return ) ( surrounded by apos, good, return )
1+ C@ 1 ( n 1 ) 1+ C@ 1 ( n 1 )
; ;

View File

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

View File

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

Binary file not shown.