line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Treex::PML::Schema::Template; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
18
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
31
|
|
7
|
|
|
|
|
|
|
BEGIN { |
8
|
1
|
|
|
1
|
|
11
|
$VERSION='2.22'; # version template |
9
|
|
|
|
|
|
|
} |
10
|
1
|
|
|
1
|
|
3
|
no warnings 'uninitialized'; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
25
|
|
11
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
12
|
1
|
|
|
1
|
|
3
|
use Treex::PML::Schema::Constants; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
70
|
|
13
|
1
|
|
|
1
|
|
3
|
use base qw(Treex::PML::Schema::XMLNode); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
285
|
|
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
1
|
|
sub get_decl_type { return(PML_TEMPLATE_DECL); } |
16
|
0
|
|
|
0
|
1
|
|
sub get_decl_type_str { return('template'); } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub simplify { |
19
|
0
|
|
|
0
|
1
|
|
my ($template,$opts)=@_; |
20
|
0
|
|
|
|
|
|
for my $c ( |
21
|
0
|
|
|
|
|
|
sort {$a->{'-#'} <=> $b->{'-#'}} |
22
|
0
|
|
|
|
|
|
((map { @{$template->{$_}} } grep {exists $template->{$_} } qw(copy import)), |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
(map { values %{$template->{$_}} } grep {exists $template->{$_} } qw(template derive)))) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# print STDERR "Processing <$c->{-xml_name}>\n"; |
25
|
0
|
|
|
|
|
|
$c->simplify($opts); |
26
|
|
|
|
|
|
|
} |
27
|
0
|
0
|
|
|
|
|
delete $template->{template} unless $opts->{'preserve_templates'}; |
28
|
0
|
0
|
|
|
|
|
delete $template->{copy} unless $opts->{'no_copy'}; |
29
|
0
|
|
|
|
|
|
for (qw(derive import)) { |
30
|
0
|
0
|
|
|
|
|
if ($template->get_decl_type == PML_TEMPLATE_DECL) { |
31
|
0
|
0
|
|
|
|
|
delete $template->{$_} unless $opts->{'no_template_'.$_}; |
32
|
|
|
|
|
|
|
} else { |
33
|
0
|
0
|
|
|
|
|
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__ |