Function: lua-try-match-multiline-begin

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

Signature

(lua-try-match-multiline-begin LIMIT)

Documentation

Try to match multiline open-brackets.

Find next opening long bracket outside of any string/comment. If none can be found before reaching LIMIT, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/lua-mode.el.gz
(defun lua-try-match-multiline-begin (limit)
  "Try to match multiline open-brackets.

Find next opening long bracket outside of any string/comment.  If none
can be found before reaching LIMIT, return nil."
  (let (last-search-matched)
    (while
        ;; This loop will iterate skipping all multiline-begin tokens
        ;; that are inside strings or comments ending either at EOL or
        ;; at valid token.
        (and (setq last-search-matched
                   (re-search-forward lua-ml-begin-regexp limit 'noerror))
             ;; Ensure --[[ is not inside a comment or string.
             ;;
             ;; This includes "---[[" sequence, in which "--" at the
             ;; beginning creates a single-line comment, and thus "-[["
             ;; is no longer a multi-line opener.
             ;;
             ;; XXX: need to ensure syntax-ppss beyond (match-beginning
             ;; 0) is not calculated, or otherwise we'll need to flush
             ;; the cache.
             (lua-comment-or-string-start-pos (match-beginning 0))))

    last-search-matched))