X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fsyntax.lisp;h=7e1906b9e4d22055a497c54ac546f5335f3803e9;hb=b9e89e0d84e8ab8d3e8d9ac02e3349bac908b415;hp=436c224ccd9476b2aa3e46b88259a17ab175f037;hpb=e567409d9fff3f7231c2a0bb69b345e19de2b246;p=clsql.git diff --git a/sql/syntax.lisp b/sql/syntax.lisp index 436c224..7e1906b 100644 --- a/sql/syntax.lisp +++ b/sql/syntax.lisp @@ -1,8 +1,6 @@ ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- ;;;; ************************************************************************* ;;;; -;;;; $Id$ -;;;; ;;;; CLSQL square bracket symbolic query syntax. Functions for ;;;; enabling and disabling the syntax and for building SQL ;;;; expressions using the syntax. @@ -66,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*