mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 12:31:25 +00:00
These were reported by happy-barney on GitHub https://github.com/HaraldJoerg/cperl-mode/issues * lisp/progmodes/cperl-mode.el (cperl-init-faces): Don't mistake $method as a method declaration. Move matcher for "use require" higher to prevent "require" being fontified as keyword. * test/lisp/progmodes/cperl-mode-resources/sub-names.pl: Add a test case for $method * test/lisp/progmodes/cperl-mode-tests.el (cperl-test-fontify-declarations): Add a test case for a module name looking like a keyword (cperl-test-fontify-sub-names): Verify that $method does not declare a method
34 lines
902 B
Perl
34 lines
902 B
Perl
use 5.038;
|
|
use feature 'class';
|
|
use warnings;
|
|
no warnings 'experimental';
|
|
|
|
class C {
|
|
# "method" is not yet understood by perl-mode, but it isn't
|
|
# relevant here: We can use "sub" because what matters is the
|
|
# name, which collides with a builtin.
|
|
sub m {
|
|
"m called"
|
|
}
|
|
}
|
|
|
|
say C->new->m;
|
|
|
|
# This comment has a method name in it, and we don't want "method"
|
|
# to be fontified as a keyword, nor "name" fontified as a name.
|
|
|
|
# Next is a variable named "$method" followed by a keyword. This
|
|
# keyword is not a subroutine name and should not be fontified
|
|
# accordingly. Reported by Branislav Zahradnik,
|
|
# https://github.com/HaraldJoerg/cperl-mode/issues/24
|
|
|
|
push @abstract, $method
|
|
unless defined &$method
|
|
;
|
|
|
|
__END__
|
|
|
|
=head1 Test using the keywords POD
|
|
|
|
This piece of POD has a method name in it, and we don't want "method"
|
|
to be fontified as a keyword, nor "name" fontified as a name.
|