use suffix! and append!.

db4
John Benediktsson 2014-12-03 11:37:34 -08:00
parent 49270c2ac6
commit 6fd908da40
4 changed files with 8 additions and 8 deletions

View File

@ -43,7 +43,7 @@ M: c-reader stream-read1
: read-until-loop ( handle seps accum -- accum ch ) : read-until-loop ( handle seps accum -- accum ch )
pick fgetc dup [ pick fgetc dup [
pick dupd member-eq? pick dupd member-eq?
[ [ 2drop ] 2dip ] [ over push read-until-loop ] if [ [ 2drop ] 2dip ] [ suffix! read-until-loop ] if
] [ ] [
[ 2drop ] 2dip [ 2drop ] 2dip
] if ; inline recursive ] if ; inline recursive

View File

@ -54,11 +54,11 @@ name>char-hook [
: (unescape-string) ( accum str i/f -- accum ) : (unescape-string) ( accum str i/f -- accum )
{ sbuf object object } declare { sbuf object object } declare
[ [
cut-slice [ over push-all ] dip cut-slice [ append! ] dip
rest-slice next-escape [ over push ] dip rest-slice next-escape [ suffix! ] dip
CHAR: \\ over index (unescape-string) CHAR: \\ over index (unescape-string)
] [ ] [
over push-all append!
] if* ; ] if* ;
PRIVATE> PRIVATE>
@ -73,11 +73,11 @@ PRIVATE>
: (parse-string) ( accum str -- accum m ) : (parse-string) ( accum str -- accum m )
{ sbuf slice } declare { sbuf slice } declare
dup [ "\"\\" member? ] find [ dup [ "\"\\" member? ] find [
[ cut-slice [ over push-all ] dip rest-slice ] dip [ cut-slice [ append! ] dip rest-slice ] dip
CHAR: " = [ CHAR: " = [
from>> from>>
] [ ] [
next-escape [ over push ] dip (parse-string) next-escape [ suffix! ] dip (parse-string)
] if ] if
] [ ] [
"Unterminated string" throw "Unterminated string" throw

View File

@ -21,5 +21,5 @@ M: literate-lexer skip-blank
SYNTAX: <LITERATE SYNTAX: <LITERATE
"LITERATE>" parse-multiline-string string-lines [ "LITERATE>" parse-multiline-string string-lines [
<literate-lexer> (parse-lines) over push-all <literate-lexer> (parse-lines) append!
] with-nested-compilation-unit ; ] with-nested-compilation-unit ;

View File

@ -173,7 +173,7 @@ PRIVATE>
[ appender-for [ each ] dip ] keep like ; inline [ appender-for [ each ] dip ] keep like ; inline
: >resizable ( seq -- accum ) ! fixes map-concat "cannot apply call to run-time..." : >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 ) : map-concat ( ... seq quot: ( ... elt -- ... newelt ) -- ... newseq )
over empty? [ 2drop { } ] [ over empty? [ 2drop { } ] [