1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-06 03:40:56 -08:00

Propertize only perl prototype chars `][$%&*;+@\' as punctuation

This prevents variables in signatures such as `sub add ($a, $b)' from
being treated as punctuation.
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function):
Strictly match only prototype characters as punctuation.  (Bug#26037)

Copyright-paperwork-exempt: yes
This commit is contained in:
Evgeni Kolev 2017-03-27 09:30:10 +03:00 committed by Noam Postavsky
parent f4ecb65f33
commit a184a7edc5

View file

@ -255,9 +255,11 @@
;; format statements
("^[ \t]*format.*=[ \t]*\\(\n\\)"
(1 (prog1 "\"" (perl-syntax-propertize-special-constructs end))))
;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'.
;; Be careful not to match "sub { (...) ... }".
("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([^)]+\\))"
;; Propertize perl prototype chars `$%&*;+@\[]' as punctuation
;; in `sub' arg-specs like `sub myfun ($)' and `sub ($)'. But
;; don't match subroutine signatures like `sub add ($a, $b)', or
;; anonymous subs like "sub { (...) ... }".
("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([][$%&*;+@\\]+\\))"
(1 "."))
;; Turn __DATA__ trailer into a comment.
("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)"