line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::Lite::Scanner::Moose; |
2
|
1
|
|
|
1
|
|
1406
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
17
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
9
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
19
|
use Perl::PrereqScanner::Lite::Constants; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
432
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub scan { |
8
|
0
|
|
|
0
|
0
|
|
my ($class, $c, $token, $token_type) = @_; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
my $token_data = $token->data; |
11
|
0
|
0
|
0
|
|
|
|
if ($token_type == KEY && ($token_data eq 'extends' || $token_data eq 'with')) { |
|
|
|
0
|
|
|
|
|
12
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited} = 1; |
13
|
0
|
|
|
|
|
|
return 1; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if ($c->{is_in_moose_inherited}) { |
17
|
|
|
|
|
|
|
# to skip content which is is curly bracket -> { ... } |
18
|
|
|
|
|
|
|
{ |
19
|
0
|
0
|
|
|
|
|
if ($token_type == LEFT_BRACE) { |
|
0
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$c->{is_in_moose_role_def} = 1; |
21
|
0
|
|
|
|
|
|
return 1; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
if ($token_type == RIGHT_BRACE) { |
25
|
0
|
|
|
|
|
|
$c->{is_in_moose_role_def} = 0; |
26
|
0
|
|
|
|
|
|
return 1; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ($c->{is_in_moose_role_def}) { |
30
|
0
|
|
|
|
|
|
return 1; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# For qw() notation |
35
|
|
|
|
|
|
|
# e.g. |
36
|
|
|
|
|
|
|
# extends qw/Foo Bar/; |
37
|
|
|
|
|
|
|
# with qw/Foo Bar/; |
38
|
0
|
0
|
|
|
|
|
if ($token_type == REG_LIST) { |
39
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited_reglist} = 1; |
40
|
0
|
|
|
|
|
|
return 1; |
41
|
|
|
|
|
|
|
} |
42
|
0
|
0
|
0
|
|
|
|
if ($c->{is_in_moose_inherited_reglist} && !$c->{does_exist_moose_garbage}) { |
43
|
0
|
0
|
|
|
|
|
if ($token_type == REG_EXP) { |
44
|
0
|
|
|
|
|
|
for my $_module_name (split /\s+/, $token_data) { |
45
|
0
|
|
|
|
|
|
$c->add_minimum($_module_name => 0); |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited_reglist} = 0; |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
return 1; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# For simply list |
53
|
|
|
|
|
|
|
# e.g. |
54
|
|
|
|
|
|
|
# extends ('Foo', 'Bar'); |
55
|
|
|
|
|
|
|
# with ('Foo', 'Bar'); |
56
|
0
|
0
|
|
|
|
|
if ($token_type == LEFT_PAREN) { |
57
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited_list} = 1; |
58
|
0
|
|
|
|
|
|
return 1; |
59
|
|
|
|
|
|
|
} |
60
|
0
|
0
|
|
|
|
|
if ($token_type == RIGHT_PAREN) { |
61
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited_list} = 0; |
62
|
0
|
|
|
|
|
|
return 1; |
63
|
|
|
|
|
|
|
} |
64
|
0
|
0
|
|
|
|
|
if ($c->{is_in_moose_inherited_list}) { |
65
|
0
|
0
|
0
|
|
|
|
if (($token_type == STRING || $token_type == RAW_STRING) && !$c->{does_exist_moose_garbage}) { |
|
|
|
0
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$c->add_minimum($token_data => 0); |
67
|
|
|
|
|
|
|
} |
68
|
0
|
|
|
|
|
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# For string |
72
|
|
|
|
|
|
|
# e.g. |
73
|
|
|
|
|
|
|
# extends "Foo" |
74
|
|
|
|
|
|
|
# with "Foo" |
75
|
0
|
0
|
0
|
|
|
|
if ((($token_type == STRING || $token_type == RAW_STRING)) && !$c->{does_exist_moose_garbage}) { |
|
|
|
0
|
|
|
|
|
76
|
0
|
|
|
|
|
|
$c->add_minimum($token_data => 0); |
77
|
0
|
|
|
|
|
|
return 1; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# End of extends or with |
81
|
0
|
0
|
|
|
|
|
if ($token_type == SEMI_COLON) { |
82
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited} = 0; |
83
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited_reglist} = 0; |
84
|
0
|
|
|
|
|
|
$c->{is_in_moose_inherited_list} = 0; |
85
|
0
|
|
|
|
|
|
$c->{does_exist_moose_garbage} = 0; |
86
|
0
|
|
|
|
|
|
return 1; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# For |
90
|
|
|
|
|
|
|
# extends 'Class1', 'Class2'; |
91
|
0
|
0
|
|
|
|
|
if ($token_type != COMMA) { |
92
|
0
|
|
|
|
|
|
$c->{does_exist_moose_garbage} = 1; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
return 1; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|