diff options
| author | Evgeni Kolev | 2017-03-27 09:30:10 +0300 |
|---|---|---|
| committer | Noam Postavsky | 2017-04-01 17:32:18 -0400 |
| commit | a184a7edc58e1e053aa317a0f162df7e225597e1 (patch) | |
| tree | eba0ab1b3f93daf19e5470eb6f1042d3d0256e41 | |
| parent | f4ecb65f335e450dfa8f0ee8a496ac78cbbfdc51 (diff) | |
| download | emacs-a184a7edc58e1e053aa317a0f162df7e225597e1.tar.gz emacs-a184a7edc58e1e053aa317a0f162df7e225597e1.zip | |
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
| -rw-r--r-- | lisp/progmodes/perl-mode.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el index a516f07e72f..b75f32ee200 100644 --- a/lisp/progmodes/perl-mode.el +++ b/lisp/progmodes/perl-mode.el | |||
| @@ -255,9 +255,11 @@ | |||
| 255 | ;; format statements | 255 | ;; format statements |
| 256 | ("^[ \t]*format.*=[ \t]*\\(\n\\)" | 256 | ("^[ \t]*format.*=[ \t]*\\(\n\\)" |
| 257 | (1 (prog1 "\"" (perl-syntax-propertize-special-constructs end)))) | 257 | (1 (prog1 "\"" (perl-syntax-propertize-special-constructs end)))) |
| 258 | ;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'. | 258 | ;; Propertize perl prototype chars `$%&*;+@\[]' as punctuation |
| 259 | ;; Be careful not to match "sub { (...) ... }". | 259 | ;; in `sub' arg-specs like `sub myfun ($)' and `sub ($)'. But |
| 260 | ("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([^)]+\\))" | 260 | ;; don't match subroutine signatures like `sub add ($a, $b)', or |
| 261 | ;; anonymous subs like "sub { (...) ... }". | ||
| 262 | ("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([][$%&*;+@\\]+\\))" | ||
| 261 | (1 ".")) | 263 | (1 ".")) |
| 262 | ;; Turn __DATA__ trailer into a comment. | 264 | ;; Turn __DATA__ trailer into a comment. |
| 263 | ("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)" | 265 | ("^\\(_\\)_\\(?:DATA\\|END\\)__[ \t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)" |