line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Treex::PML::Schema::Template; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
51
|
use strict; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
156
|
|
4
|
6
|
|
|
6
|
|
27
|
use warnings; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
142
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
24
|
use vars qw($VERSION); |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
229
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
6
|
|
|
6
|
|
107
|
$VERSION='2.24'; # version template |
9
|
|
|
|
|
|
|
} |
10
|
6
|
|
|
6
|
|
27
|
no warnings 'uninitialized'; |
|
6
|
|
|
|
|
31
|
|
|
6
|
|
|
|
|
210
|
|
11
|
6
|
|
|
6
|
|
30
|
use Carp; |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
332
|
|
12
|
6
|
|
|
6
|
|
40
|
use Treex::PML::Schema::Constants; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
546
|
|
13
|
6
|
|
|
6
|
|
33
|
use base qw(Treex::PML::Schema::XMLNode); |
|
6
|
|
|
|
|
21
|
|
|
6
|
|
|
|
|
2338
|
|
14
|
|
|
|
|
|
|
|
15
|
6
|
|
|
6
|
1
|
31
|
sub get_decl_type { return(PML_TEMPLATE_DECL); } |
16
|
0
|
|
|
0
|
1
|
0
|
sub get_decl_type_str { return('template'); } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub simplify { |
19
|
64
|
|
|
64
|
1
|
157
|
my ($template,$opts)=@_; |
20
|
64
|
|
|
|
|
207
|
for my $c ( |
21
|
39
|
|
|
|
|
91
|
sort {$a->{'-#'} <=> $b->{'-#'}} |
22
|
11
|
|
|
|
|
23
|
((map { @{$template->{$_}} } grep {exists $template->{$_} } qw(copy import)), |
|
11
|
|
|
|
|
43
|
|
|
128
|
|
|
|
|
416
|
|
23
|
12
|
|
|
|
|
20
|
(map { values %{$template->{$_}} } grep {exists $template->{$_} } qw(template derive)))) { |
|
12
|
|
|
|
|
81
|
|
|
128
|
|
|
|
|
438
|
|
24
|
|
|
|
|
|
|
# print STDERR "Processing <$c->{-xml_name}>\n"; |
25
|
36
|
|
|
|
|
175
|
$c->simplify($opts); |
26
|
|
|
|
|
|
|
} |
27
|
64
|
50
|
|
|
|
232
|
delete $template->{template} unless $opts->{'preserve_templates'}; |
28
|
64
|
50
|
|
|
|
238
|
delete $template->{copy} unless $opts->{'no_copy'}; |
29
|
64
|
|
|
|
|
179
|
for (qw(derive import)) { |
30
|
128
|
100
|
|
|
|
396
|
if ($template->get_decl_type == PML_TEMPLATE_DECL) { |
31
|
2
|
50
|
|
|
|
13
|
delete $template->{$_} unless $opts->{'no_template_'.$_}; |
32
|
|
|
|
|
|
|
} else { |
33
|
126
|
50
|
|
|
|
540
|
delete $template->{$_} unless $opts->{'no_'.$_}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
sub for_each_decl { |
38
|
0
|
|
|
0
|
1
|
|
my ($self,$sub)=@_; |
39
|
0
|
|
|
|
|
|
$sub->($self); |
40
|
0
|
|
|
|
|
|
for my $d (qw(template type)) { |
41
|
0
|
0
|
|
|
|
|
if (ref $self->{$d}) { |
42
|
0
|
|
|
|
|
|
foreach (values %{$self->{$d}}) { |
|
0
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$_->for_each_decl($sub); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |