line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PYX; |
2
|
|
|
|
|
|
|
|
3
|
7
|
|
|
7
|
|
81055
|
use base qw(Exporter); |
|
7
|
|
|
|
|
62
|
|
|
7
|
|
|
|
|
922
|
|
4
|
7
|
|
|
7
|
|
44
|
use strict; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
138
|
|
5
|
7
|
|
|
7
|
|
42
|
use warnings; |
|
7
|
|
|
|
|
31
|
|
|
7
|
|
|
|
|
219
|
|
6
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
3194
|
use PYX::Utils qw(decode); |
|
7
|
|
|
|
|
86675
|
|
|
7
|
|
|
|
|
142
|
|
8
|
7
|
|
|
7
|
|
615
|
use Readonly; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
2317
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Constants. |
11
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(attribute char comment end_element instruction |
12
|
|
|
|
|
|
|
start_element); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 0.08; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Encode attribute as PYX. |
17
|
|
|
|
|
|
|
sub attribute { |
18
|
2
|
|
|
2
|
1
|
5
|
my (@attr) = @_; |
19
|
|
|
|
|
|
|
|
20
|
2
|
|
|
|
|
3
|
my @ret = (); |
21
|
2
|
|
|
|
|
6
|
while (@attr) { |
22
|
2
|
|
|
|
|
6
|
my ($key, $val) = (shift @attr, shift @attr); |
23
|
2
|
|
|
|
|
11
|
push @ret, "A$key ".decode($val); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
25
|
return @ret; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Encode characters between elements as PYX. |
30
|
|
|
|
|
|
|
sub char { |
31
|
2
|
|
|
2
|
1
|
1050
|
my $char = shift; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
7
|
return '-'.decode($char); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Encode comment as PYX. |
37
|
|
|
|
|
|
|
sub comment { |
38
|
2
|
|
|
2
|
1
|
727
|
my $comment = shift; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
7
|
return '_'.decode($comment); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Encode end of element as PYX. |
44
|
|
|
|
|
|
|
sub end_element { |
45
|
1
|
|
|
1
|
1
|
93
|
my $elem = shift; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
5
|
return ')'.$elem; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Encode instruction as PYX. |
51
|
|
|
|
|
|
|
sub instruction { |
52
|
3
|
|
|
3
|
1
|
1148
|
my ($target, $code) = @_; |
53
|
|
|
|
|
|
|
|
54
|
3
|
|
|
|
|
12
|
my $ret = '?'.decode($target); |
55
|
3
|
100
|
|
|
|
26
|
if ($code) { |
56
|
1
|
|
|
|
|
4
|
$ret .= ' '.decode($code); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
3
|
|
|
|
|
10
|
return $ret; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Encode begin of element as PYX. |
63
|
|
|
|
|
|
|
sub start_element { |
64
|
3
|
|
|
3
|
1
|
1968
|
my ($elem, @attr) = @_; |
65
|
|
|
|
|
|
|
|
66
|
3
|
|
|
|
|
5
|
my @ret = (); |
67
|
3
|
|
|
|
|
9
|
push @ret, '('.$elem; |
68
|
3
|
100
|
|
|
|
9
|
if (@attr) { |
69
|
2
|
|
|
|
|
6
|
push @ret, attribute(@attr); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
3
|
|
|
|
|
10
|
return @ret; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |