Function: cperl-get-state

cperl-get-state is a byte-compiled function defined in cperl-mode.el.gz.

Signature

(cperl-get-state &optional PARSE-START START-STATE)

Documentation

Return list (START STATE DEPTH PRESTART).

START is a good place to start parsing, or equal to PARSE-START if preset. STATE is what is returned by parse-partial-sexp. DEPTH is true is we are immediately after end of block which contains START. PRESTART is the position basing on which START was found.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
(defun cperl-get-state (&optional parse-start start-state)
  "Return list (START STATE DEPTH PRESTART).
START is a good place to start parsing, or equal to
PARSE-START if preset.
STATE is what is returned by `parse-partial-sexp'.
DEPTH is true is we are immediately after end of block
which contains START.
PRESTART is the position basing on which START was found."
  (save-excursion
    (let ((start-point (point)) depth state start prestart)
      (if (and parse-start
	       (<= parse-start start-point))
	  (goto-char parse-start)
	(beginning-of-defun)
        (when (cperl-declaration-header-p (point))
          (goto-char (cperl-beginning-of-property (point) 'syntax-type))
          (beginning-of-line))
	(setq start-state nil))
      (setq prestart (point))
      (if start-state nil
	;; Try to go out, if sub is not on the outermost level
	(while (< (point) start-point)
	  (setq start (point) parse-start start depth nil
		state (parse-partial-sexp start start-point -1))
	  (if (> (car state) -1) nil
	    ;; The current line could start like }}}, so the indentation
	    ;; corresponds to a different level than what we reached
	    (setq depth t)
	    (beginning-of-line 2)))	; Go to the next line.
	(if start (goto-char start)))	; Not at the start of file
      (setq start (point))
      (or state (setq state (parse-partial-sexp start start-point -1 nil start-state)))
      (list start state depth prestart))))