: read-until-loop ( handle seps accum -- accum ch )
pick fgetc dup [
pick dupd member-eq?
- [ [ 2drop ] 2dip ] [ over push read-until-loop ] if
+ [ [ 2drop ] 2dip ] [ suffix! read-until-loop ] if
] [
[ 2drop ] 2dip
] if ; inline recursive
: (unescape-string) ( accum str i/f -- accum )
{ sbuf object object } declare
[
- cut-slice [ over push-all ] dip
- rest-slice next-escape [ over push ] dip
+ cut-slice [ append! ] dip
+ rest-slice next-escape [ suffix! ] dip
CHAR: \\ over index (unescape-string)
] [
- over push-all
+ append!
] if* ;
PRIVATE>
: (parse-string) ( accum str -- accum m )
{ sbuf slice } declare
dup [ "\"\\" member? ] find [
- [ cut-slice [ over push-all ] dip rest-slice ] dip
+ [ cut-slice [ append! ] dip rest-slice ] dip
CHAR: " = [
from>>
] [
- next-escape [ over push ] dip (parse-string)
+ next-escape [ suffix! ] dip (parse-string)
] if
] [
"Unterminated string" throw
SYNTAX: <LITERATE
"LITERATE>" parse-multiline-string string-lines [
- <literate-lexer> (parse-lines) over push-all
+ <literate-lexer> (parse-lines) append!
] with-nested-compilation-unit ;
[ appender-for [ each ] dip ] keep like ; inline
: >resizable ( seq -- accum ) ! fixes map-concat "cannot apply call to run-time..."
- [ length ] keep [ new-resizable ] [ over push-all ] bi ;
+ [ length ] keep [ new-resizable ] [ append! ] bi ;
: map-concat ( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )
over empty? [ 2drop { } ] [