line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
3447
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
57
|
|
2
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
102
|
|
3
|
|
|
|
|
|
|
package Devel::REPL::Plugin::CompletionDriver::Keywords; |
4
|
|
|
|
|
|
|
# ABSTRACT: Complete Perl keywords and operators |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.003028'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
7
|
use Devel::REPL::Plugin; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12
|
|
9
|
2
|
|
|
2
|
|
6265
|
use Devel::REPL::Plugin::Completion; # die early if cannot load |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
10
|
2
|
|
|
2
|
|
463
|
use B::Keywords qw/@Functions @Barewords/; |
|
2
|
|
|
|
|
821
|
|
|
2
|
|
|
|
|
242
|
|
11
|
2
|
|
|
2
|
|
9
|
use namespace::autoclean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
13
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub BEFORE_PLUGIN { |
14
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
15
|
1
|
|
|
|
|
4
|
$self->load_plugin('Completion'); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
around complete => sub { |
19
|
|
|
|
|
|
|
my $orig = shift; |
20
|
|
|
|
|
|
|
my ($self, $text, $document) = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
my $last = $self->last_ppi_element($document); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return $orig->(@_) |
25
|
|
|
|
|
|
|
unless $last->isa('PPI::Token::Word'); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# don't complete keywords on foo->method |
28
|
|
|
|
|
|
|
return $orig->(@_) |
29
|
|
|
|
|
|
|
if $last->sprevious_sibling |
30
|
|
|
|
|
|
|
&& $last->sprevious_sibling->isa('PPI::Token::Operator') |
31
|
|
|
|
|
|
|
&& $last->sprevious_sibling->content eq '->'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $re = qr/^\Q$last/; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return $orig->(@_), |
36
|
|
|
|
|
|
|
grep { $_ =~ $re } @Functions, @Barewords; |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=pod |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=encoding UTF-8 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 NAME |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Devel::REPL::Plugin::CompletionDriver::Keywords - Complete Perl keywords and operators |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 VERSION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
version 1.003028 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 SUPPORT |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> |
58
|
|
|
|
|
|
|
(or L<bug-Devel-REPL@rt.cpan.org|mailto:bug-Devel-REPL@rt.cpan.org>). |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
61
|
|
|
|
|
|
|
L<C<#devel> on C<irc.perl.org>|irc://irc.perl.org/#devel-repl>. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Shawn M Moore, C<< <sartak at gmail dot com> >> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This software is copyright (c) 2007 by Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>). |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
72
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |