Add a better word-not-found handler

This commit is contained in:
2026-03-01 19:52:27 +00:00
parent acaf198fae
commit ee4c0d1d8c

View File

@@ -210,6 +210,30 @@ CHAR . EMIT
CHAR . EMIT
\ A better word-not-found handler
: ANY-RX? RXHEAD AC@ RXTAIL AC@ <> ;
: WNF-HANDLER
." Unknown word: "
WORDBUF SWAP TYPE CR
STATE @ IF
\ Remove incomplete definition and switch back to interpret mode
LATEST @ HERE !
LATEST @ @ LATEST !
[COMPILE] [
THEN
\ We only consume to the next newline if there is RX data available,
\ because if the offending word was at the end of the line then the
\ newline would have already been consumed by WORD.
ANY-RX? IF BEGIN KEY 10 = UNTIL THEN
QUIT
;
' WNF-HANDLER TO WNFHOOK
CHAR . EMIT
\ Version number
: VERSION-MAJOR 0 ;