| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Treex::PML::Instance::Common; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
93
|
use 5.008; |
|
|
6
|
|
|
|
|
19
|
|
|
4
|
6
|
|
|
6
|
|
27
|
use strict; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
156
|
|
|
5
|
6
|
|
|
6
|
|
28
|
use warnings; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
184
|
|
|
6
|
6
|
|
|
6
|
|
33
|
use Carp; |
|
|
6
|
|
|
|
|
17
|
|
|
|
6
|
|
|
|
|
1490
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
|
9
|
|
|
|
|
|
|
import Exporter qw( import ); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
12
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( |
|
13
|
|
|
|
|
|
|
'diagnostics' => [ qw( _die _warn _debug DEBUG XSLT_BUG ) ], |
|
14
|
|
|
|
|
|
|
'constants' => [ qw( LM AM PML_NS SUPPORTED_PML_VERSIONS ) ], |
|
15
|
|
|
|
|
|
|
); |
|
16
|
|
|
|
|
|
|
$EXPORT_TAGS{'all'} = [ |
|
17
|
|
|
|
|
|
|
@{ $EXPORT_TAGS{'constants'} }, |
|
18
|
|
|
|
|
|
|
@{ $EXPORT_TAGS{'diagnostics'} }, |
|
19
|
|
|
|
|
|
|
qw( $DEBUG $XSLT_BUG SUPPORTED_PML_VERSIONS ) |
|
20
|
|
|
|
|
|
|
]; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
23
|
|
|
|
|
|
|
our @EXPORT = qw( ); |
|
24
|
|
|
|
|
|
|
our $VERSION = '2.24'; # version template |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $DEBUG = $ENV{PML_DEBUG}||0; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our $XSLT_BUG=0; |
|
30
|
|
|
|
|
|
|
eval { |
|
31
|
|
|
|
|
|
|
require XML::LibXSLT; |
|
32
|
|
|
|
|
|
|
$XSLT_BUG = grep 10127 == $_, XML::LibXSLT::LIBXSLT_VERSION(), |
|
33
|
|
|
|
|
|
|
XML::LibXSLT::LIBXSLT_RUNTIME_VERSION(); |
|
34
|
|
|
|
|
|
|
}; |
|
35
|
|
|
|
|
|
|
|
|
36
|
6
|
|
|
6
|
|
41
|
use constant LM => 'LM'; |
|
|
6
|
|
|
|
|
22
|
|
|
|
6
|
|
|
|
|
526
|
|
|
37
|
6
|
|
|
6
|
|
43
|
use constant AM => 'AM'; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
306
|
|
|
38
|
6
|
|
|
6
|
|
36
|
use constant PML_NS => "http://ufal.mff.cuni.cz/pdt/pml/"; |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
298
|
|
|
39
|
6
|
|
|
6
|
|
38
|
use constant SUPPORTED_PML_VERSIONS => " 1.1 1.2 "; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
2748
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
################################### |
|
42
|
|
|
|
|
|
|
# DIAGNOSTICS |
|
43
|
|
|
|
|
|
|
################################### |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub XSLT_BUG { |
|
46
|
0
|
|
|
0
|
1
|
0
|
return $XSLT_BUG; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub DEBUG { |
|
50
|
0
|
0
|
|
0
|
1
|
0
|
if (@_) { $DEBUG=$_[0] }; |
|
|
0
|
|
|
|
|
0
|
|
|
51
|
0
|
|
|
|
|
0
|
return $DEBUG |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _die { |
|
55
|
0
|
|
|
0
|
|
0
|
my $msg = join q{},@_; |
|
56
|
0
|
|
|
|
|
0
|
chomp $msg; |
|
57
|
0
|
0
|
|
|
|
0
|
if ($DEBUG) { |
|
58
|
0
|
|
|
|
|
0
|
local $Carp::CarpLevel=1; |
|
59
|
0
|
|
|
|
|
0
|
confess($msg); |
|
60
|
|
|
|
|
|
|
} else { |
|
61
|
0
|
|
|
|
|
0
|
die "$msg\n"; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _debug { |
|
66
|
88
|
50
|
|
88
|
|
842
|
return unless $DEBUG; |
|
67
|
0
|
|
|
|
|
|
my $level = 1; |
|
68
|
0
|
|
|
|
|
|
my $node = undef; |
|
69
|
0
|
0
|
|
|
|
|
if (ref($_[0])) { |
|
70
|
0
|
|
|
|
|
|
$level=$_[0]->{level}; |
|
71
|
0
|
|
|
|
|
|
$node=$_[0]->{node}; |
|
72
|
0
|
|
|
|
|
|
shift; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
0
|
0
|
|
|
|
|
return unless abs($DEBUG)>=$level; |
|
75
|
0
|
|
|
|
|
|
my $msg=join q{},@_; |
|
76
|
0
|
|
|
|
|
|
chomp $msg; |
|
77
|
0
|
|
|
|
|
|
$msg =~ s/\%N/_element_address($node)/e; |
|
|
0
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
print STDERR "Treex::PML: $msg\n" |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _warn { |
|
82
|
0
|
|
|
0
|
|
|
my $msg = join q{},@_; |
|
83
|
0
|
|
|
|
|
|
chomp $msg; |
|
84
|
0
|
0
|
|
|
|
|
if ($DEBUG<0) { |
|
85
|
0
|
|
|
|
|
|
Carp::cluck("Treex::PML: WARNING: $msg"); |
|
86
|
|
|
|
|
|
|
} else { |
|
87
|
0
|
|
|
|
|
|
warn("Treex::PML: WARNING: $msg\n"); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
__END__ |