line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Spellunker::Perl; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
1014
|
use utf8; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
6
|
|
5
|
1
|
|
|
1
|
|
48
|
use 5.010_001; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
38
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1137
|
use version; our $VERSION = version->declare("v0.3.2"); |
|
1
|
|
|
|
|
2574
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
929
|
use Spellunker; |
|
1
|
|
|
|
|
50113
|
|
|
1
|
|
|
|
|
73
|
|
10
|
1
|
|
|
1
|
|
1719
|
use PPI; |
|
1
|
|
|
|
|
216156
|
|
|
1
|
|
|
|
|
53
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
1017
|
use Mouse; |
|
1
|
|
|
|
|
30194
|
|
|
1
|
|
|
|
|
7
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has spellunker => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
default => sub { Spellunker->new() }, |
17
|
|
|
|
|
|
|
handles => [qw(add_stopwords load_dictionary)], |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has ppi => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
isa => 'PPI::Document', |
23
|
|
|
|
|
|
|
required => 1, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
424
|
no Mouse; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new_from_file { |
29
|
0
|
|
|
0
|
0
|
|
my ($class, $filename) = @_; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $ppi = PPI::Document->new($filename); |
32
|
0
|
|
|
|
|
|
return $class->new(ppi => $ppi); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new_from_string { |
36
|
0
|
|
|
0
|
0
|
|
my ($class, $string) = @_; |
37
|
0
|
|
|
|
|
|
my $ppi = PPI::Document->new(\$string); |
38
|
0
|
|
|
|
|
|
return $class->new(ppi => $ppi); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# TEST: |
42
|
|
|
|
|
|
|
# the real defaults are dfined in the parser |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# tokens: [$line_number, $content] |
45
|
|
|
|
|
|
|
sub _check_parser { |
46
|
0
|
|
|
0
|
|
|
my ($self, $token, $method) = @_; |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my @err = $self->{spellunker}->check_line($token->$method); |
49
|
0
|
0
|
|
|
|
|
if (@err) { |
50
|
0
|
|
|
|
|
|
return ([$token->line_number, $token->$method, \@err]); |
51
|
|
|
|
|
|
|
} |
52
|
0
|
|
|
|
|
|
return (); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub check_comment { |
56
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
|
|
my $comments = $self->ppi->find( sub { $_[1]->isa('PPI::Token::Comment') } ); |
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return map { $self->_check_parser($_, 'content') } @$comments; |
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub check_sub_name { |
63
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
0
|
|
|
my $comments = $self->ppi->find( sub { $_[1]->isa('PPI::Statement::Sub') } ); |
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
return map { $self->_check_parser($_, 'name') } @$comments; |
|
0
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# TEST: |
70
|
0
|
|
|
0
|
0
|
|
sub agument { } |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
# TEST: |
73
|
|
|
|
|
|
|
# template agument |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
__END__ |