Function: sqlind-syntax-in-case
sqlind-syntax-in-case is a natively compiled function defined in
sql-indent.el.
Signature
(sqlind-syntax-in-case POS START)
Documentation
Return the syntax at POS which is part a "case" expression at START.
Source Code
;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-syntax-in-case (pos start)
"Return the syntax at POS which is part a \"case\" expression at START."
(save-excursion
(goto-char pos)
(cond ((looking-at "when\\|else")
;; A WHEN, or ELSE clause is indented relative to the start of the
;; case expression
(cons 'case-clause start))
((looking-at "end")
(cons (list 'block-end 'case "") start))
((looking-at "then")
;; THEN and ELSE clauses are indented relative to the start of the
;; when clause, which we must find
(while (not (and (re-search-backward "\\_<when\\_>")
(sqlind-same-level-statement (point) start)))
nil)
(cons 'case-clause-item (point)))
(t
;; It is a statement continuation from the closest CASE element
(while (and (not (= (point) start))
(not (and (re-search-backward sqlind-case-clauses-regexp start 'noerror)
(sqlind-same-level-statement (point) start))))
nil)
(cons 'case-clause-item-cont (point))))))