| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::Lite::Scanner::Moose; |
|
2
|
3
|
|
|
3
|
|
1312
|
use strict; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
170
|
|
|
3
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
109
|
|
|
4
|
3
|
|
|
3
|
|
13
|
use utf8; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
16
|
|
|
5
|
3
|
|
|
3
|
|
69
|
use Perl::PrereqScanner::Lite::Constants; |
|
|
3
|
|
|
|
|
3
|
|
|
|
3
|
|
|
|
|
1681
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub scan { |
|
8
|
205
|
|
|
205
|
0
|
187
|
my ($class, $c, $token, $token_type) = @_; |
|
9
|
|
|
|
|
|
|
|
|
10
|
205
|
|
|
|
|
322
|
my $token_data = $token->data; |
|
11
|
205
|
100
|
100
|
|
|
953
|
if ($token_type == KEY && ($token_data eq 'extends' || $token_data eq 'with')) { |
|
|
|
|
66
|
|
|
|
|
|
12
|
29
|
|
|
|
|
29
|
$c->{is_in_moose_inherited} = 1; |
|
13
|
29
|
|
|
|
|
66
|
return 1; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
|
|
16
|
176
|
100
|
|
|
|
260
|
if ($c->{is_in_moose_inherited}) { |
|
17
|
|
|
|
|
|
|
# to skip content which is is curly bracket -> { ... } |
|
18
|
|
|
|
|
|
|
{ |
|
19
|
163
|
100
|
|
|
|
108
|
if ($token_type == LEFT_BRACE) { |
|
|
163
|
|
|
|
|
211
|
|
|
20
|
3
|
|
|
|
|
3
|
$c->{is_in_moose_role_def} = 1; |
|
21
|
3
|
|
|
|
|
12
|
return 1; |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
160
|
100
|
|
|
|
203
|
if ($token_type == RIGHT_BRACE) { |
|
25
|
7
|
|
|
|
|
17
|
$c->{is_in_moose_role_def} = 0; |
|
26
|
7
|
|
|
|
|
23
|
return 1; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
153
|
100
|
|
|
|
205
|
if ($c->{is_in_moose_role_def}) { |
|
30
|
39
|
|
|
|
|
87
|
return 1; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# For qw() notation |
|
35
|
|
|
|
|
|
|
# e.g. |
|
36
|
|
|
|
|
|
|
# extends qw/Foo Bar/; |
|
37
|
|
|
|
|
|
|
# with qw/Foo Bar/; |
|
38
|
114
|
100
|
|
|
|
149
|
if ($token_type == REG_LIST) { |
|
39
|
4
|
|
|
|
|
7
|
$c->{is_in_moose_inherited_reglist} = 1; |
|
40
|
4
|
|
|
|
|
9
|
return 1; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
110
|
100
|
66
|
|
|
207
|
if ($c->{is_in_moose_inherited_reglist} && !$c->{does_exist_moose_garbage}) { |
|
43
|
8
|
100
|
|
|
|
15
|
if ($token_type == REG_EXP) { |
|
44
|
4
|
|
|
|
|
12
|
for my $_module_name (split /\s+/, $token_data) { |
|
45
|
8
|
|
|
|
|
15
|
$c->add_minimum($_module_name => 0); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
4
|
|
|
|
|
8
|
$c->{is_in_moose_inherited_reglist} = 0; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
8
|
|
|
|
|
20
|
return 1; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# For simply list |
|
53
|
|
|
|
|
|
|
# e.g. |
|
54
|
|
|
|
|
|
|
# extends ('Foo', 'Bar'); |
|
55
|
|
|
|
|
|
|
# with ('Foo', 'Bar'); |
|
56
|
102
|
100
|
|
|
|
136
|
if ($token_type == LEFT_PAREN) { |
|
57
|
5
|
|
|
|
|
6
|
$c->{is_in_moose_inherited_list} = 1; |
|
58
|
5
|
|
|
|
|
15
|
return 1; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
97
|
100
|
|
|
|
133
|
if ($token_type == RIGHT_PAREN) { |
|
61
|
5
|
|
|
|
|
6
|
$c->{is_in_moose_inherited_list} = 0; |
|
62
|
5
|
|
|
|
|
17
|
return 1; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
92
|
100
|
|
|
|
126
|
if ($c->{is_in_moose_inherited_list}) { |
|
65
|
23
|
100
|
100
|
|
|
105
|
if (($token_type == STRING || $token_type == RAW_STRING) && !$c->{does_exist_moose_garbage}) { |
|
|
|
|
66
|
|
|
|
|
|
66
|
12
|
|
|
|
|
24
|
$c->add_minimum($token_data => 0); |
|
67
|
|
|
|
|
|
|
} |
|
68
|
23
|
|
|
|
|
59
|
return 1; |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# For string |
|
72
|
|
|
|
|
|
|
# e.g. |
|
73
|
|
|
|
|
|
|
# extends "Foo" |
|
74
|
|
|
|
|
|
|
# with "Foo" |
|
75
|
69
|
100
|
100
|
|
|
273
|
if ((($token_type == STRING || $token_type == RAW_STRING)) && !$c->{does_exist_moose_garbage}) { |
|
|
|
|
100
|
|
|
|
|
|
76
|
20
|
|
|
|
|
34
|
$c->add_minimum($token_data => 0); |
|
77
|
20
|
|
|
|
|
55
|
return 1; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# End of extends or with |
|
81
|
49
|
100
|
|
|
|
70
|
if ($token_type == SEMI_COLON) { |
|
82
|
29
|
|
|
|
|
187
|
$c->{is_in_moose_inherited} = 0; |
|
83
|
29
|
|
|
|
|
31
|
$c->{is_in_moose_inherited_reglist} = 0; |
|
84
|
29
|
|
|
|
|
28
|
$c->{is_in_moose_inherited_list} = 0; |
|
85
|
29
|
|
|
|
|
24
|
$c->{does_exist_moose_garbage} = 0; |
|
86
|
29
|
|
|
|
|
69
|
return 1; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# For |
|
90
|
|
|
|
|
|
|
# extends 'Class1', 'Class2'; |
|
91
|
20
|
100
|
|
|
|
30
|
if ($token_type != COMMA) { |
|
92
|
12
|
|
|
|
|
12
|
$c->{does_exist_moose_garbage} = 1; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
20
|
|
|
|
|
44
|
return 1; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
13
|
|
|
|
|
34
|
return; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=encoding utf-8 |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Perl::PrereqScanner::Lite::Scanner::Moose - Extra Perl::PrereqScanner::Lite Scanner for Moose Family |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
use Perl::PrereqScanner::Lite; |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
my $scanner = Perl::PrereqScanner::Lite->new; |
|
114
|
|
|
|
|
|
|
$scanner->add_extra_scanner('Moose'); |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Perl::PrereqScanner::Lite::Scanner::Moose is the extra scanner for Perl::PrereqScanner::Lite. This scanner supports C and C notation for Moose family. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 LICENSE |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Copyright (C) moznion. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
125
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
moznion Emoznion@gmail.comE |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=cut |
|
132
|
|
|
|
|
|
|
|