Function: sql-font-lock-keywords-builder
sql-font-lock-keywords-builder is a byte-compiled function defined in
sql.el.gz.
Signature
(sql-font-lock-keywords-builder FACE BOUNDARIES &rest KEYWORDS)
Documentation
Generation of regexp matching any one of KEYWORDS.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
(eval-and-compile
(defun sql-font-lock-keywords-builder (face boundaries &rest keywords)
"Generation of regexp matching any one of KEYWORDS."
(let ((bdy (or boundaries '("\\b" . "\\b")))
kwd)
;; Remove keywords that are defined in ANSI
(setq kwd keywords)
;; (dolist (k keywords)
;; (catch 'next
;; (dolist (a sql-mode-ansi-font-lock-keywords)
;; (when (and (eq face (cdr a))
;; (eq (string-match (car a) k 0) 0)
;; (eq (match-end 0) (length k)))
;; (setq kwd (delq k kwd))
;; (throw 'next nil)))))
;; Create a properly formed font-lock-keywords item
(cons (concat (car bdy)
(regexp-opt kwd t)
(cdr bdy))
face)))
(defun sql-regexp-abbrev (keyword)
(let ((brk (string-search "~" keyword))
(len (length keyword))
(sep "\\(?:")
re i)
(if (not brk)
keyword
(setq re (substring keyword 0 brk)
i (+ 2 brk)
brk (1+ brk))
(while (<= i len)
(setq re (concat re sep (substring keyword brk i))
sep "\\|"
i (1+ i)))
(concat re "\\)?"))))
(defun sql-regexp-abbrev-list (&rest keyw-list)
(let ((re nil)
(sep "\\<\\(?:"))
(while keyw-list
(setq re (concat re sep (sql-regexp-abbrev (car keyw-list)))
sep "\\|"
keyw-list (cdr keyw-list)))
(concat re "\\)\\>"))))