Function: cperl-block-p

cperl-block-p is a byte-compiled function defined in cperl-mode.el.gz.

Signature

(cperl-block-p)

Documentation

Point is before ?\{. Return true if it starts a block.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cperl-mode.el.gz
;; Used only in `cperl-sniff-for-indent'...
(defun cperl-block-p ()
  "Point is before ?\\{.  Return true if it starts a block."
  ;; No save-excursion!  This is more a distinguisher of a block/hash ref...
  (cperl-backward-to-noncomment (point-min))
  (or (memq (preceding-char) (append ";){}$@&%\C-@" nil)) ; Or label!  \C-@ at bobp
					; Label may be mixed up with `$blah :'
      (save-excursion (cperl-after-label))
      ;; text with the 'attrib-group property is also covered by the
      ;; next clause.  We keep it because it is faster (for
      ;; subroutines with attributes).
      (get-text-property (cperl-1- (point)) 'attrib-group)
      (save-excursion (cperl-block-declaration-p))
      (and (memq (char-syntax (preceding-char)) '(?w ?_))
	   (progn
	     (backward-sexp)
	     ;; sub {BLK}, print {BLK} $data, but NOT `bless', `return', `tr', `constant'
             ;; a-zA-Z is fine here, these are Perl keywords
	     (or (and (looking-at "[a-zA-Z0-9_:]+[ \t\n\f]*[{#]") ; Method call syntax
		      (not (looking-at "\\(bless\\|return\\|q[wqrx]?\\|tr\\|[smy]\\|constant\\)\\>")))
		 ;; sub bless::foo {}
		 (progn
		   (cperl-backward-to-noncomment (point-min))
		   (and (eq (preceding-char) ?b)
			(progn
			  (forward-sexp -1)
			  (looking-at (concat cperl-sub-regexp "[ \t\n\f#]"))))))))))