Function: lua-try-match-multiline-end

lua-try-match-multiline-end is a byte-compiled function defined in lua-mode.el.gz.

Signature

(lua-try-match-multiline-end END)

Documentation

Try to match close-bracket for multiline literal around point.

Basically, detect form of close bracket from syntactic information provided at point and re-search-forward to it.

The argument END is a buffer position that bounds the search.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-try-match-multiline-end (end)
  "Try to match close-bracket for multiline literal around point.

Basically, detect form of close bracket from syntactic information
provided at point and `re-search-forward' to it.

The argument END is a buffer position that bounds the search."
  (let ((comment-or-string-start-pos (lua-comment-or-string-start-pos)))
    ;; Is there a literal around point?
    (and comment-or-string-start-pos
         ;; It is, check if the literal is a multiline open-bracket
         (save-excursion
           (goto-char comment-or-string-start-pos)
           (looking-at lua-ml-begin-regexp))

         ;; Yes it is, look for it matching close-bracket.  Close
         ;; bracket's match group is determined by match-group of
         ;; open-bracket.
         (re-search-forward
          (format "]%s\\(?%s:]\\)"
                  (match-string-no-properties 3)
                  (if (match-beginning 1) 1 2))
          end 'noerror))))