`(sequence "("
(0+ (any "$@%&*;\\[]"))
")")
- "A regular expression for a subroutine prototype. Not as strict as the actual prototype syntax, but good enough to distinguish prototypes from signatures.")
+ "A regular expression for a subroutine prototype. Not as strict
+as the actual prototype syntax, but good enough to distinguish
+prototypes from signatures.")
(defconst cperl--signature-rx
`(sequence "("
(setq end (point)))))
(or end pos)))))
-(defun cperl-find-sub-attrs (&optional st-l b-fname e-fname pos)
+(defun cperl-find-sub-attrs (&optional st-l _b-fname _e-fname pos)
"Syntactically mark (and fontify) attributes of a subroutine.
Should be called with the point before leading colon of an attribute."
;; Works *before* syntax recognition is done
'attrib-group (if (looking-at "{") t 0))
(and pos
(progn
- (< 1 (count-lines (+ 3 pos) (point))) ; end of `sub'
;; Apparently, we do not need `multiline': faces added now
(put-text-property (+ 3 pos) (cperl-1+ (point))
'syntax-type 'sub-decl))))
(when (match-beginning 2)
(should (equal (get-text-property (match-beginning 2) 'face)
'font-lock-string-face))))
- (goto-char end-of-sub)
;; Subroutine signatures
+ (goto-char start-of-sub)
(when (search-forward "$bar" end-of-sub t)
- (should (equal (get-text-property (match-beginning) 'face)
- 'font-lock-variable-name-face)))))
+ (should (equal (get-text-property (match-beginning 0) 'face)
+ 'font-lock-variable-name-face)))
+ (goto-char end-of-sub)))
;; Anonymous subroutines
(while (search-forward-regexp "= sub" nil t)
(let ((start-of-sub (match-beginning 0))
(when (match-beginning 2)
(should (equal (get-text-property (match-beginning 2) 'face)
'font-lock-string-face))))
- (goto-char end-of-sub)
;; Subroutine signatures
+ (goto-char start-of-sub)
(when (search-forward "$bar" end-of-sub t)
- (should (equal (get-text-property (match-beginning) 'face)
- 'font-lock-variable-name-face))))))))
+ (should (equal (get-text-property (match-beginning 0) 'face)
+ 'font-lock-variable-name-face)))
+ (goto-char end-of-sub))))))
(ert-deftest cperl-test-fontify-special-variables ()
"Test fontification of variables like $^T or ${^ENCODING}.
(defvar perl-continued-statement-offset)
(defvar perl-indent-level)
+(defvar perl-indent-parens-as-block)
(defconst cperl--tests-heredoc-face
(if (equal cperl-test-mode 'perl-mode) 'perl-heredoc