mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
;cperl-mode.el: Avoid false positives when parsing new Perl syntax
* lisp/progmodes/cperl-mode.el (cperl--package-for-imenu-rx) (cperl--class-for-imenu-rx): avoid false positives when collecting imenu entries * lisp/progmodes/cperl-mode.el (cperl-init-faces): avoid false positives when detecting package names * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-imenu-index): Add test verifying that $class_false is not shown as a class _false * test/lisp/progmodes/cperl-mode-resources/grammar.pl: Add a line containing a false positive "$class_false"
This commit is contained in:
parent
14f7506c99
commit
39e3c30b51
@ -1392,7 +1392,7 @@ Contains three groups for the initial keyword \"package\" or
|
||||
(defconst cperl--package-for-imenu-rx
|
||||
`(sequence symbol-start
|
||||
(group-n 1 "package")
|
||||
,cperl--ws*-rx
|
||||
,cperl--ws+-rx
|
||||
(group-n 2 ,cperl--normal-identifier-rx)
|
||||
(optional (sequence ,cperl--ws+-rx
|
||||
(regexp ,cperl--version-regexp)))
|
||||
@ -1408,9 +1408,9 @@ name, and one for the discovery of a following BLOCK.")
|
||||
;; (e.g. ":isa(Parent)") while packages don't. We skip over it, but
|
||||
;; like for "package" we capture the following ";" or "{".
|
||||
(defconst cperl--class-for-imenu-rx
|
||||
`(sequence symbol-start
|
||||
`(sequence (or space line-start)
|
||||
(group-n 1 "class")
|
||||
,cperl--ws*-rx
|
||||
,cperl--ws+-rx
|
||||
(group-n 2 ,cperl--normal-identifier-rx)
|
||||
(optional (sequence ,cperl--ws+-rx
|
||||
(regexp ,cperl--version-regexp)))
|
||||
@ -6395,7 +6395,7 @@ functions (which they are not). Inherits from `default'.")
|
||||
;; -------- various stuff calling for a package name
|
||||
;; (matcher (subexp facespec) (subexp facespec))
|
||||
`(,(rx (sequence
|
||||
(or (sequence symbol-start
|
||||
(or (sequence (or line-start space "{" )
|
||||
(or "package" "require" "use" "import"
|
||||
"no" "bootstrap" "class")
|
||||
(eval cperl--ws+-rx))
|
||||
|
@ -192,6 +192,9 @@ package Class::Class;
|
||||
method init_again (@with_parameters) {
|
||||
...;
|
||||
}
|
||||
|
||||
# A false positive
|
||||
my $class_false;
|
||||
}
|
||||
|
||||
=head1 Perl 5.40 brings new stuff
|
||||
|
@ -977,7 +977,8 @@ created by CPerl mode, so skip it for Perl mode."
|
||||
"With::Readers::auto_reader"
|
||||
"With::Readers::named")))
|
||||
(dolist (sub expected)
|
||||
(should (assoc-string sub index)))))))
|
||||
(should (assoc-string sub index))))
|
||||
(should-not (assoc-string "_false" index)))))
|
||||
|
||||
;;; Tests for issues reported in the Bug Tracker
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user