The Lambda Lab
/
projects
/
forth.jl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated library code to use IB and QUERY-INPUT.
[forth.jl.git]
/
src
/
lib_3_comments.4th
diff --git
a/src/lib_3_comments.4th
b/src/lib_3_comments.4th
index
a5b695b
..
1c0be39
100644
(file)
--- a/
src/lib_3_comments.4th
+++ b/
src/lib_3_comments.4th
@@
-3,17
+3,17
@@
: ( IMMEDIATE
1 \ allowed nested parens by keeping track of depth
BEGIN
: ( IMMEDIATE
1 \ allowed nested parens by keeping track of depth
BEGIN
- >IN @ #
T
IB @ >= IF \ End of TIB?
- QUERY
\ Get next line
+ >IN @ #IB @ >= IF \ End of TIB?
+ QUERY
-INPUT
\ Get next line
THEN
THEN
-
T
IB >IN @ + @ 1 >IN +!
- DUP [CHAR] ( = IF \ open paren?
+ IB >IN @ + @ 1 >IN +!
+ DUP [CHAR] ( = IF
\ open paren?
DROP \ drop the open paren
1+ \ depth increases
ELSE
DROP \ drop the open paren
1+ \ depth increases
ELSE
- [CHAR] ) = IF
\ close paren?
- 1-
\ depth decreases
+ [CHAR] ) = IF \ close paren?
+ 1- \ depth decreases
THEN
THEN
DUP 0= UNTIL \ continue until we reach matching close paren, depth 0
THEN
THEN
DUP 0= UNTIL \ continue until we reach matching close paren, depth 0