Function: lua-is-continuing-statement-p-1

lua-is-continuing-statement-p-1 is a byte-compiled function defined in lua-mode.el.gz.

Signature

(lua-is-continuing-statement-p-1)

Documentation

Return non-nil if current line continues a statement.

More specifically, return the point in the line that is continued. The criteria for a continuing statement are:

* The last token of the previous line is a continuing op,
  OR the first token of the current line is a continuing op.

* The expression is not enclosed by a parentheses/braces/brackets.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-is-continuing-statement-p-1 ()
  "Return non-nil if current line continues a statement.

More specifically, return the point in the line that is continued.
The criteria for a continuing statement are:

* The last token of the previous line is a continuing op,
  OR the first token of the current line is a continuing op.

* The expression is not enclosed by a parentheses/braces/brackets."
  (let (prev-line continuation-pos parent-block-opener)
    (save-excursion (setq prev-line (lua-forward-line-skip-blanks 'back)))
    (and prev-line
         (not (lua--continuation-breaking-line-p))
         (save-excursion
           ;; Binary operator or keyword that implies continuation.
           (and (setq continuation-pos
                      (or (lua-first-token-continues-p)
                          (save-excursion
                            (goto-char prev-line)
                            ;; Check last token of previous nonblank line
                            (lua-last-token-continues-p))))
                (not
                 ;; Operators/keywords does not create continuation
                 ;; inside some blocks:
                 (and (setq parent-block-opener
                            (car-safe (lua--backward-up-list-noerror)))
                      (or
                       ;; Inside parens/brackets
                       (member parent-block-opener '("(" "["))
                       ;; Inside braces if it is a comma
                       (and (eq (char-after continuation-pos) ?,)
                            (equal parent-block-opener "{")))))
                continuation-pos)))))