fix multi-line ( … ) comments in included files

This commit is contained in:
Jesse D. McDonald 2020-11-11 00:34:21 -06:00
parent ff2d91b66b
commit 676ec83cb9
1 changed files with 8 additions and 5 deletions

View File

@ -1221,6 +1221,10 @@ CREATE EXCEPTION-STACK NULL ,
: PARSE-AREA ( -- c-addr u ) SOURCE >IN @ /STRING ; : PARSE-AREA ( -- c-addr u ) SOURCE >IN @ /STRING ;
\ Placeholder to be replaced before switching to terminal input
DEFER REFILL
' FALSE ' REFILL DEFER!
' UTILITY (DEFINITIONS) ' UTILITY (DEFINITIONS)
: PARSE-EMPTY? ( -- flag ) SOURCE NIP >IN @ = ; : PARSE-EMPTY? ( -- flag ) SOURCE NIP >IN @ = ;
@ -1235,17 +1239,16 @@ CREATE EXCEPTION-STACK NULL ,
: SKIP-SPACES ( "<spaces?>" -- ) : SKIP-SPACES ( "<spaces?>" -- )
BEGIN ▪ PARSE-EMPTY? 0= WHILE ▪ PEEK-CHAR SPACE? WHILE ▪ SKIP-CHAR ▪ REPEAT ; 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) ' FORTH (DEFINITIONS)
\ Comments; ignore all characters until the next EOL or ) character, respectively \ Comments; ignore all characters until the next EOL or ) character, respectively
: \ ( "ccc<eol>" -- ) IMMEDIATE : \ ( "ccc<eol>" -- ) IMMEDIATE
BEGIN PARSE-EMPTY? 0= WHILE NEXT-CHAR LF = UNTIL ; BEGIN PARSE-EMPTY? 0= WHILE NEXT-CHAR LF = UNTIL ;
: ( ( "ccc<closeparen>" -- ) IMMEDIATE : ( ( "ccc<closeparen>" -- ) IMMEDIATE
BEGIN PARSE-EMPTY? 0= WHILE NEXT-CHAR [[ CHAR ) ]] = UNTIL ; BEGIN ENSURE-NONEMPTY WHILE NEXT-CHAR [[ CHAR ) ]] = UNTIL ;
\ Placeholder to be replaced before switching to terminal input
DEFER REFILL
' FALSE ' REFILL DEFER!
\ Skip whitespace; read and return the next word delimited by whitespace \ Skip whitespace; read and return the next word delimited by whitespace
\ The delimiting whitespace character is left in the parse area \ The delimiting whitespace character is left in the parse area