line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Build::Parse::Yapp; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24894
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
5
|
1
|
|
|
1
|
|
6
|
use base 'Module::Build'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
644
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1.1'; # VERSION |
8
|
|
|
|
|
|
|
# ABSTRACT: build Parse::Yapp parsers from source |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
77839
|
use File::Find; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
75
|
|
11
|
1
|
|
|
1
|
|
7
|
use File::Spec::Functions qw( catdir splitdir ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
70
|
|
12
|
1
|
|
|
1
|
|
538
|
use Parse::Yapp; |
|
1
|
|
|
|
|
19075
|
|
|
1
|
|
|
|
|
349
|
|
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
|
|
962
|
my( $inputfile, $outputfile, $classname ) = @_; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
19
|
my $parser = Parse::Yapp->new( inputfile => $inputfile ); |
50
|
1
|
|
|
|
|
7112
|
open( my $out, '>', $outputfile ); |
51
|
1
|
|
|
|
|
15
|
print $out $parser->Output( classname => $classname ); |
52
|
1
|
|
|
|
|
1212
|
close $out; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |