Skip to content

Commit

Permalink
cperl-mode: Improve detection of index entries for imenu
Browse files Browse the repository at this point in the history
* lisp/progmodes/cperl-mode.el
(cperl-imenu-addback): Customization variable deleted.  This
variable has been declared obsolete in 1998.
(cperl--basic-identifier-regexp) and many other variables:
defining regular expressions for basic Perl constructs.
(cperl-imenu--create-perl-index): This function has been
completely rewritten, keeping only some parts of the output
formatting.  It now recognizes a lot more package and
subroutine declarations which came since Perl 5.14: Packages
with a version and/or a block attached, lexical subroutines,
declarations with a newline between the keyword "package" and
the package name, and several more.  This version also
correctly separates subroutine names from attributes, does no
longer support "unnamed" packages (which don't exist in Perl),
and doesn't fall for false positives like stuff that looks
like a declaration in a multiline string.
(cperl-tags-hier-init): Eliminate call to
`cperl-imenu-addback` (which actually was commented out in
1997)

* test/lisp/progmodes/cperl-mode-tests.el
(cperl-test--validate-regexp) and six other new tests for the
new regular expressions and the index creation.

* test/lisp/progmodes/cperl-mode-resources/grammar.pl: New
file showcasing different syntax variations for package and
sub declarations (bug#46574).
  • Loading branch information
HaraldJoerg authored and larsmagne committed Feb 16, 2021
1 parent 64ef8ff commit 7b2448a
Show file tree
Hide file tree
Showing 3 changed files with 484 additions and 129 deletions.
Loading

0 comments on commit 7b2448a

Please sign in to comment.