From 85e14c9d3e9509418125d2a7a6b7fa366a8f31ad Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Thu, 21 Jul 2016 20:29:17 +1200 Subject: [PATCH] eatspaces now eats comments --- scheme.4th | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 ) -- 2.20.1