From: Tim Vaughan Date: Thu, 21 Jul 2016 08:29:17 +0000 (+1200) Subject: eatspaces now eats comments X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=scheme.forth.jl.git;a=commitdiff_plain;h=85e14c9d3e9509418125d2a7a6b7fa366a8f31ad eatspaces now eats comments --- diff --git a/scheme.4th b/scheme.4th index 19848b6..72897be 100644 --- a/scheme.4th +++ b/scheme.4th @@ -377,12 +377,27 @@ parse-idx-stack parse-idx-sp ! nextchar [char] ) = or ; +: commentstart? ( -- bool ) + nextchar [char] ; = ; + : eatspaces + + false \ Indicates whether or not we're eating a comment + begin - whitespace? + dup whitespace? or commentstart? or while + dup nextchar '\n' = and if + invert \ Stop eating comment + else + dup false = commentstart? and if + invert \ Begin eating comment + then + then + inc-parse-idx repeat + drop ; : digit? ( -- bool )