Function: sqlind-maybe-loop-statement
sqlind-maybe-loop-statement is a natively compiled function defined in
sql-indent.el.
Signature
(sqlind-maybe-loop-statement)
Documentation
If (point) is on a LOOP statement, report its syntax.
Only keywords in program code are matched, not the ones inside expressions.
See also sqlind-beginning-of-block
Source Code
;; Defined in /nix/store/jxjf2h9nnkdqnn1w1mr0ag8bqng2rlrs-emacs-packages-deps/share/emacs/site-lisp/elpa/sql-indent-1.7/sql-indent.el
(defun sqlind-maybe-loop-statement ()
"If (point) is on a LOOP statement, report its syntax.
Only keywords in program code are matched, not the ones inside
expressions.
See also `sqlind-beginning-of-block'"
(when (looking-at "loop")
(prog1 t ; make sure we return t
(sqlind-beginning-of-statement)
;; note that we might have found a loop in an "end loop;" statement.
(or (sqlind-maybe-end-statement)
(progn
(let ((posn (point)))
(unless (looking-at "<<") ;; whe're inside an label.
(forward-word -1)
(back-to-indentation))
(let ((loop-label (if (looking-at "<<\\([a-z0-9_]+\\)>>")
(sqlind-match-string 1) "")))
(goto-char posn)
;; start of loop. this always starts a block, we only check if
;; the labels match
(if (null sqlind-end-stmt-stack)
(throw 'finished (list 'in-block 'loop loop-label))
(cl-destructuring-bind (pos kind label)
(pop sqlind-end-stmt-stack)
(unless (and (eq kind 'loop)
(sqlind-labels-match label loop-label))
(throw 'finished
(list 'syntax-error
"bad closing for loop block" (point) pos))))))))))))