The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
af4ada6
)
eatspaces now eats comments
author
Tim Vaughan
<tgvaughan@gmail.com>
Thu, 21 Jul 2016 08:29:17 +0000
(20:29 +1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Thu, 21 Jul 2016 08:29:17 +0000
(20:29 +1200)
scheme.4th
patch
|
blob
|
history
diff --git
a/scheme.4th
b/scheme.4th
index
19848b6
..
72897be
100644
(file)
--- 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 )