use quoting vocab

db4
sheeple 2009-02-22 00:42:35 -06:00
parent 57bd819886
commit 06f6eb98aa
2 changed files with 3 additions and 27 deletions

View 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:" [ ]+

View File

@ -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