Fix a bug reported by David Thole, whereby a separator (e.g. tab)
authorFrancois-Rene Rideau <tunes@google.com>
Tue, 31 Jan 2012 21:02:57 +0000 (16:02 -0500)
committerFrancois-Rene Rideau <tunes@google.com>
Tue, 31 Jan 2012 21:02:57 +0000 (16:02 -0500)
should not be considered as a space that can be skipped.

.gitignore [new file with mode: 0644]
build.xcvb
csv.lisp

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..5ca0273
--- /dev/null
@@ -0,0 +1,3 @@
+*.*fs*l
+*.fas
+*.lib
index eab3df5..706a93c 100644 (file)
@@ -1,8 +1,5 @@
 #+xcvb
 (module
- (:fullname
-  "fare-csv"
-  :depends-on
-  ("package" "csv")
-  :supersedes-asdf
-  ("fare-csv")))
+ (:fullname "fare-csv"
+  :depends-on ("package" "csv")
+  :supersedes-asdf ("fare-csv")))
index 2e88108..05a49a8 100644 (file)
--- a/csv.lisp
+++ b/csv.lisp
@@ -175,10 +175,12 @@ forcing CRLF as line ending and disallowing binary data amongst values"
 
 (defsubst char-space-p (c)
   "Is character C some kind of white space?
-BUG: this only handles a tiny subset of character sets,
-even if restricted to ASCII. However, it's rather portable."
+NB: this only handles a tiny subset of whitespace characters,
+even if restricted to ASCII. However, it's rather portable,
+and is what the creativyst document specifies.
+Be careful to not skip a separator, as it could be e.g. a tab!"
   (declare (type (or null character) c))
-  (and c (member c '(#\Space #\Tab))))
+  (and c (member c '(#\Space #\Tab)) (not (eql c *separator*))))
 
 ;;#+DEBUG (defparameter *max* 2000)
 ;;#+DEBUG (defun maxbreak () (when (<= *max* 0) (setf *max* 2000) (break)) (decf *max*))