Add support for multi-line ( comments
[pforth] / fth / file.fth
index b71edc5..6b0db20 100644 (file)
@@ -61,6 +61,16 @@ create (LINE-TERMINATOR) \n c,
     0 2r> + c!        ( )
 ;
 
     0 2r> + c!        ( )
 ;
 
+: MULTI-LINE-COMMENT ( "comment<rparen>" -- )
+    BEGIN
+        >in @ ')' parse         ( >in c-addr len )
+        nip + >in @ =           ( delimiter-not-found? )
+    WHILE                       ( )
+        refill 0= IF EXIT THEN  ( )
+    REPEAT
+
+;
+
 }private
 
 \ This treats \n, \r\n, and \r as line terminator.  Reading is done
 }private
 
 \ This treats \n, \r\n, and \r as line terminator.  Reading is done
@@ -108,4 +118,13 @@ create (LINE-TERMINATOR) \n c,
     THEN
 ;
 
     THEN
 ;
 
+: (  ( "comment<rparen>"  -- )
+    source-id
+    CASE
+        -1 OF postpone ( ENDOF
+        0  OF postpone ( ENDOF
+        multi-line-comment
+    ENDCASE
+; immediate
+
 privatize
 privatize