perl-mode: Fix regexps for fontification
* test/lisp/progmodes/cperl-mode-tests.el (cperl-test-fontify-declarations): New test to ensure consistency between perl-mode.el and cperl-mode.el (bug#47345). * lisp/progmodes/perl-mode.el (perl-font-lock-keywords-1): pick correct capture groups for "use Pack::Age;" Fontify all components of "Pack::Age", not just "Pack" (perl-font-lock-keywords-2): Use keyword-face for declarators
This commit is contained in:
parent
39f16a7d39
commit
1ac8cd3ef6
2 changed files with 22 additions and 3 deletions
|
@ -170,9 +170,9 @@
|
|||
;; (1 font-lock-constant-face) (2 font-lock-variable-name-face nil t))
|
||||
;;
|
||||
;; Fontify function and package names in declarations.
|
||||
("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\sw+\\)?"
|
||||
("\\<\\(package\\|sub\\)\\>[ \t]*\\(\\(?:\\sw\\|::\\)+\\)?"
|
||||
(1 font-lock-keyword-face) (2 font-lock-function-name-face nil t))
|
||||
("\\(^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\sw+\\)?"
|
||||
("\\(?:^\\|[^$@%&\\]\\)\\<\\(import\\|no\\|require\\|use\\)\\>[ \t]*\\(\\(?:\\sw\\|::\\)+\\)?"
|
||||
(1 font-lock-keyword-face) (2 font-lock-constant-face nil t)))
|
||||
"Subdued level highlighting for Perl mode.")
|
||||
|
||||
|
@ -187,7 +187,7 @@
|
|||
"\\>")
|
||||
;;
|
||||
;; Fontify declarators and prefixes as types.
|
||||
("\\<\\(has\\|local\\|my\\|our\\|state\\)\\>" . font-lock-type-face) ; declarators
|
||||
("\\<\\(has\\|local\\|my\\|our\\|state\\)\\>" . font-lock-keyword-face) ; declarators
|
||||
;;
|
||||
;; Fontify function, variable and file name references.
|
||||
("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue