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