From d31ece5dd0e12d2a48d3061ec976774e4ad0798b Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 15 Jul 2012 09:15:55 -0700 Subject: [PATCH] csv: faster for files that do not have blanks around delimiter. --- basis/csv/csv.factor | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/basis/csv/csv.factor b/basis/csv/csv.factor index aa35264f12..daddca9e25 100644 --- a/basis/csv/csv.factor +++ b/basis/csv/csv.factor @@ -28,7 +28,13 @@ MEMO: (quoted-field) ( delimiter -- delimiter' ) delimiter> (quoted-field) read-until dup CHAR: " = [ 2drop quoted-field ] - [ swap [ blank? ] trim % ] + [ + swap dup { + [ ?first blank? ] + [ ?last blank? ] + } 1|| + [ [ blank? ] trim ] when % + ] if ; : maybe-escaped-quote ( -- endchar )