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