From 676ec83cb90400adaca8b605d5e82cdd04ff4e1a Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Wed, 11 Nov 2020 00:34:21 -0600 Subject: [PATCH] =?UTF-8?q?fix=20multi-line=20(=20=E2=80=A6=20)=20comments?= =?UTF-8?q?=20in=20included=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- startup.4th | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/startup.4th b/startup.4th index 9f006f4..c0e86cc 100644 --- a/startup.4th +++ b/startup.4th @@ -1221,6 +1221,10 @@ CREATE EXCEPTION-STACK NULL , : PARSE-AREA ( -- c-addr u ) SOURCE >IN @ /STRING ; +\ Placeholder to be replaced before switching to terminal input +DEFER REFILL +' FALSE ' REFILL DEFER! + ' UTILITY (DEFINITIONS) : PARSE-EMPTY? ( -- flag ) SOURCE NIP >IN @ = ; @@ -1235,17 +1239,16 @@ CREATE EXCEPTION-STACK NULL , : SKIP-SPACES ( "" -- ) BEGIN ▪ PARSE-EMPTY? 0= WHILE ▪ PEEK-CHAR SPACE? WHILE ▪ SKIP-CHAR ▪ REPEAT ; +: ENSURE-NONEMPTY ( -- f=eof ) + BEGIN PARSE-EMPTY? ?0DUP WHILE REFILL 0= ?DUP UNTIL 0= ; + ' FORTH (DEFINITIONS) \ Comments; ignore all characters until the next EOL or ) character, respectively : \ ( "ccc" -- ) IMMEDIATE BEGIN PARSE-EMPTY? 0= WHILE NEXT-CHAR LF = UNTIL ; : ( ( "ccc" -- ) IMMEDIATE - BEGIN PARSE-EMPTY? 0= WHILE NEXT-CHAR [[ CHAR ) ]] = UNTIL ; - -\ Placeholder to be replaced before switching to terminal input -DEFER REFILL -' FALSE ' REFILL DEFER! + BEGIN ENSURE-NONEMPTY WHILE NEXT-CHAR [[ CHAR ) ]] = UNTIL ; \ Skip whitespace; read and return the next word delimited by whitespace \ The delimiting whitespace character is left in the parse area