line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
7
|
|
|
7
|
|
443295
|
use strict; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
253
|
|
2
|
7
|
|
|
7
|
|
42
|
use warnings; |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
390
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Paludis::ResumeState::Serialization::Grammar; |
5
|
|
|
|
|
|
|
BEGIN { |
6
|
7
|
|
|
7
|
|
249
|
$Paludis::ResumeState::Serialization::Grammar::AUTHORITY = 'cpan:KENTNL'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
{ |
9
|
|
|
|
|
|
|
$Paludis::ResumeState::Serialization::Grammar::VERSION = '0.01000410'; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# ABSTRACT: A Regexp::Grammars grammar for parsing Paludis Resume-states |
13
|
|
|
|
|
|
|
|
14
|
7
|
|
|
7
|
|
19011
|
use Regexp::Grammars; |
|
7
|
|
|
|
|
372300
|
|
|
7
|
|
|
|
|
81
|
|
15
|
7
|
|
|
7
|
|
52658
|
use Regexp::Grammars::Common::String; |
|
7
|
|
|
|
|
61969
|
|
|
7
|
|
|
|
|
3287
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $CLASS_CALLBACK; |
19
|
|
|
|
|
|
|
our $LIST_CALLBACK; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
{ |
22
|
|
|
|
|
|
|
## no critic ( ProhibitMultiplePackages ) |
23
|
|
|
|
|
|
|
package # Hide |
24
|
|
|
|
|
|
|
Paludis::ResumeState::Serialization::Grammar::FakeClass; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
package # Hide |
27
|
|
|
|
|
|
|
Paludis::ResumeState::Serialization::Grammar::FakeList; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _classize { |
31
|
688
|
|
|
688
|
|
4439
|
my ( $name, $parameters, $parameters_list, $extra ) = @_; |
32
|
688
|
100
|
|
|
|
1905
|
if ( defined $CLASS_CALLBACK ) { |
33
|
570
|
|
|
|
|
1919
|
return $CLASS_CALLBACK->( $name, $parameters, $parameters_list, $extra ); |
34
|
|
|
|
|
|
|
} |
35
|
118
|
|
|
|
|
508
|
bless $parameters, __PACKAGE__ . '::FakeClass'; |
36
|
118
|
|
|
|
|
241
|
$parameters->{_classname} = $name; |
37
|
118
|
|
|
|
|
5301
|
return $parameters; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _listize { |
41
|
398
|
|
|
398
|
|
609
|
my ($parameters) = @_; |
42
|
398
|
100
|
|
|
|
1024
|
if ( defined $LIST_CALLBACK ) { |
43
|
132
|
|
|
|
|
631
|
return $LIST_CALLBACK->($parameters); |
44
|
|
|
|
|
|
|
} |
45
|
266
|
|
|
|
|
1011
|
bless $parameters, __PACKAGE__ . '::FakeArray'; |
46
|
266
|
|
|
|
|
10792
|
return $parameters; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $t; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub grammar { |
53
|
11
|
100
|
|
11
|
1
|
167
|
_build_grammar() unless defined $t; |
54
|
11
|
|
|
|
|
39
|
return $t; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _build_grammar { |
58
|
|
|
|
|
|
|
## no critic ( RegularExpressions ) |
59
|
|
|
|
|
|
|
$t = qr{ |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
@ |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
\(\) |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
(?{ |
73
|
|
|
|
|
|
|
if( ref $MATCH{parameters} ){ |
74
|
|
|
|
|
|
|
my @parameters = @{$MATCH{parameters}}; |
75
|
|
|
|
|
|
|
my %hash; |
76
|
|
|
|
|
|
|
my @list; |
77
|
|
|
|
|
|
|
my %extra = (); |
78
|
|
|
|
|
|
|
my $i; |
79
|
|
|
|
|
|
|
for( @parameters ){ |
80
|
|
|
|
|
|
|
$hash{$_->{label}} = $_->{value}; |
81
|
|
|
|
|
|
|
push @list, [ $_->{label} , $_->{value} ]; |
82
|
|
|
|
|
|
|
$i++; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
if( scalar keys %hash == $i ){ |
85
|
|
|
|
|
|
|
$extra{pid} = $MATCH{pid}; |
86
|
|
|
|
|
|
|
$MATCH = Paludis::ResumeState::Serialization::Grammar::_classize( $MATCH{classname}, \%hash, \@list, \%extra ); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
}) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
[A-Z][A-Za-z0-9]* |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
\(\) |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
(?{ |
98
|
|
|
|
|
|
|
if( not $MATCH{parameters} ) { |
99
|
|
|
|
|
|
|
$MATCH = Paludis::ResumeState::Serialization::Grammar::_classize( $MATCH{classname}, {}, [], {} ); |
100
|
|
|
|
|
|
|
} elsif( ref $MATCH{parameters} ){ |
101
|
|
|
|
|
|
|
my @parameters = @{$MATCH{parameters} || []}; |
102
|
|
|
|
|
|
|
my %hash; |
103
|
|
|
|
|
|
|
my @list; |
104
|
|
|
|
|
|
|
my $i; |
105
|
|
|
|
|
|
|
for( @parameters ){ |
106
|
|
|
|
|
|
|
$hash{$_->{label}} = $_->{value}; |
107
|
|
|
|
|
|
|
push @list, [ $_->{label} , $_->{value} ]; |
108
|
|
|
|
|
|
|
$i++; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
if( scalar keys %hash == $i ){ |
111
|
|
|
|
|
|
|
$MATCH = Paludis::ResumeState::Serialization::Grammar::_classize( $MATCH{classname}, \%hash, \@list, {} ); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
}) |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
\(\) |
119
|
|
|
|
|
|
|
(?{ |
120
|
|
|
|
|
|
|
if( not $MATCH{parameters} ){ |
121
|
|
|
|
|
|
|
$MATCH = Paludis::ResumeState::Serialization::Grammar::_listize( [] ); |
122
|
|
|
|
|
|
|
} elsif ( ref $MATCH{parameters} and $MATCH{parameters}->[-1]->{label} eq 'count' ){ |
123
|
|
|
|
|
|
|
my $count = pop @{ $MATCH{parameters} }; |
124
|
|
|
|
|
|
|
$MATCH{count} = int($count->{value}); |
125
|
|
|
|
|
|
|
my @items = map { $_->{value} } @{ $MATCH{parameters} }; |
126
|
|
|
|
|
|
|
$MATCH = Paludis::ResumeState::Serialization::Grammar::_listize( \@items ); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
}) |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|| |
131
|
|
|
|
|
|
|
[a-z0-9_]+ |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
(|(<[MATCH=parameter]> ** (;))(;)?) |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
7
|
|
|
7
|
|
234
|
}x; |
138
|
|
|
|
|
|
|
|
139
|
7
|
|
|
|
|
17
|
return 1; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
__END__ |