X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=sql%2Fsyntax.lisp;fp=sql%2Fsyntax.lisp;h=7e1906b9e4d22055a497c54ac546f5335f3803e9;hp=1aec1caa8fc55f3f23025b3848b1a88bc038dd68;hb=406feeb749bb475bec8077a2716a5b6089bd9072;hpb=e41e6a54e54a32bbb3e7d359c21175465b05cd6c diff --git a/sql/syntax.lisp b/sql/syntax.lisp index 1aec1ca..7e1906b 100644 --- a/sql/syntax.lisp +++ b/sql/syntax.lisp @@ -64,6 +64,15 @@ the current syntax state." '(eval-when (:compile-toplevel :load-toplevel :execute) (%enable-sql-reader-syntax))) +(defmacro file-enable-sql-reader-syntax () + "Turns on the SQL reader syntax for the rest of the file. +The CL spec says that when finished loading a file the original +*readtable* is restored. clhs COMPILE-FILE" + '(eval-when (:compile-toplevel :load-toplevel :execute) + (setf *readtable* (copy-readtable)) + (set-macro-character *sql-macro-open-char* #'sql-reader-open) + (set-macro-character *sql-macro-close-char* (get-macro-character #\))))) + (defun %enable-sql-reader-syntax () (unless *original-readtable* (setf *original-readtable* *readtable*