| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Locale::Maketext::Extract::Plugin::Generic; |
|
2
|
|
|
|
|
|
|
$Locale::Maketext::Extract::Plugin::Generic::VERSION = '1.00'; |
|
3
|
4
|
|
|
4
|
|
26
|
use strict; |
|
|
4
|
|
|
|
|
9
|
|
|
|
4
|
|
|
|
|
160
|
|
|
4
|
4
|
|
|
4
|
|
22
|
use base qw(Locale::Maketext::Extract::Plugin::Base); |
|
|
4
|
|
|
|
|
66
|
|
|
|
4
|
|
|
|
|
56310
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Generic template parser |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub file_types { |
|
10
|
18
|
|
|
18
|
1
|
59
|
return qw( * ); |
|
11
|
|
|
|
|
|
|
} |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub extract { |
|
14
|
4
|
|
|
4
|
1
|
7
|
my $self = shift; |
|
15
|
4
|
|
|
|
|
7
|
local $_ = shift; |
|
16
|
|
|
|
|
|
|
|
|
17
|
4
|
|
|
|
|
7
|
my $line = 1; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Generic Template: |
|
20
|
4
|
|
|
|
|
5
|
$line = 1; |
|
21
|
4
|
|
|
|
|
9
|
pos($_) = 0; |
|
22
|
4
|
|
|
|
|
17
|
while (m/\G(.*?(?
|
|
23
|
0
|
|
|
|
|
0
|
my ( $vars, $str ) = ( '', $2 ); |
|
24
|
0
|
|
|
|
|
0
|
$line += ( () = ( $1 =~ /\n/g ) ); # cryptocontext! |
|
25
|
0
|
|
|
|
|
0
|
$self->add_entry( $str, $line, $vars ); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
10
|
my $quoted |
|
29
|
|
|
|
|
|
|
= '(\')([^\\\']*(?:\\.[^\\\']*)*)(\')|(\")([^\\\"]*(?:\\.[^\\\"]*)*)(\")'; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Comment-based mark: "..." # loc |
|
32
|
4
|
|
|
|
|
6
|
$line = 1; |
|
33
|
4
|
|
|
|
|
10
|
pos($_) = 0; |
|
34
|
4
|
|
|
|
|
109
|
while (m/\G(.*?($quoted)[\}\)\],;]*\s*\#\s*loc\s*$)/smog) { |
|
35
|
0
|
|
|
|
|
0
|
my $str = substr( $2, 1, -1 ); |
|
36
|
0
|
|
|
|
|
0
|
$line += ( () = ( $1 =~ /\n/g ) ); # cryptocontext! |
|
37
|
0
|
|
|
|
|
0
|
$str =~ s/\\(["'])/$1/g; |
|
38
|
0
|
|
|
|
|
0
|
$self->add_entry( $str, $line, '' ); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Comment-based pair mark: "..." => "..." # loc_pair |
|
42
|
4
|
|
|
|
|
10
|
$line = 1; |
|
43
|
4
|
|
|
|
|
7
|
pos($_) = 0; |
|
44
|
4
|
|
|
|
|
167
|
while (m/\G(.*?(\w+)\s*=>\s*($quoted)[\}\)\],;]*\s*\#\s*loc_pair\s*$)/smg) |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
0
|
|
|
|
|
|
my $key = $2; |
|
47
|
0
|
|
|
|
|
|
my $val = substr( $3, 1, -1 ); |
|
48
|
0
|
|
|
|
|
|
$line += ( () = ( $1 =~ /\n/g ) ); # cryptocontext! |
|
49
|
0
|
|
|
|
|
|
$key =~ s/\\(["'])/$1/g; |
|
50
|
0
|
|
|
|
|
|
$val =~ s/\\(["'])/$1/g; |
|
51
|
0
|
|
|
|
|
|
$self->add_entry( $val, $line, '' ); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |