mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
cperl-mode.el: Add support for new Perl syntax in Perl 5.36 and 5.38
Perl 5.38 was released on 2023-07-03. This patch supports the new features for 5.36 and 5.38 for font-lock, indentation, and imenu index creation. * lisp/progmodes/cperl-mode.el (cperl-praise): Mention classes. (defconst): Fix typo in docstring of cperl--single-attribute-rx. Add "class" to cperl--package-rx, and adjust its docstring. New rx sequence cperl--class-for-imenu-rx to capture classes, use this in cperl--imenu-entries-rx. Add "method" to cperl--sub-name-for-imenu-rx. Add "class" to cperl--block-declaration-rx. (cperl-sub-keywords): Add "method". (cperl-mode): Add "ADJUST" to defun-prompt-regexp. (cperl-after-block-p): Add new keywords for Perl 5.36 and 5.38. (cperl-indent-exp): Add "field" to expression starters. (cperl-imenu--create-perl-index): Rename variables refering to "package", because they also contain classes. (cperl-init-faces): Add new keywords for Perl 5.36 and 5.38. (cperl-find-tags): Add support for "class". (cperl-short-docs): Add new keywords for Perl 5.36 and 5.38. (cperl-indent-exp): Add new keywords for Perl 5.36 and 5.38. * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-fontify-class): New test for fontification of class elements. (cperl-test-imenu-index): Add tests for (nested) class definitions. * test/lisp/progmodes/cperl-mode-resources/cperl-indents.erts: Add test cases for try/catch/finally, defer, class, method * test/lisp/progmodes/cperl-mode-resources/perl-class.pl: New resource for fontification tests of class elements. * test/lisp/progmodes/cperl-mode-resources/grammar.pl: Add some classes to the test resource.
This commit is contained in:
parent
32b092c142
commit
766784f186
5 changed files with 246 additions and 61 deletions
|
|
@ -169,4 +169,29 @@ sub erdős_number {
|
|||
}
|
||||
}
|
||||
|
||||
=head1 And now, for something completely different
|
||||
|
||||
Perl 5.38 supports classes with the same scope weirdness as packages.
|
||||
As long as this is experimental, CPAN tools don't play well with this,
|
||||
so some weird constructs are recommended to authors of CPAN modules.
|
||||
|
||||
=cut
|
||||
|
||||
package Class::Class;
|
||||
|
||||
our $VERSION = 0.01;
|
||||
|
||||
class Class::Class 0.01 {
|
||||
method init ($with,$signature) {
|
||||
...;
|
||||
}
|
||||
|
||||
class Class::Inner :isa(Class::Class);
|
||||
# This class comes without a block, so takes over until the rest
|
||||
# of the containing block.
|
||||
method init_again (@with_parameters) {
|
||||
...;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue