line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::Parse::Yapp; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24670
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
5
|
1
|
|
|
1
|
|
7
|
use base 'Module::Build'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
640
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1.0'; # VERSION |
8
|
|
|
|
|
|
|
# ABSTRACT: build Parse::Yapp parsers from source |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
76042
|
use File::Find; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
71
|
|
11
|
1
|
|
|
1
|
|
6
|
use File::Spec::Functions; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
96
|
|
12
|
1
|
|
|
1
|
|
498
|
use Parse::Yapp; |
|
1
|
|
|
|
|
18310
|
|
|
1
|
|
|
|
|
339
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new { |
15
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
16
|
0
|
|
|
|
|
0
|
my %args = @_; |
17
|
0
|
|
|
|
|
0
|
$self->SUPER::new( %args ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub process_yp_files { |
21
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
find( { wanted => \&_find_parser, no_chdir => 1 }, 'lib' ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _find_parser { |
27
|
0
|
0
|
|
0
|
|
0
|
return unless /\.yp$/; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
my $pmfile = $_; |
30
|
0
|
|
|
|
|
0
|
$pmfile =~ s/\.yp$/.pm/; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
my @path = splitdir( $File::Find::name ); |
33
|
0
|
|
|
|
|
0
|
my @pmpath = my @namespace = @path; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
unshift @pmpath, 'blib'; |
36
|
0
|
|
|
|
|
0
|
$pmpath[-1] =~ s/\.yp$/.pm/; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
0
|
shift @namespace; |
39
|
0
|
|
|
|
|
0
|
$namespace[-1] =~ s/\.yp$//; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
_make_parser( $File::Find::name, |
42
|
|
|
|
|
|
|
catdir( @pmpath ), |
43
|
|
|
|
|
|
|
join '::', @namespace ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _make_parser { |
47
|
1
|
|
|
1
|
|
889
|
my( $inputfile, $outputfile, $classname ) = @_; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
14
|
my $parser = Parse::Yapp->new( inputfile => $inputfile ); |
50
|
1
|
|
|
|
|
7097
|
open( my $out, '>', $outputfile ); |
51
|
1
|
|
|
|
|
14
|
print $out $parser->Output( classname => $classname ); |
52
|
1
|
|
|
|
|
1155
|
close $out; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |