lexer, parser: Rename unexpected-eof.

db4
Doug Coleman 2013-03-23 21:35:50 -07:00
parent aafc2a6190
commit 2d9a15c7c1
2 changed files with 5 additions and 4 deletions

View File

@ -108,9 +108,10 @@ M: lexer skip-word ( lexer -- )
PREDICATE: unexpected-eof < unexpected got>> not ;
: unexpected-eof ( word -- * ) f unexpected ;
: throw-unexpected-eof ( word -- * ) f unexpected ;
: scan-token ( -- str ) (scan-token) [ "token" unexpected-eof ] unless* ;
: scan-token ( -- str )
(scan-token) [ "token" throw-unexpected-eof ] unless* ;
: expect ( token -- )
scan-token 2dup = [ 2drop ] [ unexpected ] if ;

View File

@ -63,7 +63,7 @@ ERROR: number-expected ;
(scan-token) dup [ parse-datum ] when ;
: scan-datum ( -- word/number )
(scan-datum) [ \ word unexpected-eof ] unless* ;
(scan-datum) [ \ word throw-unexpected-eof ] unless* ;
: scan-word ( -- word )
(scan-token) parse-word ;
@ -106,7 +106,7 @@ ERROR: staging-violation word ;
: parse-until-step ( accum end -- accum ? )
(scan-datum) {
{ [ 2dup eq? ] [ 2drop f ] }
{ [ dup not ] [ drop unexpected-eof t ] }
{ [ dup not ] [ drop throw-unexpected-eof t ] }
{ [ dup delimiter? ] [ unexpected t ] }
{ [ dup parsing-word? ] [ nip execute-parsing t ] }
[ pick push drop t ]