From 9af12d96cf2078a19564270ea4e875f88967686b Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 5 Sep 2008 18:56:35 -0500 Subject: [PATCH] left-trim -> trim-left --- basis/checksums/sha1/sha1.factor | 2 +- basis/compiler/tree/normalization/normalization.factor | 2 +- basis/http/client/client.factor | 2 +- basis/http/server/static/static.factor | 4 ++-- basis/io/monitors/monitors-tests.factor | 4 ++-- basis/io/windows/nt/files/files-tests.factor | 4 ++-- basis/io/windows/nt/files/files.factor | 2 +- basis/peg/peg.factor | 9 +-------- basis/unicode/collation/collation.factor | 2 +- 9 files changed, 12 insertions(+), 19 deletions(-) diff --git a/basis/checksums/sha1/sha1.factor b/basis/checksums/sha1/sha1.factor index 6427e0e8eb..ab813d529b 100755 --- a/basis/checksums/sha1/sha1.factor +++ b/basis/checksums/sha1/sha1.factor @@ -114,7 +114,7 @@ M: sha1 checksum-stream ( stream -- sha1 ) drop [ initialize-sha1 stream>sha1 get-sha1 ] with-input-stream ; : sha1-interleave ( string -- seq ) - [ zero? ] left-trim + [ zero? ] trim-left dup length odd? [ rest ] when seq>2seq [ sha1 checksum-bytes ] bi@ 2seq>seq ; diff --git a/basis/compiler/tree/normalization/normalization.factor b/basis/compiler/tree/normalization/normalization.factor index 12c7a60ec8..08481726dc 100644 --- a/basis/compiler/tree/normalization/normalization.factor +++ b/basis/compiler/tree/normalization/normalization.factor @@ -151,7 +151,7 @@ M: #branch normalize* : eliminate-phi-introductions ( introductions seq terminated -- seq' ) [ [ nip ] [ - dup [ +bottom+ eq? ] left-trim + dup [ +bottom+ eq? ] trim-left [ [ length ] bi@ - tail* ] keep append ] if ] 3map ; diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor index ea1cfd9a4b..8dc1924a12 100755 --- a/basis/http/client/client.factor +++ b/basis/http/client/client.factor @@ -113,7 +113,7 @@ SYMBOL: redirects PRIVATE> : read-chunk-size ( -- n ) - read-crlf ";" split1 drop [ blank? ] right-trim + read-crlf ";" split1 drop [ blank? ] trim-right hex> [ "Bad chunk size" throw ] unless* ; : read-chunks ( -- ) diff --git a/basis/http/server/static/static.factor b/basis/http/server/static/static.factor index 98510e45fd..dfbe93d86d 100755 --- a/basis/http/server/static/static.factor +++ b/basis/http/server/static/static.factor @@ -45,9 +45,9 @@ TUPLE: file-responder root hook special allow-listings ; [ file-responder get hook>> call ] [ 2drop <304> ] if ; : serving-path ( filename -- filename ) - file-responder get root>> right-trim-separators + file-responder get root>> trim-right-separators "/" - rot "" or left-trim-separators 3append ; + rot "" or trim-left-separators 3append ; : serve-file ( filename -- response ) dup mime-type diff --git a/basis/io/monitors/monitors-tests.factor b/basis/io/monitors/monitors-tests.factor index 63381811d1..1cc97753b7 100755 --- a/basis/io/monitors/monitors-tests.factor +++ b/basis/io/monitors/monitors-tests.factor @@ -54,7 +54,7 @@ os { winnt linux macosx } member? [ "m" get next-change drop dup print flush dup parent-directory - [ right-trim-separators "xyz" tail? ] either? not + [ trim-right-separators "xyz" tail? ] either? not ] loop "c1" get count-down @@ -63,7 +63,7 @@ os { winnt linux macosx } member? [ "m" get next-change drop dup print flush dup parent-directory - [ right-trim-separators "yxy" tail? ] either? not + [ trim-right-separators "yxy" tail? ] either? not ] loop "c2" get count-down diff --git a/basis/io/windows/nt/files/files-tests.factor b/basis/io/windows/nt/files/files-tests.factor index 0fa4b4151c..830861eba0 100755 --- a/basis/io/windows/nt/files/files-tests.factor +++ b/basis/io/windows/nt/files/files-tests.factor @@ -21,8 +21,8 @@ IN: io.windows.nt.files.tests [ t ] [ "\\\\" root-directory? ] unit-test [ t ] [ "/" root-directory? ] unit-test [ t ] [ "//" root-directory? ] unit-test -[ t ] [ "c:\\" right-trim-separators root-directory? ] unit-test -[ t ] [ "Z:\\" right-trim-separators root-directory? ] unit-test +[ t ] [ "c:\\" trim-right-separators root-directory? ] unit-test +[ t ] [ "Z:\\" trim-right-separators root-directory? ] unit-test [ f ] [ "c:\\foo" root-directory? ] unit-test [ f ] [ "." root-directory? ] unit-test [ f ] [ ".." root-directory? ] unit-test diff --git a/basis/io/windows/nt/files/files.factor b/basis/io/windows/nt/files/files.factor index 6a890f6392..5fbacfa325 100755 --- a/basis/io/windows/nt/files/files.factor +++ b/basis/io/windows/nt/files/files.factor @@ -22,7 +22,7 @@ M: winnt root-directory? ( path -- ? ) { { [ dup empty? ] [ f ] } { [ dup [ path-separator? ] all? ] [ t ] } - { [ dup right-trim-separators { [ length 2 = ] [ second CHAR: : = ] } 1&& ] [ t ] } + { [ dup trim-right-separators { [ length 2 = ] [ second CHAR: : = ] } 1&& ] [ t ] } [ f ] } cond nip ; diff --git a/basis/peg/peg.factor b/basis/peg/peg.factor index 0cf0382ee2..dbb3a04a09 100755 --- a/basis/peg/peg.factor +++ b/basis/peg/peg.factor @@ -513,18 +513,11 @@ TUPLE: action-parser p1 quot ; M: action-parser (compile) ( peg -- quot ) [ p1>> compile-parser 1quotation ] [ quot>> ] bi '[ @ , check-action ] ; -: left-trim-slice ( string -- string ) - #! Return a new string without any leading whitespace - #! from the original string. - dup empty? [ - dup first blank? [ rest-slice left-trim-slice ] when - ] unless ; - TUPLE: sp-parser p1 ; M: sp-parser (compile) ( peg -- quot ) p1>> compile-parser 1quotation '[ - input-slice left-trim-slice input-from pos set @ + input-slice trim-left-slice input-from pos set @ ] ; TUPLE: delay-parser quot ; diff --git a/basis/unicode/collation/collation.factor b/basis/unicode/collation/collation.factor index b5c7665b8b..d71fffaaab 100755 --- a/basis/unicode/collation/collation.factor +++ b/basis/unicode/collation/collation.factor @@ -136,7 +136,7 @@ PRIVATE> : insensitive= ( str1 str2 levels-removed -- ? ) [ swap collation-key swap - [ [ 0 = not ] right-trim but-last ] times + [ [ 0 = not ] trim-right but-last ] times ] curry bi@ = ; PRIVATE>