]> gitweb.factorcode.org Git - factor.git/commitdiff
use quoting vocab
authorsheeple <sheeple@oberon.local>
Sun, 22 Feb 2009 06:42:35 +0000 (00:42 -0600)
committersheeple <sheeple@oberon.local>
Sun, 22 Feb 2009 06:42:35 +0000 (00:42 -0600)
basis/db/errors/postgresql/postgresql.factor
basis/mime/multipart/multipart.factor

index 2b79859050ff8cc9bf52a5afbe52cdc1614fee6e..02b43ecd8800e9922e6283fc2d9ff07e81273a13 100644 (file)
@@ -1,22 +1,9 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel db.errors peg.ebnf strings sequences math
-combinators.short-circuit accessors math.parser ;
+combinators.short-circuit accessors math.parser quoting ;
 IN: db.errors.postgresql
 
-: quote? ( ch -- ? ) "'\"" member? ;
-
-: quoted? ( str -- ? )
-    {
-        [ length 1 > ]
-        [ first quote? ]
-        [ [ first ] [ peek ] bi = ]
-    } 1&& ;
-
-: unquote ( str -- newstr )
-    dup quoted? [ but-last-slice rest-slice >string ] when ;
-
-
 EBNF: parse-postgresql-sql-error
 
 Error = "ERROR:" [ ]+
index 37d5e13129be5a1375f4321b646161c99dd1d640..0edfb05a3081da96ed583c0454792630a6be6cc7 100755 (executable)
@@ -3,7 +3,8 @@
 USING: multiline kernel sequences io splitting fry namespaces
 http.parsers hashtables assocs combinators ascii io.files.unique
 accessors io.encodings.binary io.files byte-arrays math
-io.streams.string combinators.short-circuit strings math.order ;
+io.streams.string combinators.short-circuit strings math.order
+quoting ;
 IN: mime.multipart
 
 CONSTANT: buffer-size 65536
@@ -75,18 +76,6 @@ ERROR: end-of-stream multipart ;
 : empty-name? ( string -- ? )
     { "''" "\"\"" "" f } member? ;
 
-: quote? ( ch -- ? ) "'\"" member? ;
-
-: quoted? ( str -- ? )
-    {
-        [ length 1 > ]
-        [ first quote? ]
-        [ [ first ] [ peek ] bi = ]
-    } 1&& ;
-
-: unquote ( str -- newstr )
-    dup quoted? [ but-last-slice rest-slice >string ] when ;
-
 : save-uploaded-file ( multipart -- )
     dup filename>> empty-name? [
         drop