Yet one more addition to error handling

Alan Shields <[email protected]>
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Dear List,

I found one more error in the sql reader macro. Turns out that when
SLIME reads a file, if there's an error it tries to find the location of
the error. To do this, it has to re-read the file, but this time with
*read-suppress* turned on, as mandated by the CLHS.

This means that (read-delimited-list) will return NIL.

This patch causes this to be handled properly.

I think I'm getting the hang of this lisp thing.

Sorry for the patch spam,
Alan


--- sql/syntax.lisp	2005-04-13 14:00:40.000000000 -0500
+++ /home/shieldsa/.sbcl/site/clsql-3.1.10/sql/syntax.lisp	2005-04-18 15:40:53.000000000 -0500
@@ -88,18 +88,19 @@
 (defun sql-reader-open (stream char)
   (declare (ignore char))
   (let ((sqllist (read-delimited-list #\] stream t)))
-    (handler-case
-	(cond ((string= (write-to-string (car sqllist)) "||")
-	       (cons (sql-operator 'concat-op) (cdr sqllist)))
-	      ((and (= (length sqllist) 1) (eql (car sqllist) '*))
-	       (apply #'generate-sql-reference sqllist))
-	      ((sql-operator (car sqllist))
-	       (cons (sql-operator (car sqllist)) (cdr sqllist)))
-	      (t (apply #'generate-sql-reference sqllist)))
-      (sql-user-error (c)
-	(error 'sql-user-error
-	       :message (format nil "Error ~A occured while attempting to parse '~A' at file position ~A"
-				(sql-user-error-message c) sqllist (file-position stream)))))))
+    (unless *read-suppress*
+      (handler-case
+	  (cond ((string= (write-to-string (car sqllist)) "||")
+		 (cons (sql-operator 'concat-op) (cdr sqllist)))
+		((and (= (length sqllist) 1) (eql (car sqllist) '*))
+		 (apply #'generate-sql-reference sqllist))
+		((sql-operator (car sqllist))
+		 (cons (sql-operator (car sqllist)) (cdr sqllist)))
+		(t (apply #'generate-sql-reference sqllist)))
+	(sql-user-error (c)
+	  (error 'sql-user-error
+		 :message (format nil "Error ~A occured while attempting to parse '~A' at file position ~A"
+				  (sql-user-error-message c) sqllist (file-position stream))))))))
 
 (defun disable-sql-close-syntax ()
   "Internal function that disables the close syntax when leaving
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.