| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PYX::Sort; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
|
4
|
5
|
|
|
5
|
|
43921
|
use strict; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
146
|
|
|
5
|
5
|
|
|
5
|
|
17
|
use warnings; |
|
|
5
|
|
|
|
|
4
|
|
|
|
5
|
|
|
|
|
121
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Modules. |
|
8
|
5
|
|
|
5
|
|
1503
|
use Class::Utils qw(set_params); |
|
|
5
|
|
|
|
|
67164
|
|
|
|
5
|
|
|
|
|
115
|
|
|
9
|
5
|
|
|
5
|
|
2786
|
use PYX::Parser; |
|
|
5
|
|
|
|
|
4647
|
|
|
|
5
|
|
|
|
|
1910
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Version. |
|
12
|
|
|
|
|
|
|
our $VERSION = 0.02; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Constructor. |
|
15
|
|
|
|
|
|
|
sub new { |
|
16
|
4
|
|
|
4
|
1
|
3480
|
my ($class, @params) = @_; |
|
17
|
4
|
|
|
|
|
8
|
my $self = bless {}, $class; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Output handler. |
|
20
|
4
|
|
|
|
|
15
|
$self->{'output_handler'} = \*STDOUT; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Process params. |
|
23
|
4
|
|
|
|
|
12
|
set_params($self, @params); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# PYX::Parser object. |
|
26
|
2
|
|
|
|
|
32
|
$self->{'pyx_parser'} = PYX::Parser->new( |
|
27
|
|
|
|
|
|
|
'callbacks' => { |
|
28
|
|
|
|
|
|
|
'attribute' => \&_attribute, |
|
29
|
|
|
|
|
|
|
'start_element' => \&_tag, |
|
30
|
|
|
|
|
|
|
'end_element' => \&_tag, |
|
31
|
|
|
|
|
|
|
'comment' => \&_tag, |
|
32
|
|
|
|
|
|
|
'instruction' => \&_tag, |
|
33
|
|
|
|
|
|
|
'data' => \&_tag, |
|
34
|
|
|
|
|
|
|
}, |
|
35
|
|
|
|
|
|
|
'non_parser_options' => { |
|
36
|
|
|
|
|
|
|
'tag' => {}, |
|
37
|
|
|
|
|
|
|
}, |
|
38
|
|
|
|
|
|
|
'output_handler' => $self->{'output_handler'}, |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Object. |
|
42
|
2
|
|
|
|
|
76
|
return $self; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Parse pyx text or array of pyx text. |
|
46
|
|
|
|
|
|
|
sub parse { |
|
47
|
0
|
|
|
0
|
1
|
0
|
my ($self, $pyx, $out) = @_; |
|
48
|
0
|
|
|
|
|
0
|
$self->{'pyx_parser'}->parse($pyx, $out); |
|
49
|
0
|
|
|
|
|
0
|
return; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# Parse file with pyx text. |
|
53
|
|
|
|
|
|
|
sub parse_file { |
|
54
|
2
|
|
|
2
|
1
|
2348
|
my ($self, $file, $out) = @_; |
|
55
|
2
|
|
|
|
|
8
|
$self->{'pyx_parser'}->parse_file($file, $out); |
|
56
|
2
|
|
|
|
|
28
|
return; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Parse from handler. |
|
60
|
|
|
|
|
|
|
sub parse_handler { |
|
61
|
0
|
|
|
0
|
1
|
0
|
my ($self, $input_file_handler, $out) = @_; |
|
62
|
0
|
|
|
|
|
0
|
$self->{'pyx_parser'}->parse_handler($input_file_handler, $out); |
|
63
|
0
|
|
|
|
|
0
|
return; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Process attribute. |
|
67
|
|
|
|
|
|
|
sub _attribute { |
|
68
|
6
|
|
|
6
|
|
88
|
my ($pyx_parser_obj, $att, $attval) = @_; |
|
69
|
6
|
|
|
|
|
16
|
$pyx_parser_obj->{'non_parser_options'}->{'tag'}->{$att} = $attval; |
|
70
|
6
|
|
|
|
|
6
|
return; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Process tag. |
|
74
|
|
|
|
|
|
|
sub _tag { |
|
75
|
6
|
|
|
6
|
|
181
|
my $pyx_parser_obj = shift; |
|
76
|
6
|
|
|
|
|
6
|
my $out = $pyx_parser_obj->{'output_handler'}; |
|
77
|
6
|
|
|
|
|
7
|
_flush($pyx_parser_obj); |
|
78
|
6
|
|
|
|
|
3
|
print {$out} $pyx_parser_obj->line, "\n"; |
|
|
6
|
|
|
|
|
12
|
|
|
79
|
6
|
|
|
|
|
100
|
return; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
# Flush attributes. |
|
83
|
|
|
|
|
|
|
sub _flush { |
|
84
|
6
|
|
|
6
|
|
7
|
my $pyx_parser_obj = shift; |
|
85
|
6
|
|
|
|
|
6
|
my $out = $pyx_parser_obj->{'output_handler'}; |
|
86
|
6
|
|
|
|
|
3
|
foreach my $key (sort keys %{$pyx_parser_obj->{'non_parser_options'} |
|
|
6
|
|
|
|
|
20
|
|
|
87
|
|
|
|
|
|
|
->{'tag'}}) { |
|
88
|
|
|
|
|
|
|
|
|
89
|
6
|
|
|
|
|
5
|
print {$out} 'A'.$key.'="'.$pyx_parser_obj |
|
|
6
|
|
|
|
|
39
|
|
|
90
|
|
|
|
|
|
|
->{'non_parser_options'}->{'tag'}->{$key}.'"'."\n"; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
6
|
|
|
|
|
10
|
$pyx_parser_obj->{'non_parser_options'}->{'tag'} = {}; |
|
93
|
6
|
|
|
|
|
9
|
return; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |