line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::Babelfish::Phrase::PluralForms; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Babelfish AST pluralization node. |
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
20
|
use utf8; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
18
|
|
6
|
4
|
|
|
4
|
|
99
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
60
|
|
7
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
123
|
|
8
|
4
|
|
|
4
|
|
20
|
use feature 'state'; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
289
|
|
9
|
|
|
|
|
|
|
|
10
|
4
|
|
|
4
|
|
17
|
use Carp (); # used inside compiled sub. |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
53
|
|
11
|
4
|
|
|
4
|
|
17
|
use Scalar::Util (); # used inside compiled sub. |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
47
|
|
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
|
752
|
use Locale::Babelfish::Phrase::Compiler (); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
81
|
|
14
|
|
|
|
|
|
|
|
15
|
4
|
|
|
4
|
|
18
|
use parent qw( Locale::Babelfish::Phrase::Node ); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
15
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '2.003'; # VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( qw( forms name compiled locale ) ); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our @sub_data = (); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub to_perl_sub { |
25
|
15
|
|
|
15
|
1
|
32
|
my ( $self ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
15
|
50
|
|
|
|
243
|
unless ( $self->compiled ) { |
28
|
15
|
|
|
|
|
104
|
state $compiler = Locale::Babelfish::Phrase::Compiler->new; |
29
|
15
|
|
|
|
|
228
|
my $regular_forms = $self->forms->{regular}; |
30
|
15
|
|
|
|
|
101
|
for ( my $i = scalar(@$regular_forms) - 1; $i >= 0; $i--) { |
31
|
37
|
|
|
|
|
505
|
$regular_forms->[ $i ] = $compiler->compile( $regular_forms->[ $i ] ); |
32
|
|
|
|
|
|
|
} |
33
|
15
|
|
|
|
|
470
|
my $strict_forms = $self->forms->{strict}; |
34
|
15
|
|
|
|
|
85
|
for my $key ( keys %$strict_forms ) { |
35
|
1
|
|
|
|
|
6
|
$strict_forms->{ $key } = $compiler->compile( $strict_forms->{ $key } ); |
36
|
|
|
|
|
|
|
} |
37
|
15
|
|
|
|
|
237
|
$self->compiled( 1 ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
15
|
|
|
|
|
302
|
my $rule = Locale::Babelfish::Phrase::Pluralizer::find_rule( $self->locale ); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
push @sub_data, [ |
43
|
|
|
|
|
|
|
$rule, |
44
|
|
|
|
|
|
|
$self->{forms}->{strict}, |
45
|
|
|
|
|
|
|
$self->{forms}->{regular}, |
46
|
15
|
|
|
|
|
65
|
]; |
47
|
|
|
|
|
|
|
|
48
|
15
|
|
|
|
|
61
|
return $self->_to_perl_sub($self->{name}, scalar(@sub_data) - 1); |
49
|
3
|
|
|
3
|
|
7
|
} |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
1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|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
58
|
0
|
|
|
|
|
0
|
\$params->{ $name }, |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
829
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
59
|
|
|
|
|
|
|
\@{ \$Locale::Babelfish::Phrase::PluralForms::sub_data[$index] }, |
60
|
|
|
|
|
|
|
); |
61
|
3
|
|
33
|
|
|
17
|
my \$r; |
|
2
|
|
33
|
|
|
11
|
|
|
2
|
|
33
|
|
|
19
|
|
|
1
|
|
33
|
|
|
9
|
|
|
1
|
|
33
|
|
|
5
|
|
|
1
|
|
33
|
|
|
7
|
|
|
1
|
|
33
|
|
|
5
|
|
|
1
|
|
33
|
|
|
9
|
|
|
1
|
|
33
|
|
|
7
|
|
|
1
|
|
33
|
|
|
5
|
|
|
1
|
|
33
|
|
|
6
|
|
|
1
|
|
33
|
|
|
10
|
|
|
1
|
|
33
|
|
|
8
|
|
|
1
|
|
33
|
|
|
7
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
33
|
|
|
|
|
62
|
|
|
|
|
|
|
unless ( Scalar::Util::looks_like_number(\$value) ) { |
63
|
3
|
50
|
50
|
|
|
42
|
\$value //= 'undef'; |
|
2
|
50
|
50
|
|
|
23
|
|
|
2
|
50
|
50
|
|
|
24
|
|
|
1
|
50
|
50
|
|
|
21
|
|
|
1
|
50
|
50
|
|
|
15
|
|
|
1
|
50
|
50
|
|
|
27
|
|
|
1
|
50
|
50
|
|
|
24
|
|
|
1
|
50
|
50
|
|
|
25
|
|
|
1
|
50
|
50
|
|
|
17
|
|
|
1
|
50
|
50
|
|
|
16
|
|
|
1
|
50
|
50
|
|
|
14
|
|
|
2
|
50
|
50
|
|
|
25
|
|
|
1
|
50
|
50
|
|
|
14
|
|
|
1
|
50
|
50
|
|
|
15
|
|
64
|
|
|
|
|
|
|
Carp::cluck( \"$name parameter is not numeric: \$value\" ); |
65
|
|
|
|
|
|
|
\$r = \$regular_forms->[ -1 ]; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else { |
68
|
|
|
|
|
|
|
\$r = \$strict_forms->{\$value} // \$regular_forms->[ \$rule->(\$value) ] // \$regular_forms->[ -1 ]; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
return ref(\$r) ? \$r->(\$params) : ( \$r // '' ); |
71
|
|
|
|
|
|
|
}"; |
72
|
|
|
|
|
|
|
|
73
|
15
|
|
|
|
|
3067
|
return eval $text; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=pod |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=encoding UTF-8 |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Locale::Babelfish::Phrase::PluralForms - Babelfish AST pluralization node. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 VERSION |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
version 2.003 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 METHODS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 to_perl_sub |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$node->to_perl_sub |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Return sub that represents current node execution. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHORS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=over 4 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Akzhan Abdulin <akzhan@cpan.org> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Igor Mironov <grif@cpan.org> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Victor Efimov <efimov@reg.ru> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
REG.RU LLC |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by REG.RU LLC. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This is free software, licensed under: |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The MIT (X11) License |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |