modern: confusing algorithm, add comments
parent
155171b828
commit
2c6d958030
|
@ -445,6 +445,7 @@ DEFER: lex-factor-top*
|
||||||
dup section-open? [ read-acute ] when
|
dup section-open? [ read-acute ] when
|
||||||
] }
|
] }
|
||||||
|
|
||||||
|
! Two cases: zero width slice if we found whitespace, otherwise token
|
||||||
{ char: \s [ read-token-or-whitespace-top ] }
|
{ char: \s [ read-token-or-whitespace-top ] }
|
||||||
{ char: \r [ read-token-or-whitespace-top ] }
|
{ char: \r [ read-token-or-whitespace-top ] }
|
||||||
{ char: \n [ read-token-or-whitespace-top ] }
|
{ char: \n [ read-token-or-whitespace-top ] }
|
||||||
|
|
|
@ -97,7 +97,8 @@ ERROR: unexpected-eof string n expected ;
|
||||||
] when ;
|
] when ;
|
||||||
|
|
||||||
|
|
||||||
! Takes at least one character if not whitespace
|
! Whitespace is either found immediately, returning a zero-width slice
|
||||||
|
! OR we find it at the end of a token
|
||||||
:: slice-til-either ( string n tokens -- string n'/f slice/f ch/f )
|
:: slice-til-either ( string n tokens -- string n'/f slice/f ch/f )
|
||||||
n [
|
n [
|
||||||
string n [ tokens member? ] find-from'
|
string n [ tokens member? ] find-from'
|
||||||
|
|
Loading…
Reference in New Issue