diff --git a/core/lexer/lexer.factor b/core/lexer/lexer.factor index 1e9c7a28c2..53f2a9ddee 100644 --- a/core/lexer/lexer.factor +++ b/core/lexer/lexer.factor @@ -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 ; diff --git a/core/parser/parser.factor b/core/parser/parser.factor index a212868dd3..266f4c77ec 100644 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -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 ]