aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2017-12-21 23:22:59 -0500
committerStefan Monnier2017-12-21 23:22:59 -0500
commit1bcbcb7e486008d4fc449088e49da6c52ba88bee (patch)
treecb1f426a3666dbad6e7e3c8c6995e49c3fd16036
parent9ced53ae8b381afbdd465081c7f82ebfd03be47b (diff)
downloademacs-1bcbcb7e486008d4fc449088e49da6c52ba88bee.tar.gz
emacs-1bcbcb7e486008d4fc449088e49da6c52ba88bee.zip
* lisp/progmodes/cperl-mode.el: Merge from Jonathan Rockway's version
(cperl-indent-subs-specially): New var. (cperl-mode-abbrev-table): Add '=begin'. Obey cperl-electric-keywords. (cperl-sub-keywords, cperl-sub-regexp): New vars. (cperl-char-ends-sub-keyword-p): New function. (cperl-mode): Use them. (cperl-db): Pass `-d` arg to perl. (cperl-electric-keyword, cperl-linefeed): Accept also '=end'. (cperl-sniff-for-indent): Obey cperl-indent-parens-as-block and cperl-indent-subs-specially. (cperl-calculate-indent): Fix handling of numbers in cperl-indent-rules-alist, and add a case for functions. (cperl-find-pods-heres): Use cperl-sub-regexp and allow =begin/=end. Also recognize 'say'. (cperl-block-p): Use cperl-sub-regexp (cperl-after-block-p): Use cperl-char-ends-sub-keyword-p and cperl-sub-regexp. (cperl-after-block-and-statement-beg): Accept 'say'. (cperl-indent-exp): Accept 'state'. (cperl-fix-line-spacing): Accept 'state'. (cperl-init-faces): Add 'given', 'when', 'default', 'break', 'try', 'catch', 'finally', 'evalbytes', 'state', '__SUB__', 'fc', 'sysseek'. Use cperl-sub-regexp. (cperl-etags): Use cperl-sub-regexp. (cperl-not-bad-style-regexp): Add '//'. (cperl-short-docs): Add ~~, UNITCHECK, 'break', 'default', 'evalbytes', 'given', 'say', 'state', //, 'fc', 'prototype', =begin', and '=end'.
-rw-r--r--lisp/progmodes/cperl-mode.el236
1 files changed, 153 insertions, 83 deletions
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index e6ab8c4ea60..5b161b621c4 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -4,6 +4,7 @@
4 4
5;; Author: Ilya Zakharevich 5;; Author: Ilya Zakharevich
6;; Bob Olson 6;; Bob Olson
7;; Jonathan Rockway <jon@jrock.us>
7;; Maintainer: emacs-devel@gnu.org 8;; Maintainer: emacs-devel@gnu.org
8;; Keywords: languages, Perl 9;; Keywords: languages, Perl
9 10
@@ -26,6 +27,15 @@
26 27
27;;; Commentary: 28;;; Commentary:
28 29
30;; This version of the file contains support for the syntax added by
31;; the MooseX::Declare CPAN module, as well as Perl 5.10 keyword
32;; support.
33
34;; The latest version is available from
35;; http://github.com/jrockway/cperl-mode
36;;
37;; (perhaps in the moosex-declare branch)
38
29;; You can either fine-tune the bells and whistles of this mode or 39;; You can either fine-tune the bells and whistles of this mode or
30;; bulk enable them by putting 40;; bulk enable them by putting
31 41
@@ -286,6 +296,11 @@ Versions 5.2 ... 5.20 behaved as if this were nil."
286 :type 'boolean 296 :type 'boolean
287 :group 'cperl-indentation-details) 297 :group 'cperl-indentation-details)
288 298
299(defcustom cperl-indent-subs-specially t
300 "*Non-nil means indent subs that are inside other blocks (hash values, for example) relative to the beginning of the \"sub\" keyword, rather than relative to the statement that contains the declaration."
301 :type 'boolean
302 :group 'cperl-indentation-details)
303
289(defcustom cperl-auto-newline nil 304(defcustom cperl-auto-newline nil
290 "Non-nil means automatically newline before and after braces, 305 "Non-nil means automatically newline before and after braces,
291and after colons and semicolons, inserted in CPerl code. The following 306and after colons and semicolons, inserted in CPerl code. The following
@@ -1110,27 +1125,31 @@ versions of Emacs."
1110 (require 'cl)) 1125 (require 'cl))
1111 1126
1112(define-abbrev-table 'cperl-mode-abbrev-table 1127(define-abbrev-table 'cperl-mode-abbrev-table
1113 '( 1128 ;; FIXME: Use a separate abbrev table for that, enabled conditionally,
1114 ("if" "if" cperl-electric-keyword :system t) 1129 ;; as we did with python-mode-skeleton-abbrev-table!
1115 ("elsif" "elsif" cperl-electric-keyword :system t) 1130 (when (cperl-val 'cperl-electric-keywords)
1116 ("while" "while" cperl-electric-keyword :system t) 1131 '(
1117 ("until" "until" cperl-electric-keyword :system t) 1132 ("if" "if" cperl-electric-keyword :system t)
1118 ("unless" "unless" cperl-electric-keyword :system t) 1133 ("elsif" "elsif" cperl-electric-keyword :system t)
1119 ("else" "else" cperl-electric-else :system t) 1134 ("while" "while" cperl-electric-keyword :system t)
1120 ("continue" "continue" cperl-electric-else :system t) 1135 ("until" "until" cperl-electric-keyword :system t)
1121 ("for" "for" cperl-electric-keyword :system t) 1136 ("unless" "unless" cperl-electric-keyword :system t)
1122 ("foreach" "foreach" cperl-electric-keyword :system t) 1137 ("else" "else" cperl-electric-else :system t)
1123 ("formy" "formy" cperl-electric-keyword :system t) 1138 ("continue" "continue" cperl-electric-else :system t)
1124 ("foreachmy" "foreachmy" cperl-electric-keyword :system t) 1139 ("for" "for" cperl-electric-keyword :system t)
1125 ("do" "do" cperl-electric-keyword :system t) 1140 ("foreach" "foreach" cperl-electric-keyword :system t)
1126 ("=pod" "=pod" cperl-electric-pod :system t) 1141 ("formy" "formy" cperl-electric-keyword :system t)
1127 ("=over" "=over" cperl-electric-pod :system t) 1142 ("foreachmy" "foreachmy" cperl-electric-keyword :system t)
1128 ("=head1" "=head1" cperl-electric-pod :system t) 1143 ("do" "do" cperl-electric-keyword :system t)
1129 ("=head2" "=head2" cperl-electric-pod :system t) 1144 ("=pod" "=pod" cperl-electric-pod :system t)
1130 ("pod" "pod" cperl-electric-pod :system t) 1145 ("=begin" "=begin" cperl-electric-pod 0 :system t)
1131 ("over" "over" cperl-electric-pod :system t) 1146 ("=over" "=over" cperl-electric-pod :system t)
1132 ("head1" "head1" cperl-electric-pod :system t) 1147 ("=head1" "=head1" cperl-electric-pod :system t)
1133 ("head2" "head2" cperl-electric-pod :system t)) 1148 ("=head2" "=head2" cperl-electric-pod :system t)
1149 ("pod" "pod" cperl-electric-pod :system t)
1150 ("over" "over" cperl-electric-pod :system t)
1151 ("head1" "head1" cperl-electric-pod :system t)
1152 ("head2" "head2" cperl-electric-pod :system t)))
1134 "Abbrev table in use in CPerl mode buffers.") 1153 "Abbrev table in use in CPerl mode buffers.")
1135 1154
1136(add-hook 'edit-var-mode-alist '(perl-mode (regexp . "^cperl-"))) 1155(add-hook 'edit-var-mode-alist '(perl-mode (regexp . "^cperl-")))
@@ -1441,6 +1460,19 @@ the last)."
1441 "\\)?" ; END n+6=proto-group 1460 "\\)?" ; END n+6=proto-group
1442 )) 1461 ))
1443 1462
1463;;; Tired of editing this in 8 places every time I remember that there
1464;;; is another method-defining keyword
1465(defvar cperl-sub-keywords
1466 '("sub"))
1467
1468(defvar cperl-sub-regexp (regexp-opt cperl-sub-keywords))
1469
1470(defun cperl-char-ends-sub-keyword-p (char)
1471 "Return T if CHAR is the last character of a perl sub keyword."
1472 (loop for keyword in cperl-sub-keywords
1473 when (eq char (aref keyword (1- (length keyword))))
1474 return t))
1475
1444;;; Details of groups in this are used in `cperl-imenu--create-perl-index' 1476;;; Details of groups in this are used in `cperl-imenu--create-perl-index'
1445;;; and `cperl-outline-level'. 1477;;; and `cperl-outline-level'.
1446;;;; Was: 2=sub|package; now 2=package-group, 5=package-name 8=sub-name (+3) 1478;;;; Was: 2=sub|package; now 2=package-group, 5=package-name 8=sub-name (+3)
@@ -1452,7 +1484,8 @@ the last)."
1452 cperl-white-and-comment-rex ; 4 = pre-package-name 1484 cperl-white-and-comment-rex ; 4 = pre-package-name
1453 "\\([a-zA-Z_0-9:']+\\)\\)?\\)" ; 5 = package-name 1485 "\\([a-zA-Z_0-9:']+\\)\\)?\\)" ; 5 = package-name
1454 "\\|" 1486 "\\|"
1455 "[ \t]*sub" 1487 "[ \t]*"
1488 cperl-sub-regexp
1456 (cperl-after-sub-regexp 'named nil) ; 8=name 11=proto 14=attr-start 1489 (cperl-after-sub-regexp 'named nil) ; 8=name 11=proto 14=attr-start
1457 cperl-maybe-white-and-comment-rex ; 15=pre-block 1490 cperl-maybe-white-and-comment-rex ; 15=pre-block
1458 "\\|" 1491 "\\|"
@@ -1758,10 +1791,11 @@ or as help on variables `cperl-tips', `cperl-problems',
1758;;; (cperl-after-sub-regexp 'named nil) ; 8=name 11=proto 14=attr-start 1791;;; (cperl-after-sub-regexp 'named nil) ; 8=name 11=proto 14=attr-start
1759;;; cperl-maybe-white-and-comment-rex ; 15=pre-block 1792;;; cperl-maybe-white-and-comment-rex ; 15=pre-block
1760 (setq defun-prompt-regexp 1793 (setq defun-prompt-regexp
1761 (concat "^[ \t]*\\(sub" 1794 (concat "^[ \t]*\\("
1795 cperl-sub-regexp
1762 (cperl-after-sub-regexp 'named 'attr-groups) 1796 (cperl-after-sub-regexp 'named 'attr-groups)
1763 "\\|" ; per toke.c 1797 "\\|" ; per toke.c
1764 "\\(BEGIN\\|CHECK\\|INIT\\|END\\|AUTOLOAD\\|DESTROY\\)" 1798 "\\(BEGIN\\|UNITCHECK\\|CHECK\\|INIT\\|END\\|AUTOLOAD\\|DESTROY\\)"
1765 "\\)" 1799 "\\)"
1766 cperl-maybe-white-and-comment-rex)) 1800 cperl-maybe-white-and-comment-rex))
1767 (make-local-variable 'comment-indent-function) 1801 (make-local-variable 'comment-indent-function)
@@ -1904,10 +1938,11 @@ or as help on variables `cperl-tips', `cperl-problems',
1904(defun cperl-db () 1938(defun cperl-db ()
1905 (interactive) 1939 (interactive)
1906 (require 'gud) 1940 (require 'gud)
1941 ;; FIXME: Use `read-string' or `read-shell-command'?
1907 (perldb (read-from-minibuffer "Run perldb (like this): " 1942 (perldb (read-from-minibuffer "Run perldb (like this): "
1908 (if (consp gud-perldb-history) 1943 (if (consp gud-perldb-history)
1909 (car gud-perldb-history) 1944 (car gud-perldb-history)
1910 (concat "perl " 1945 (concat "perl -d "
1911 (buffer-file-name))) 1946 (buffer-file-name)))
1912 nil nil 1947 nil nil
1913 '(gud-perldb-history . 1)))) 1948 '(gud-perldb-history . 1))))
@@ -2223,6 +2258,7 @@ to nil."
2223 (save-excursion (or (not (re-search-backward "^=" nil t)) 2258 (save-excursion (or (not (re-search-backward "^=" nil t))
2224 (or 2259 (or
2225 (looking-at "=cut") 2260 (looking-at "=cut")
2261 (looking-at "=end")
2226 (and cperl-use-syntax-table-text-property 2262 (and cperl-use-syntax-table-text-property
2227 (not (eq (get-text-property (point) 2263 (not (eq (get-text-property (point)
2228 'syntax-type) 2264 'syntax-type)
@@ -2297,7 +2333,7 @@ to nil."
2297 (get-text-property (point) 'in-pod) 2333 (get-text-property (point) 'in-pod)
2298 (cperl-after-expr-p nil "{;:") 2334 (cperl-after-expr-p nil "{;:")
2299 (and (re-search-backward "\\(\\`\n?\\|^\n\\)=\\sw+" (point-min) t) 2335 (and (re-search-backward "\\(\\`\n?\\|^\n\\)=\\sw+" (point-min) t)
2300 (not (looking-at "\n*=cut")) 2336 (not (or (looking-at "\n*=cut") (looking-at "\n*=end")))
2301 (or (not cperl-use-syntax-table-text-property) 2337 (or (not cperl-use-syntax-table-text-property)
2302 (eq (get-text-property (point) 'syntax-type) 'pod)))))) 2338 (eq (get-text-property (point) 'syntax-type) 'pod))))))
2303 (progn 2339 (progn
@@ -2355,6 +2391,7 @@ to nil."
2355 beg t))) 2391 beg t)))
2356 (save-excursion (or (not (re-search-backward "^=" nil t)) 2392 (save-excursion (or (not (re-search-backward "^=" nil t))
2357 (looking-at "=cut") 2393 (looking-at "=cut")
2394 (looking-at "=end")
2358 (and cperl-use-syntax-table-text-property 2395 (and cperl-use-syntax-table-text-property
2359 (not (eq (get-text-property (point) 2396 (not (eq (get-text-property (point)
2360 'syntax-type) 2397 'syntax-type)
@@ -2454,7 +2491,7 @@ If in POD, insert appropriate lines."
2454 ;; We are after \n now, so look for the rest 2491 ;; We are after \n now, so look for the rest
2455 (if (looking-at "\\(\\`\n?\\|\n\\)=\\sw+") 2492 (if (looking-at "\\(\\`\n?\\|\n\\)=\\sw+")
2456 (progn 2493 (progn
2457 (setq cut (looking-at "\\(\\`\n?\\|\n\\)=cut\\>")) 2494 (setq cut (looking-at "\\(\\`\n?\\|\n\\)=\\(cut\\|end\\)\\>"))
2458 (setq over (looking-at "\\(\\`\n?\\|\n\\)=over\\>")) 2495 (setq over (looking-at "\\(\\`\n?\\|\n\\)=over\\>"))
2459 t))) 2496 t)))
2460 (if (and over 2497 (if (and over
@@ -2887,6 +2924,8 @@ Will not look before LIM."
2887 (cperl-backward-to-noncomment containing-sexp)) 2924 (cperl-backward-to-noncomment containing-sexp))
2888 ;; Now we get non-label preceding the indent point 2925 ;; Now we get non-label preceding the indent point
2889 (if (not (or (eq (1- (point)) containing-sexp) 2926 (if (not (or (eq (1- (point)) containing-sexp)
2927 (and cperl-indent-parens-as-block
2928 (not is-block))
2890 (memq (preceding-char) 2929 (memq (preceding-char)
2891 (append (if is-block " ;{" " ,;{") '(nil))) 2930 (append (if is-block " ;{" " ,;{") '(nil)))
2892 (and (eq (preceding-char) ?\}) 2931 (and (eq (preceding-char) ?\})
@@ -2962,12 +3001,13 @@ Will not look before LIM."
2962 ;; first thing on the line, say in the case of 3001 ;; first thing on the line, say in the case of
2963 ;; anonymous sub in a hash. 3002 ;; anonymous sub in a hash.
2964 (if (and;; Is it a sub in group starting on this line? 3003 (if (and;; Is it a sub in group starting on this line?
3004 cperl-indent-subs-specially
2965 (cond ((get-text-property (point) 'attrib-group) 3005 (cond ((get-text-property (point) 'attrib-group)
2966 (goto-char (cperl-beginning-of-property 3006 (goto-char (cperl-beginning-of-property
2967 (point) 'attrib-group))) 3007 (point) 'attrib-group)))
2968 ((eq (preceding-char) ?b) 3008 ((eq (preceding-char) ?b)
2969 (forward-sexp -1) 3009 (forward-sexp -1)
2970 (looking-at "sub\\>"))) 3010 (looking-at (concat cperl-sub-regexp "\\>"))))
2971 (setq p (nth 1 ; start of innermost containing list 3011 (setq p (nth 1 ; start of innermost containing list
2972 (parse-partial-sexp 3012 (parse-partial-sexp
2973 (point-at-bol) 3013 (point-at-bol)
@@ -3001,7 +3041,10 @@ Will not look before LIM."
3001 "Alist of indentation rules for CPerl mode. 3041 "Alist of indentation rules for CPerl mode.
3002The values mean: 3042The values mean:
3003 nil: do not indent; 3043 nil: do not indent;
3004 number: add this amount of indentation.") 3044 FUNCTION: a function to compute the indentation to use.
3045 Takes a single argument which provides the currently computed indentation
3046 context, and should return the column to which to indent.
3047 NUMBER: add this amount of indentation.")
3005 3048
3006(defun cperl-calculate-indent (&optional parse-data) ; was parse-start 3049(defun cperl-calculate-indent (&optional parse-data) ; was parse-start
3007 "Return appropriate indentation for current line as Perl code. 3050 "Return appropriate indentation for current line as Perl code.
@@ -3020,7 +3063,11 @@ and closing parentheses and brackets."
3020 ((vectorp i) 3063 ((vectorp i)
3021 (setq what (assoc (elt i 0) cperl-indent-rules-alist)) 3064 (setq what (assoc (elt i 0) cperl-indent-rules-alist))
3022 (cond 3065 (cond
3023 (what (cadr what)) ; Load from table 3066 (what
3067 (let ((action (cadr what)))
3068 (cond ((fboundp action) (apply action (list i parse-data)))
3069 ((numberp action) (+ action (current-indentation)))
3070 (t action))))
3024 ;; 3071 ;;
3025 ;; Indenters for regular expressions with //x and qw() 3072 ;; Indenters for regular expressions with //x and qw()
3026 ;; 3073 ;;
@@ -3746,7 +3793,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
3746 "\\([?/<]\\)" ; /blah/ or ?blah? or <file*glob> 3793 "\\([?/<]\\)" ; /blah/ or ?blah? or <file*glob>
3747 "\\|" 3794 "\\|"
3748 ;; 1+6+2+1+1=11 extra () before this 3795 ;; 1+6+2+1+1=11 extra () before this
3749 "\\<sub\\>" ; sub with proto/attr 3796 "\\<" cperl-sub-regexp "\\>" ; sub with proto/attr
3750 "\\(" 3797 "\\("
3751 cperl-white-and-comment-rex 3798 cperl-white-and-comment-rex
3752 "\\(::[a-zA-Z_:'0-9]*\\|[a-zA-Z_'][a-zA-Z_:'0-9]*\\)\\)?" ; name 3799 "\\(::[a-zA-Z_:'0-9]*\\|[a-zA-Z_'][a-zA-Z_:'0-9]*\\)\\)?" ; name
@@ -3759,7 +3806,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
3759 "\\|" 3806 "\\|"
3760 ;; 1+6+2+1+1+6+1=18 extra () before this (old pack'var syntax; 3807 ;; 1+6+2+1+1+6+1=18 extra () before this (old pack'var syntax;
3761 ;; we do not support intervening comments...): 3808 ;; we do not support intervening comments...):
3762 "\\(\\<sub[ \t\n\f]+\\|[&*$@%]\\)[a-zA-Z0-9_]*'" 3809 "\\(\\<" cperl-sub-regexp "[ \t\n\f]+\\|[&*$@%]\\)[a-zA-Z0-9_]*'"
3763 ;; 1+6+2+1+1+6+1+1=19 extra () before this: 3810 ;; 1+6+2+1+1+6+1+1=19 extra () before this:
3764 "\\|" 3811 "\\|"
3765 "__\\(END\\|DATA\\)__" ; __END__ or __DATA__ 3812 "__\\(END\\|DATA\\)__" ; __END__ or __DATA__
@@ -3834,7 +3881,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
3834 state-point b nil nil state) 3881 state-point b nil nil state)
3835 state-point b) 3882 state-point b)
3836 (if (or (nth 3 state) (nth 4 state) 3883 (if (or (nth 3 state) (nth 4 state)
3837 (looking-at "cut\\>")) 3884 (looking-at "\\(cut\\|\\end\\)\\>"))
3838 (if (or (nth 3 state) (nth 4 state) ignore-max) 3885 (if (or (nth 3 state) (nth 4 state) ignore-max)
3839 nil ; Doing a chunk only 3886 nil ; Doing a chunk only
3840 (message "=cut is not preceded by a POD section") 3887 (message "=cut is not preceded by a POD section")
@@ -3847,10 +3894,10 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
3847 b1 nil) ; error condition 3894 b1 nil) ; error condition
3848 ;; We do not search to max, since we may be called from 3895 ;; We do not search to max, since we may be called from
3849 ;; some hook of fontification, and max is random 3896 ;; some hook of fontification, and max is random
3850 (or (re-search-forward "^\n=cut\\>" stop-point 'toend) 3897 (or (re-search-forward "^\n=\\(cut\\|\\end\\)\\>" stop-point 'toend)
3851 (progn 3898 (progn
3852 (goto-char b) 3899 (goto-char b)
3853 (if (re-search-forward "\n=cut\\>" stop-point 'toend) 3900 (if (re-search-forward "\n=\\(cut\\|\\end\\)\\>" stop-point 'toend)
3854 (progn 3901 (progn
3855 (message "=cut is not preceded by an empty line") 3902 (message "=cut is not preceded by an empty line")
3856 (setq b1 t) 3903 (setq b1 t)
@@ -3957,7 +4004,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
3957 (progn 4004 (progn
3958 (forward-sexp -2) 4005 (forward-sexp -2)
3959 (not 4006 (not
3960 (looking-at "\\(printf?\\|system\\|exec\\|sort\\)\\>"))) 4007 (looking-at "\\(printf?\\|say\\|system\\|exec\\|sort\\)\\>")))
3961 (error t))))))) 4008 (error t)))))))
3962 (error nil))) ; func(<<EOF) 4009 (error nil))) ; func(<<EOF)
3963 (and (not (match-beginning 6)) ; Empty 4010 (and (not (match-beginning 6)) ; Empty
@@ -4141,7 +4188,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
4141 (not (memq (preceding-char) 4188 (not (memq (preceding-char)
4142 '(?$ ?@ ?& ?%))) 4189 '(?$ ?@ ?& ?%)))
4143 (looking-at 4190 (looking-at
4144 "\\(while\\|if\\|unless\\|until\\|and\\|or\\|not\\|xor\\|split\\|grep\\|map\\|print\\)\\>"))))) 4191 "\\(while\\|if\\|unless\\|until\\|and\\|or\\|not\\|xor\\|split\\|grep\\|map\\|print\\|say\\)\\>")))))
4145 (and (eq (preceding-char) ?.) 4192 (and (eq (preceding-char) ?.)
4146 (eq (char-after (- (point) 2)) ?.)) 4193 (eq (char-after (- (point) 2)) ?.))
4147 (bobp)) 4194 (bobp))
@@ -4797,8 +4844,8 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
4797 (setq stop t)))))) 4844 (setq stop t))))))
4798 4845
4799;; Used only in `cperl-calculate-indent'... 4846;; Used only in `cperl-calculate-indent'...
4800(defun cperl-block-p () ; Do not C-M-q ! One string contains ";" ! 4847(defun cperl-block-p ()
4801 ;; Positions is before ?\{. Checks whether it starts a block. 4848 "Point is before ?\\{. Checks whether it starts a block."
4802 ;; No save-excursion! This is more a distinguisher of a block/hash ref... 4849 ;; No save-excursion! This is more a distinguisher of a block/hash ref...
4803 (cperl-backward-to-noncomment (point-min)) 4850 (cperl-backward-to-noncomment (point-min))
4804 (or (memq (preceding-char) (append ";){}$@&%\C-@" nil)) ; Or label! \C-@ at bobp 4851 (or (memq (preceding-char) (append ";){}$@&%\C-@" nil)) ; Or label! \C-@ at bobp
@@ -4817,7 +4864,7 @@ the sections using `cperl-pod-head-face', `cperl-pod-face',
4817 (and (eq (preceding-char) ?b) 4864 (and (eq (preceding-char) ?b)
4818 (progn 4865 (progn
4819 (forward-sexp -1) 4866 (forward-sexp -1)
4820 (looking-at "sub[ \t\n\f#]"))))))))) 4867 (looking-at (concat cperl-sub-regexp "[ \t\n\f#]"))))))))))
4821 4868
4822;;; What is the difference of (cperl-after-block-p lim t) and (cperl-block-p)? 4869;;; What is the difference of (cperl-after-block-p lim t) and (cperl-block-p)?
4823;;; No save-excursion; condition-case ... In (cperl-block-p) the block 4870;;; No save-excursion; condition-case ... In (cperl-block-p) the block
@@ -4846,15 +4893,16 @@ statement would start; thus the block in ${func()} does not count."
4846 (save-excursion 4893 (save-excursion
4847 (forward-sexp -1) 4894 (forward-sexp -1)
4848 ;; else {} but not else::func {} 4895 ;; else {} but not else::func {}
4849 (or (and (looking-at "\\(else\\|continue\\|grep\\|map\\|BEGIN\\|END\\|CHECK\\|INIT\\)\\>") 4896 (or (and (looking-at "\\(else\\|catch\\|try\\|continue\\|grep\\|map\\|BEGIN\\|END\\|UNITCHECK\\|CHECK\\|INIT\\)\\>")
4850 (not (looking-at "\\(\\sw\\|_\\)+::"))) 4897 (not (looking-at "\\(\\sw\\|_\\)+::")))
4851 ;; sub f {} 4898 ;; sub f {}
4852 (progn 4899 (progn
4853 (cperl-backward-to-noncomment lim) 4900 (cperl-backward-to-noncomment lim)
4854 (and (eq (preceding-char) ?b) 4901 (and (cperl-char-ends-sub-keyword-p (preceding-char))
4855 (progn 4902 (progn
4856 (forward-sexp -1) 4903 (forward-sexp -1)
4857 (looking-at "sub[ \t\n\f#]")))))) 4904 (looking-at
4905 (concat cperl-sub-regexp "[ \t\n\f#]")))))))
4858 ;; What precedes is not word... XXXX Last statement in sub??? 4906 ;; What precedes is not word... XXXX Last statement in sub???
4859 (cperl-after-expr-p lim)))) 4907 (cperl-after-expr-p lim))))
4860 (error nil)))) 4908 (error nil))))
@@ -4970,7 +5018,7 @@ CHARS is a string that contains good characters to have before us (however,
4970 (forward-sexp -1) 5018 (forward-sexp -1)
4971 (not 5019 (not
4972 (looking-at 5020 (looking-at
4973 "\\(map\\|grep\\|printf?\\|system\\|exec\\|tr\\|s\\)\\>"))))))) 5021 "\\(map\\|grep\\|say\\|printf?\\|system\\|exec\\|tr\\|s\\)\\>")))))))
4974 5022
4975 5023
4976(defun cperl-indent-exp () 5024(defun cperl-indent-exp ()
@@ -5006,13 +5054,13 @@ conditional/loop constructs."
5006 (if (eq (following-char) ?$ ) ; for my $var (list) 5054 (if (eq (following-char) ?$ ) ; for my $var (list)
5007 (progn 5055 (progn
5008 (forward-sexp -1) 5056 (forward-sexp -1)
5009 (if (looking-at "\\(my\\|local\\|our\\)\\>") 5057 (if (looking-at "\\(state\\|my\\|local\\|our\\)\\>")
5010 (forward-sexp -1)))) 5058 (forward-sexp -1))))
5011 (if (looking-at 5059 (if (looking-at
5012 (concat "\\(\\elsif\\|if\\|unless\\|while\\|until" 5060 (concat "\\(\\elsif\\|if\\|unless\\|while\\|until"
5013 "\\|for\\(each\\)?\\>\\(\\(" 5061 "\\|for\\(each\\)?\\>\\(\\("
5014 cperl-maybe-white-and-comment-rex 5062 cperl-maybe-white-and-comment-rex
5015 "\\(my\\|local\\|our\\)\\)?" 5063 "\\(state\\|my\\|local\\|our\\)\\)?"
5016 cperl-maybe-white-and-comment-rex 5064 cperl-maybe-white-and-comment-rex
5017 "\\$[_a-zA-Z0-9]+\\)?\\)\\>")) 5065 "\\$[_a-zA-Z0-9]+\\)?\\)\\>"))
5018 (progn 5066 (progn
@@ -5097,7 +5145,7 @@ Returns some position at the last line."
5097 ;; Looking at: 5145 ;; Looking at:
5098 ;; foreach my $var 5146 ;; foreach my $var
5099 (if (looking-at 5147 (if (looking-at
5100 "[ \t]*\\<for\\(each\\)?[ \t]+\\(my\\|local\\|our\\)\\(\t*\\|[ \t][ \t]+\\)[^ \t\n]") 5148 "[ \t]*\\<for\\(each\\)?[ \t]+\\(state\\|my\\|local\\|our\\)\\(\t*\\|[ \t][ \t]+\\)[^ \t\n]")
5101 (progn 5149 (progn
5102 (forward-word-strictly 2) 5150 (forward-word-strictly 2)
5103 (delete-horizontal-space) 5151 (delete-horizontal-space)
@@ -5106,7 +5154,7 @@ Returns some position at the last line."
5106 ;; Looking at: 5154 ;; Looking at:
5107 ;; foreach my $var ( 5155 ;; foreach my $var (
5108 (if (looking-at 5156 (if (looking-at
5109 "[ \t]*\\<for\\(each\\)?[ \t]+\\(my\\|local\\|our\\)[ \t]*\\$[_a-zA-Z0-9]+\\(\t*\\|[ \t][ \t]+\\)[^ \t\n#]") 5157 "[ \t]*\\<for\\(each\\)?[ \t]+\\(state\\|my\\|local\\|our\\)[ \t]*\\$[_a-zA-Z0-9]+\\(\t*\\|[ \t][ \t]+\\)[^ \t\n#]")
5110 (progn 5158 (progn
5111 (forward-sexp 3) 5159 (forward-sexp 3)
5112 (delete-horizontal-space) 5160 (delete-horizontal-space)
@@ -5116,7 +5164,7 @@ Returns some position at the last line."
5116 ;; Looking at (with or without "}" at start, ending after "({"): 5164 ;; Looking at (with or without "}" at start, ending after "({"):
5117 ;; } foreach my $var () OR { 5165 ;; } foreach my $var () OR {
5118 (if (looking-at 5166 (if (looking-at
5119 "[ \t]*\\(}[ \t]*\\)?\\<\\(\\els\\(e\\|if\\)\\|continue\\|if\\|unless\\|while\\|for\\(each\\)?\\(\\([ \t]+\\(my\\|local\\|our\\)\\)?[ \t]*\\$[_a-zA-Z0-9]+\\)?\\|until\\)\\>\\([ \t]*(\\|[ \t\n]*{\\)\\|[ \t]*{") 5167 "[ \t]*\\(}[ \t]*\\)?\\<\\(\\els\\(e\\|if\\)\\|continue\\|if\\|unless\\|while\\|for\\(each\\)?\\(\\([ \t]+\\(state\\|my\\|local\\|our\\)\\)?[ \t]*\\$[_a-zA-Z0-9]+\\)?\\|until\\)\\>\\([ \t]*(\\|[ \t\n]*{\\)\\|[ \t]*{")
5120 (progn 5168 (progn
5121 (setq ml (match-beginning 8)) ; "(" or "{" after control word 5169 (setq ml (match-beginning 8)) ; "(" or "{" after control word
5122 (re-search-forward "[({]") 5170 (re-search-forward "[({]")
@@ -5681,10 +5729,18 @@ indentation and initial hashes. Behaves usually outside of comment."
5681 "\\(^\\|[^$@%&\\]\\)\\<\\(" 5729 "\\(^\\|[^$@%&\\]\\)\\<\\("
5682 (mapconcat 5730 (mapconcat
5683 'identity 5731 'identity
5684 '("if" "until" "while" "elsif" "else" "unless" "for" 5732 (append
5733 cperl-sub-keywords
5734 '("if" "until" "while" "elsif" "else"
5735 "given" "when" "default" "break"
5736 "unless" "for"
5737 "try" "catch" "finally"
5685 "foreach" "continue" "exit" "die" "last" "goto" "next" 5738 "foreach" "continue" "exit" "die" "last" "goto" "next"
5686 "redo" "return" "local" "exec" "sub" "do" "dump" "use" "our" 5739 "redo" "return" "local" "exec"
5687 "require" "package" "eval" "my" "BEGIN" "END" "CHECK" "INIT") 5740 "do" "dump"
5741 "use" "our"
5742 "require" "package" "eval" "evalbytes" "my" "state"
5743 "BEGIN" "END" "CHECK" "INIT" "UNITCHECK"))
5688 "\\|") ; Flow control 5744 "\\|") ; Flow control
5689 "\\)\\>") 2) ; was "\\)[ \n\t;():,|&]" 5745 "\\)\\>") 2) ; was "\\)[ \n\t;():,|&]"
5690 ; In what follows we use `type' style 5746 ; In what follows we use `type' style
@@ -5692,13 +5748,13 @@ indentation and initial hashes. Behaves usually outside of comment."
5692 (list 5748 (list
5693 (concat 5749 (concat
5694 "\\(^\\|[^$@%&\\]\\)\\<\\(" 5750 "\\(^\\|[^$@%&\\]\\)\\<\\("
5695 ;; "CORE" "__FILE__" "__LINE__" "abs" "accept" "alarm" 5751 ;; "CORE" "__FILE__" "__LINE__" "__SUB__" "abs" "accept" "alarm"
5696 ;; "and" "atan2" "bind" "binmode" "bless" "caller" 5752 ;; "and" "atan2" "bind" "binmode" "bless" "caller"
5697 ;; "chdir" "chmod" "chown" "chr" "chroot" "close" 5753 ;; "chdir" "chmod" "chown" "chr" "chroot" "close"
5698 ;; "closedir" "cmp" "connect" "continue" "cos" "crypt" 5754 ;; "closedir" "cmp" "connect" "continue" "cos" "crypt"
5699 ;; "dbmclose" "dbmopen" "die" "dump" "endgrent" 5755 ;; "dbmclose" "dbmopen" "die" "dump" "endgrent"
5700 ;; "endhostent" "endnetent" "endprotoent" "endpwent" 5756 ;; "endhostent" "endnetent" "endprotoent" "endpwent"
5701 ;; "endservent" "eof" "eq" "exec" "exit" "exp" "fcntl" 5757 ;; "endservent" "eof" "eq" "exec" "exit" "exp" "fc" "fcntl"
5702 ;; "fileno" "flock" "fork" "formline" "ge" "getc" 5758 ;; "fileno" "flock" "fork" "formline" "ge" "getc"
5703 ;; "getgrent" "getgrgid" "getgrnam" "gethostbyaddr" 5759 ;; "getgrent" "getgrgid" "getgrnam" "gethostbyaddr"
5704 ;; "gethostbyname" "gethostent" "getlogin" 5760 ;; "gethostbyname" "gethostent" "getlogin"
@@ -5721,7 +5777,7 @@ indentation and initial hashes. Behaves usually outside of comment."
5721 ;; "setsockopt" "shmctl" "shmget" "shmread" "shmwrite" 5777 ;; "setsockopt" "shmctl" "shmget" "shmread" "shmwrite"
5722 ;; "shutdown" "sin" "sleep" "socket" "socketpair" 5778 ;; "shutdown" "sin" "sleep" "socket" "socketpair"
5723 ;; "sprintf" "sqrt" "srand" "stat" "substr" "symlink" 5779 ;; "sprintf" "sqrt" "srand" "stat" "substr" "symlink"
5724 ;; "syscall" "sysopen" "sysread" "system" "syswrite" "tell" 5780 ;; "syscall" "sysopen" "sysread" "sysseek" "system" "syswrite" "tell"
5725 ;; "telldir" "time" "times" "truncate" "uc" "ucfirst" 5781 ;; "telldir" "time" "times" "truncate" "uc" "ucfirst"
5726 ;; "umask" "unlink" "unpack" "utime" "values" "vec" 5782 ;; "umask" "unlink" "unpack" "utime" "values" "vec"
5727 ;; "wait" "waitpid" "wantarray" "warn" "write" "x" "xor" 5783 ;; "wait" "waitpid" "wantarray" "warn" "write" "x" "xor"
@@ -5732,7 +5788,7 @@ indentation and initial hashes. Behaves usually outside of comment."
5732 "CORE\\|d\\(ie\\|bm\\(close\\|open\\)\\|ump\\)\\|" 5788 "CORE\\|d\\(ie\\|bm\\(close\\|open\\)\\|ump\\)\\|"
5733 "e\\(x\\(p\\|it\\|ec\\)\\|q\\|nd\\(p\\(rotoent\\|went\\)\\|" 5789 "e\\(x\\(p\\|it\\|ec\\)\\|q\\|nd\\(p\\(rotoent\\|went\\)\\|"
5734 "hostent\\|servent\\|netent\\|grent\\)\\|of\\)\\|" 5790 "hostent\\|servent\\|netent\\|grent\\)\\|of\\)\\|"
5735 "f\\(ileno\\|cntl\\|lock\\|or\\(k\\|mline\\)\\)\\|" 5791 "f\\(ileno\\|c\\(ntl\\)?\\|lock\\|or\\(k\\|mline\\)\\)\\|"
5736 "g\\(t\\|lob\\|mtime\\|e\\(\\|t\\(p\\(pid\\|r\\(iority\\|" 5792 "g\\(t\\|lob\\|mtime\\|e\\(\\|t\\(p\\(pid\\|r\\(iority\\|"
5737 "oto\\(byn\\(ame\\|umber\\)\\|ent\\)\\)\\|eername\\|w" 5793 "oto\\(byn\\(ame\\|umber\\)\\|ent\\)\\)\\|eername\\|w"
5738 "\\(uid\\|ent\\|nam\\)\\|grp\\)\\|host\\(by\\(addr\\|name\\)\\|" 5794 "\\(uid\\|ent\\|nam\\)\\|grp\\)\\|host\\(by\\(addr\\|name\\)\\|"
@@ -5750,12 +5806,12 @@ indentation and initial hashes. Behaves usually outside of comment."
5750 "\\(iority\\|otoent\\)\\|went\\|grp\\)\\|hostent\\|s\\(ervent\\|" 5806 "\\(iority\\|otoent\\)\\|went\\|grp\\)\\|hostent\\|s\\(ervent\\|"
5751 "ockopt\\)\\|netent\\|grent\\)\\|ek\\(\\|dir\\)\\|lect\\|" 5807 "ockopt\\)\\|netent\\|grent\\)\\|ek\\(\\|dir\\)\\|lect\\|"
5752 "m\\(ctl\\|op\\|get\\)\\|nd\\)\\|h\\(utdown\\|m\\(read\\|ctl\\|" 5808 "m\\(ctl\\|op\\|get\\)\\|nd\\)\\|h\\(utdown\\|m\\(read\\|ctl\\|"
5753 "write\\|get\\)\\)\\|y\\(s\\(read\\|call\\|open\\|tem\\|write\\)\\|" 5809 "write\\|get\\)\\)\\|y\\(s\\(read\\|call\\|open\\|tem\\|write\\|seek\\)\\|"
5754 "mlink\\)\\|in\\|leep\\|ocket\\(pair\\|\\)\\)\\|t\\(runcate\\|" 5810 "mlink\\)\\|in\\|leep\\|ocket\\(pair\\|\\)\\)\\|t\\(runcate\\|"
5755 "ell\\(\\|dir\\)\\|ime\\(\\|s\\)\\)\\|u\\(c\\(\\|first\\)\\|" 5811 "ell\\(\\|dir\\)\\|ime\\(\\|s\\)\\)\\|u\\(c\\(\\|first\\)\\|"
5756 "time\\|mask\\|n\\(pack\\|link\\)\\)\\|v\\(alues\\|ec\\)\\|" 5812 "time\\|mask\\|n\\(pack\\|link\\)\\)\\|v\\(alues\\|ec\\)\\|"
5757 "w\\(a\\(rn\\|it\\(pid\\|\\)\\|ntarray\\)\\|rite\\)\\|" 5813 "w\\(a\\(rn\\|it\\(pid\\|\\)\\|ntarray\\)\\|rite\\)\\|"
5758 "x\\(\\|or\\)\\|__\\(FILE__\\|LINE__\\|PACKAGE__\\)" 5814 "x\\(\\|or\\)\\|__\\(FILE\\|LINE\\|PACKAGE\\|SUB\\)__"
5759 "\\)\\>") 2 'font-lock-type-face) 5815 "\\)\\>") 2 'font-lock-type-face)
5760 ;; In what follows we use `other' style 5816 ;; In what follows we use `other' style
5761 ;; for nonoverwritable builtins 5817 ;; for nonoverwritable builtins
@@ -5763,24 +5819,24 @@ indentation and initial hashes. Behaves usually outside of comment."
5763 (list 5819 (list
5764 (concat 5820 (concat
5765 "\\(^\\|[^$@%&\\]\\)\\<\\(" 5821 "\\(^\\|[^$@%&\\]\\)\\<\\("
5766 ;; "AUTOLOAD" "BEGIN" "CHECK" "DESTROY" "END" "INIT" "__END__" "chomp" 5822 ;; "AUTOLOAD" "BEGIN" "CHECK" "DESTROY" "END" "INIT" "UNITCHECK" "__END__" "chomp"
5767 ;; "chop" "defined" "delete" "do" "each" "else" "elsif" 5823 ;; "break" "chop" "default" "defined" "delete" "do" "each" "else" "elsif"
5768 ;; "eval" "exists" "for" "foreach" "format" "goto" 5824 ;; "eval" "evalbytes" "exists" "for" "foreach" "format" "given" "goto"
5769 ;; "grep" "if" "keys" "last" "local" "map" "my" "next" 5825 ;; "grep" "if" "keys" "last" "local" "map" "my" "next"
5770 ;; "no" "our" "package" "pop" "pos" "print" "printf" "push" 5826 ;; "no" "our" "package" "pop" "pos" "print" "printf" "prototype" "push"
5771 ;; "q" "qq" "qw" "qx" "redo" "return" "scalar" "shift" 5827 ;; "q" "qq" "qw" "qx" "redo" "return" "say" "scalar" "shift"
5772 ;; "sort" "splice" "split" "study" "sub" "tie" "tr" 5828 ;; "sort" "splice" "split" "state" "study" "sub" "tie" "tr"
5773 ;; "undef" "unless" "unshift" "untie" "until" "use" 5829 ;; "undef" "unless" "unshift" "untie" "until" "use"
5774 ;; "while" "y" 5830 ;; "when" "while" "y"
5775 "AUTOLOAD\\|BEGIN\\|CHECK\\|cho\\(p\\|mp\\)\\|d\\(e\\(fined\\|lete\\)\\|" 5831 "AUTOLOAD\\|BEGIN\\|\\(UNIT\\)?CHECK\\|break\\|c\\(atch\\|ho\\(p\\|mp\\)\\)\\|d\\(e\\(f\\(inally\\|ault\\|ined\\)\\|lete\\)\\|"
5776 "o\\)\\|DESTROY\\|e\\(ach\\|val\\|xists\\|ls\\(e\\|if\\)\\)\\|" 5832 "o\\)\\|DESTROY\\|e\\(ach\\|val\\(bytes\\)?\\|xists\\|ls\\(e\\|if\\)\\)\\|"
5777 "END\\|for\\(\\|each\\|mat\\)\\|g\\(rep\\|oto\\)\\|INIT\\|if\\|keys\\|" 5833 "END\\|for\\(\\|each\\|mat\\)\\|g\\(iven\\|rep\\|oto\\)\\|INIT\\|if\\|keys\\|"
5778 "l\\(ast\\|ocal\\)\\|m\\(ap\\|y\\)\\|n\\(ext\\|o\\)\\|our\\|" 5834 "l\\(ast\\|ocal\\)\\|m\\(ap\\|y\\)\\|n\\(ext\\|o\\)\\|our\\|"
5779 "p\\(ackage\\|rint\\(\\|f\\)\\|ush\\|o\\(p\\|s\\)\\)\\|" 5835 "p\\(ackage\\|rototype\\|rint\\(\\|f\\)\\|ush\\|o\\(p\\|s\\)\\)\\|"
5780 "q\\(\\|q\\|w\\|x\\|r\\)\\|re\\(turn\\|do\\)\\|s\\(pli\\(ce\\|t\\)\\|" 5836 "q\\(\\|q\\|w\\|x\\|r\\)\\|re\\(turn\\|do\\)\\|s\\(ay\\|pli\\(ce\\|t\\)\\|"
5781 "calar\\|tudy\\|ub\\|hift\\|ort\\)\\|t\\(r\\|ie\\)\\|" 5837 "calar\\|t\\(ate\\|udy\\)\\|ub\\|hift\\|ort\\)\\|t\\(ry?\\|ied?\\)\\|"
5782 "u\\(se\\|n\\(shift\\|ti\\(l\\|e\\)\\|def\\|less\\)\\)\\|" 5838 "u\\(se\\|n\\(shift\\|ti\\(l\\|e\\)\\|def\\|less\\)\\)\\|"
5783 "while\\|y\\|__\\(END\\|DATA\\)__" ;__DATA__ added manually 5839 "wh\\(en\\|ile\\)\\|y\\|__\\(END\\|DATA\\)__" ;__DATA__ added manually
5784 "\\|[sm]" ; Added manually 5840 "\\|[sm]" ; Added manually
5785 "\\)\\>") 2 'cperl-nonoverridable-face) 5841 "\\)\\>") 2 'cperl-nonoverridable-face)
5786 ;; (mapconcat 'identity 5842 ;; (mapconcat 'identity
@@ -5792,7 +5848,7 @@ indentation and initial hashes. Behaves usually outside of comment."
5792 ;; This highlights declarations and definitions differently. 5848 ;; This highlights declarations and definitions differently.
5793 ;; We do not try to highlight in the case of attributes: 5849 ;; We do not try to highlight in the case of attributes:
5794 ;; it is already done by `cperl-find-pods-heres' 5850 ;; it is already done by `cperl-find-pods-heres'
5795 (list (concat "\\<sub" 5851 (list (concat "\\<" cperl-sub-regexp
5796 cperl-white-and-comment-rex ; whitespace/comments 5852 cperl-white-and-comment-rex ; whitespace/comments
5797 "\\([^ \n\t{;()]+\\)" ; 2=name (assume non-anonymous) 5853 "\\([^ \n\t{;()]+\\)" ; 2=name (assume non-anonymous)
5798 "\\(" 5854 "\\("
@@ -5834,14 +5890,14 @@ indentation and initial hashes. Behaves usually outside of comment."
5834 font-lock-string-face t) 5890 font-lock-string-face t)
5835 '("^[ \t]*\\([a-zA-Z0-9_]+[ \t]*:\\)[ \t]*\\($\\|{\\|\\<\\(until\\|while\\|for\\(each\\)?\\|do\\)\\>\\)" 1 5891 '("^[ \t]*\\([a-zA-Z0-9_]+[ \t]*:\\)[ \t]*\\($\\|{\\|\\<\\(until\\|while\\|for\\(each\\)?\\|do\\)\\>\\)" 1
5836 font-lock-constant-face) ; labels 5892 font-lock-constant-face) ; labels
5837 '("\\<\\(continue\\|next\\|last\\|redo\\|goto\\)\\>[ \t]+\\([a-zA-Z0-9_:]+\\)" ; labels as targets 5893 '("\\<\\(continue\\|next\\|last\\|redo\\|break\\|goto\\)\\>[ \t]+\\([a-zA-Z0-9_:]+\\)" ; labels as targets
5838 2 font-lock-constant-face) 5894 2 font-lock-constant-face)
5839 ;; Uncomment to get perl-mode-like vars 5895 ;; Uncomment to get perl-mode-like vars
5840 ;;; '("[$*]{?\\(\\sw+\\)" 1 font-lock-variable-name-face) 5896 ;;; '("[$*]{?\\(\\sw+\\)" 1 font-lock-variable-name-face)
5841 ;;; '("\\([@%]\\|\\$#\\)\\(\\sw+\\)" 5897 ;;; '("\\([@%]\\|\\$#\\)\\(\\sw+\\)"
5842 ;;; (2 (cons font-lock-variable-name-face '(underline)))) 5898 ;;; (2 (cons font-lock-variable-name-face '(underline))))
5843 (cond ((featurep 'font-lock-extra) 5899 (cond ((featurep 'font-lock-extra)
5844 '("^[ \t]*\\(my\\|local\\|our\\)[ \t]*\\(([ \t]*\\)?\\([$@%*][a-zA-Z0-9_:]+\\)\\([ \t]*,\\)?" 5900 '("^[ \t]*\\(state\\|my\\|local\\|our\\)[ \t]*\\(([ \t]*\\)?\\([$@%*][a-zA-Z0-9_:]+\\)\\([ \t]*,\\)?"
5845 (3 font-lock-variable-name-face) 5901 (3 font-lock-variable-name-face)
5846 (4 '(another 4 nil 5902 (4 '(another 4 nil
5847 ("\\=[ \t]*,[ \t]*\\([$@%*][a-zA-Z0-9_:]+\\)\\([ \t]*,\\)?" 5903 ("\\=[ \t]*,[ \t]*\\([$@%*][a-zA-Z0-9_:]+\\)\\([ \t]*,\\)?"
@@ -5850,7 +5906,7 @@ indentation and initial hashes. Behaves usually outside of comment."
5850 nil t))) ; local variables, multiple 5906 nil t))) ; local variables, multiple
5851 (font-lock-anchored 5907 (font-lock-anchored
5852 ;; 1=my_etc, 2=white? 3=(+white? 4=white? 5=var 5908 ;; 1=my_etc, 2=white? 3=(+white? 4=white? 5=var
5853 `(,(concat "\\<\\(my\\|local\\|our\\)" 5909 `(,(concat "\\<\\(state\\|my\\|local\\|our\\)"
5854 cperl-maybe-white-and-comment-rex 5910 cperl-maybe-white-and-comment-rex
5855 "\\((" 5911 "\\(("
5856 cperl-maybe-white-and-comment-rex 5912 cperl-maybe-white-and-comment-rex
@@ -5898,9 +5954,9 @@ indentation and initial hashes. Behaves usually outside of comment."
5898 'syntax-type 'multiline)) 5954 'syntax-type 'multiline))
5899 (setq cperl-font-lock-multiline-start nil))) 5955 (setq cperl-font-lock-multiline-start nil)))
5900 (3 font-lock-variable-name-face)))) 5956 (3 font-lock-variable-name-face))))
5901 (t '("^[ \t{}]*\\(my\\|local\\|our\\)[ \t]*\\(([ \t]*\\)?\\([$@%*][a-zA-Z0-9_:]+\\)" 5957 (t '("^[ \t{}]*\\(state\\|my\\|local\\|our\\)[ \t]*\\(([ \t]*\\)?\\([$@%*][a-zA-Z0-9_:]+\\)"
5902 3 font-lock-variable-name-face))) 5958 3 font-lock-variable-name-face)))
5903 '("\\<for\\(each\\)?\\([ \t]+\\(my\\|local\\|our\\)\\)?[ \t]*\\(\\$[a-zA-Z_][a-zA-Z_0-9]*\\)[ \t]*(" 5959 '("\\<for\\(each\\)?\\([ \t]+\\(state\\|my\\|local\\|our\\)\\)?[ \t]*\\(\\$[a-zA-Z_][a-zA-Z_0-9]*\\)[ \t]*("
5904 4 font-lock-variable-name-face) 5960 4 font-lock-variable-name-face)
5905 ;; Avoid $!, and s!!, qq!! etc. when not fontifying syntactically 5961 ;; Avoid $!, and s!!, qq!! etc. when not fontifying syntactically
5906 '("\\(?:^\\|[^smywqrx$]\\)\\(!\\)" 1 font-lock-negation-char-face) 5962 '("\\(?:^\\|[^smywqrx$]\\)\\(!\\)" 1 font-lock-negation-char-face)
@@ -5945,7 +6001,7 @@ indentation and initial hashes. Behaves usually outside of comment."
5945 (if cperl-highlight-variables-indiscriminately 6001 (if cperl-highlight-variables-indiscriminately
5946 (setq t-font-lock-keywords-1 6002 (setq t-font-lock-keywords-1
5947 (append t-font-lock-keywords-1 6003 (append t-font-lock-keywords-1
5948 (list '("\\([$*]{?\\sw+\\)" 1 6004 (list '("\\([$*]{?\\(?:\\sw+\\|::\\)+\\)" 1
5949 font-lock-variable-name-face))))) 6005 font-lock-variable-name-face)))))
5950 (setq cperl-font-lock-keywords-1 6006 (setq cperl-font-lock-keywords-1
5951 (if cperl-syntaxify-by-font-lock 6007 (if cperl-syntaxify-by-font-lock
@@ -6750,8 +6806,8 @@ in subdirectories too."
6750 (interactive) 6806 (interactive)
6751 (let ((cmd "etags") 6807 (let ((cmd "etags")
6752 (args '("-l" "none" "-r" 6808 (args '("-l" "none" "-r"
6753 ;; 1=fullname 2=package? 3=name 4=proto? 5=attrs? (VERY APPROX!) 6809 ;; 1=fullname 2=package? 3=name 4=proto? 5=attrs? (VERY APPROX!)
6754 "/\\<sub[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\(([^()]*)[ \t]*\\)?\\([ \t]*:[^#{;]*\\)?\\([{#]\\|$\\)/\\3/" 6810 "/\\<" cperl-sub-regexp "[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\(([^()]*)[ \t]*\\)?\\([ \t]*:[^#{;]*\\)?\\([{#]\\|$\\)/\\3/"
6755 "-r" 6811 "-r"
6756 "/\\<package[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\1/" 6812 "/\\<package[ \\t]+\\(\\([a-zA-Z0-9:_]*::\\)?\\([a-zA-Z0-9_]+\\)\\)[ \\t]*\\([#;]\\|$\\)/\\1/"
6757 "-r" 6813 "-r"
@@ -6980,7 +7036,7 @@ Does not move point."
6980 (number-to-string (1- (elt elt 1))) ; Char pos 0-based 7036 (number-to-string (1- (elt elt 1))) ; Char pos 0-based
6981 "\n") 7037 "\n")
6982 (if (and (string-match "^[_a-zA-Z]+::" (car elt)) 7038 (if (and (string-match "^[_a-zA-Z]+::" (car elt))
6983 (string-match "^sub[ \t]+\\([_a-zA-Z]+\\)[^:_a-zA-Z]" 7039 (string-match (concat "^" cperl-sub-regexp "[ \t]+\\([_a-zA-Z]+\\)[^:_a-zA-Z]")
6984 (elt elt 3))) 7040 (elt elt 3)))
6985 ;; Need to insert the name without package as well 7041 ;; Need to insert the name without package as well
6986 (setq lst (cons (cons (substring (elt elt 3) 7042 (setq lst (cons (cons (substring (elt elt 3)
@@ -7110,7 +7166,7 @@ Use as
7110 "^\\(" 7166 "^\\("
7111 "\\(package\\)\\>" 7167 "\\(package\\)\\>"
7112 "\\|" 7168 "\\|"
7113 "sub\\>[^\n]+::" 7169 cperl-sub-regexp "\\>[^\n]+::"
7114 "\\|" 7170 "\\|"
7115 "[a-zA-Z_][a-zA-Z_0-9:]*(\C-?[^\n]+::" ; XSUB? 7171 "[a-zA-Z_][a-zA-Z_0-9:]*(\C-?[^\n]+::" ; XSUB?
7116 "\\|" 7172 "\\|"
@@ -7372,6 +7428,7 @@ One may build such TAGS files from CPerl mode menu."
7372 "\\$." ; $| 7428 "\\$." ; $|
7373 "<<[a-zA-Z_'\"`]" ; <<FOO, <<'FOO' 7429 "<<[a-zA-Z_'\"`]" ; <<FOO, <<'FOO'
7374 "||" 7430 "||"
7431 "//"
7375 "&&" 7432 "&&"
7376 "[CBIXSLFZ]<\\(\\sw\\|\\s \\|\\s_\\|[\n]\\)*>" ; C<code like text> 7433 "[CBIXSLFZ]<\\(\\sw\\|\\s \\|\\s_\\|[\n]\\)*>" ; C<code like text>
7377 "-[a-zA-Z_0-9]+[ \t]*=>" ; -option => value 7434 "-[a-zA-Z_0-9]+[ \t]*=>" ; -option => value
@@ -7712,6 +7769,7 @@ $~ The name of the current report format.
7712... = ... Assignment. 7769... = ... Assignment.
7713... == ... Numeric equality. 7770... == ... Numeric equality.
7714... =~ ... Search pattern, substitution, or translation 7771... =~ ... Search pattern, substitution, or translation
7772... ~~ .. Smart match
7715... > ... Numeric greater than. 7773... > ... Numeric greater than.
7716... >= ... Numeric greater than or equal to. 7774... >= ... Numeric greater than or equal to.
7717... >> ... Bitwise shift right. 7775... >> ... Bitwise shift right.
@@ -7749,6 +7807,7 @@ ARGVOUT Output filehandle with -i flag.
7749BEGIN { ... } Immediately executed (during compilation) piece of code. 7807BEGIN { ... } Immediately executed (during compilation) piece of code.
7750END { ... } Pseudo-subroutine executed after the script finishes. 7808END { ... } Pseudo-subroutine executed after the script finishes.
7751CHECK { ... } Pseudo-subroutine executed after the script is compiled. 7809CHECK { ... } Pseudo-subroutine executed after the script is compiled.
7810UNITCHECK { ... }
7752INIT { ... } Pseudo-subroutine executed before the script starts running. 7811INIT { ... } Pseudo-subroutine executed before the script starts running.
7753DATA Input filehandle for what follows after __END__ or __DATA__. 7812DATA Input filehandle for what follows after __END__ or __DATA__.
7754accept(NEWSOCKET,GENERICSOCKET) 7813accept(NEWSOCKET,GENERICSOCKET)
@@ -7756,6 +7815,7 @@ alarm(SECONDS)
7756atan2(X,Y) 7815atan2(X,Y)
7757bind(SOCKET,NAME) 7816bind(SOCKET,NAME)
7758binmode(FILEHANDLE) 7817binmode(FILEHANDLE)
7818break Break out of a given/when statement
7759caller[(LEVEL)] 7819caller[(LEVEL)]
7760chdir(EXPR) 7820chdir(EXPR)
7761chmod(LIST) 7821chmod(LIST)
@@ -7771,6 +7831,7 @@ cos(EXPR)
7771crypt(PLAINTEXT,SALT) 7831crypt(PLAINTEXT,SALT)
7772dbmclose(%HASH) 7832dbmclose(%HASH)
7773dbmopen(%HASH,DBNAME,MODE) 7833dbmopen(%HASH,DBNAME,MODE)
7834default { ... } default case for given/when block
7774defined(EXPR) 7835defined(EXPR)
7775delete($HASH{KEY}) 7836delete($HASH{KEY})
7776die(LIST) 7837die(LIST)
@@ -7787,6 +7848,7 @@ endservent
7787eof[([FILEHANDLE])] 7848eof[([FILEHANDLE])]
7788... eq ... String equality. 7849... eq ... String equality.
7789eval(EXPR) or eval { BLOCK } 7850eval(EXPR) or eval { BLOCK }
7851evalbytes See eval.
7790exec([TRUENAME] ARGV0, ARGVs) or exec(SHELL_COMMAND_LINE) 7852exec([TRUENAME] ARGV0, ARGVs) or exec(SHELL_COMMAND_LINE)
7791exit(EXPR) 7853exit(EXPR)
7792exp(EXPR) 7854exp(EXPR)
@@ -7823,6 +7885,7 @@ getservbyport(PORT,PROTO)
7823getservent 7885getservent
7824getsockname(SOCKET) 7886getsockname(SOCKET)
7825getsockopt(SOCKET,LEVEL,OPTNAME) 7887getsockopt(SOCKET,LEVEL,OPTNAME)
7888given (EXPR) { [ when (EXPR) { ... } ]+ [ default { ... } ]? }
7826gmtime(EXPR) 7889gmtime(EXPR)
7827goto LABEL 7890goto LABEL
7828... gt ... String greater than. 7891... gt ... String greater than.
@@ -7883,6 +7946,7 @@ rewinddir(DIRHANDLE)
7883rindex(STR,SUBSTR[,OFFSET]) 7946rindex(STR,SUBSTR[,OFFSET])
7884rmdir(FILENAME) 7947rmdir(FILENAME)
7885s/PATTERN/REPLACEMENT/gieoxsm 7948s/PATTERN/REPLACEMENT/gieoxsm
7949say [FILEHANDLE] [(LIST)]
7886scalar(EXPR) 7950scalar(EXPR)
7887seek(FILEHANDLE,POSITION,WHENCE) 7951seek(FILEHANDLE,POSITION,WHENCE)
7888seekdir(DIRHANDLE,POS) 7952seekdir(DIRHANDLE,POS)
@@ -7917,6 +7981,7 @@ sprintf(FORMAT,LIST)
7917sqrt(EXPR) 7981sqrt(EXPR)
7918srand(EXPR) 7982srand(EXPR)
7919stat(EXPR|FILEHANDLE|VAR) 7983stat(EXPR|FILEHANDLE|VAR)
7984state VAR or state (VAR1,...) Introduces a static lexical variable
7920study[(SCALAR)] 7985study[(SCALAR)]
7921sub [NAME [(format)]] { BODY } sub NAME [(format)]; sub [(format)] {...} 7986sub [NAME [(format)]] { BODY } sub NAME [(format)]; sub [(format)] {...}
7922substr(EXPR,OFFSET[,LEN]) 7987substr(EXPR,OFFSET[,LEN])
@@ -7952,6 +8017,7 @@ x= ... Repetition assignment.
7952y/SEARCHLIST/REPLACEMENTLIST/ 8017y/SEARCHLIST/REPLACEMENTLIST/
7953... | ... Bitwise or. 8018... | ... Bitwise or.
7954... || ... Logical or. 8019... || ... Logical or.
8020... // ... Defined-or.
7955~ ... Unary bitwise complement. 8021~ ... Unary bitwise complement.
7956#! OS interpreter indicator. If contains `perl', used for options, and -x. 8022#! OS interpreter indicator. If contains `perl', used for options, and -x.
7957AUTOLOAD {...} Shorthand for `sub AUTOLOAD {...}'. 8023AUTOLOAD {...} Shorthand for `sub AUTOLOAD {...}'.
@@ -7972,6 +8038,7 @@ chr Converts a number to char with the same ordinal.
7972else Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}. 8038else Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
7973elsif Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}. 8039elsif Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}.
7974exists $HASH{KEY} True if the key exists. 8040exists $HASH{KEY} True if the key exists.
8041fc EXPR Returns the casefolded version of EXPR.
7975format [NAME] = Start of output format. Ended by a single dot (.) on a line. 8042format [NAME] = Start of output format. Ended by a single dot (.) on a line.
7976formline PICTURE, LIST Backdoor into \"format\" processing. 8043formline PICTURE, LIST Backdoor into \"format\" processing.
7977glob EXPR Synonym of <EXPR>. 8044glob EXPR Synonym of <EXPR>.
@@ -7983,6 +8050,7 @@ no PACKAGE [SYMBOL1, ...] Partial reverse for `use'. Runs `unimport' method.
7983not ... Low-precedence synonym for ! - negation. 8050not ... Low-precedence synonym for ! - negation.
7984... or ... Low-precedence synonym for ||. 8051... or ... Low-precedence synonym for ||.
7985pos STRING Set/Get end-position of the last match over this string, see \\G. 8052pos STRING Set/Get end-position of the last match over this string, see \\G.
8053prototype FUNC Returns the prototype of a function as a string, or undef.
7986quotemeta [ EXPR ] Quote regexp metacharacters. 8054quotemeta [ EXPR ] Quote regexp metacharacters.
7987qw/WORD1 .../ Synonym of split(\\='\\=', \\='WORD1 ...\\=') 8055qw/WORD1 .../ Synonym of split(\\='\\=', \\='WORD1 ...\\=')
7988readline FH Synonym of <FH>. 8056readline FH Synonym of <FH>.
@@ -8005,6 +8073,8 @@ prototype \\&SUB Returns prototype of the function given a reference.
8005=back End list. 8073=back End list.
8006=cut Switch from POD to Perl. 8074=cut Switch from POD to Perl.
8007=pod Switch from Perl to POD. 8075=pod Switch from Perl to POD.
8076=begin Switch from Perl6 to POD.
8077=end Switch from POD to Perl6.
8008") 8078")
8009 8079
8010(defun cperl-switch-to-doc-buffer (&optional interactive) 8080(defun cperl-switch-to-doc-buffer (&optional interactive)