modern: the looping is tricky...this version is correct

modern-harvey2
Doug Coleman 2017-09-04 11:47:57 -05:00
parent d8d7c0cd3c
commit 0e1eb52c4c
1 changed files with 4 additions and 2 deletions

View File

@ -218,9 +218,11 @@ ERROR: no-backslash-payload n string slice ;
] when ;
! If the slice is 0 width, we stopped on whitespace.
! Advance the index and read again somewhere else!
! Advance the index and read again!
: read-token-or-whitespace ( n string slice -- n' string slice/f )
dup length 0 = [ [ 1 + ] 2dip ] when ;
dup length 0 = [
[ 1 + ] 2dip drop lex-factor
] when ;
ERROR: mismatched-terminator n string slice ;
: read-terminator ( n string slice -- n' string slice ) ;