Function: sql-statement-regexp
sql-statement-regexp is a byte-compiled function defined in sql.el.gz.
Signature
(sql-statement-regexp PROD)
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/sql.el.gz
;;; SMIE support
;; Needs a lot more love than I can provide. --Stef
;; (require 'smie)
;; (defconst sql-smie-grammar
;; (smie-prec2->grammar
;; (smie-bnf->prec2
;; ;; Partly based on https://www.h2database.com/html/grammar.html
;; '((cmd ("SELECT" select-exp "FROM" select-table-exp)
;; )
;; (select-exp ("*") (exp) (exp "AS" column-alias))
;; (column-alias)
;; (select-table-exp (table-exp "WHERE" exp) (table-exp))
;; (table-exp)
;; (exp ("CASE" exp "WHEN" exp "THEN" exp "ELSE" exp "END")
;; ("CASE" exp "WHEN" exp "THEN" exp "END"))
;; ;; Random ad-hoc additions.
;; (foo (foo "," foo))
;; )
;; '((assoc ",")))))
;; (defun sql-smie-rules (kind token)
;; (pcase (cons kind token)
;; (`(:list-intro . ,_) t)
;; (`(:before . "(") (smie-rule-parent))))
;;; Motion Functions
(defun sql-statement-regexp (prod)
(let* ((ansi-stmt (or (sql-get-product-feature 'ansi :statement) "select"))
(prod-stmt (sql-get-product-feature prod :statement)))
(concat "^\\<"
(if prod-stmt
(concat "\\(" ansi-stmt "\\|" prod-stmt "\\)")
ansi-stmt)
"\\>")))