line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CSS::Struct::Output::Structure; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
93003
|
use base qw(CSS::Struct::Output); |
|
11
|
|
|
|
|
79
|
|
|
11
|
|
|
|
|
6147
|
|
4
|
11
|
|
|
11
|
|
353349
|
use strict; |
|
11
|
|
|
|
|
29
|
|
|
11
|
|
|
|
|
226
|
|
5
|
11
|
|
|
11
|
|
57
|
use warnings; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
284
|
|
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
62
|
use Error::Pure qw(err); |
|
11
|
|
|
|
|
23
|
|
|
11
|
|
|
|
|
1853
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.04; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub flush { |
12
|
19
|
|
|
19
|
1
|
1744
|
my ($self, $reset_flag) = @_; |
13
|
|
|
|
|
|
|
|
14
|
19
|
|
|
|
|
42
|
my $ouf = $self->{'output_handler'}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Text output. |
17
|
19
|
|
|
|
|
36
|
my $ret_ar; |
18
|
19
|
100
|
|
|
|
55
|
if ($ouf) { |
19
|
7
|
|
|
|
|
18
|
foreach my $line_ar (@{$self->{'flush_code'}}) { |
|
7
|
|
|
|
|
28
|
|
20
|
10
|
|
|
|
|
99
|
my $line = "['"; |
21
|
10
|
|
|
|
|
20
|
$line .= join "', '", @{$line_ar}; |
|
10
|
|
|
|
|
36
|
|
22
|
10
|
|
|
|
|
25
|
$line .= "']".$self->{'output_sep'}; |
23
|
11
|
|
|
11
|
|
107
|
no warnings; |
|
11
|
|
|
|
|
29
|
|
|
11
|
|
|
|
|
4880
|
|
24
|
10
|
50
|
|
|
|
111
|
print {$ouf} $line |
|
10
|
|
|
|
|
54
|
|
25
|
|
|
|
|
|
|
or err 'Cannot write to output handler.'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Structure. |
29
|
|
|
|
|
|
|
} else { |
30
|
12
|
|
|
|
|
26
|
$ret_ar = $self->{'flush_code'}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Reset. |
34
|
19
|
100
|
|
|
|
297
|
if ($reset_flag) { |
35
|
1
|
|
|
|
|
3
|
$self->reset; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
19
|
|
|
|
|
61
|
return $ret_ar; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# At-rules. |
42
|
|
|
|
|
|
|
sub _put_at_rules { |
43
|
2
|
|
|
2
|
|
1422
|
my ($self, $at_rule, $value) = @_; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
8
|
$self->_put_structure('a', $at_rule, $value); |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
6
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Comment. |
51
|
|
|
|
|
|
|
sub _put_comment { |
52
|
4
|
|
|
4
|
|
2930
|
my ($self, @comments) = @_; |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
20
|
$self->_put_structure('c', @comments); |
55
|
|
|
|
|
|
|
|
56
|
4
|
|
|
|
|
12
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Definition. |
60
|
|
|
|
|
|
|
sub _put_definition { |
61
|
2
|
|
|
2
|
|
1352
|
my ($self, $key, $value) = @_; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
8
|
$self->_put_structure('d', $key, $value); |
64
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
5
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# End of selector. |
69
|
|
|
|
|
|
|
sub _put_end_of_selector { |
70
|
2
|
|
|
2
|
|
1579
|
my $self = shift; |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
|
|
9
|
$self->_put_structure('e'); |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
5
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Instruction. |
78
|
|
|
|
|
|
|
sub _put_instruction { |
79
|
2
|
|
|
2
|
|
1386
|
my ($self, $target, $code) = @_; |
80
|
|
|
|
|
|
|
|
81
|
2
|
|
|
|
|
8
|
$self->_put_structure('i', $target, $code); |
82
|
|
|
|
|
|
|
|
83
|
2
|
|
|
|
|
6
|
return; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Raw data. |
87
|
|
|
|
|
|
|
sub _put_raw { |
88
|
2
|
|
|
2
|
|
1359
|
my ($self, @raw_data) = @_; |
89
|
|
|
|
|
|
|
|
90
|
2
|
|
|
|
|
8
|
$self->_put_structure('r', @raw_data); |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
|
|
5
|
return; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Selectors. |
96
|
|
|
|
|
|
|
sub _put_selector { |
97
|
8
|
|
|
8
|
|
2112
|
my ($self, $selector) = @_; |
98
|
|
|
|
|
|
|
|
99
|
8
|
|
|
|
|
24
|
$self->_put_structure('s', $selector); |
100
|
|
|
|
|
|
|
|
101
|
8
|
|
|
|
|
17
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Put common structure. |
105
|
|
|
|
|
|
|
sub _put_structure { |
106
|
22
|
|
|
22
|
|
60
|
my ($self, @struct) = @_; |
107
|
|
|
|
|
|
|
|
108
|
22
|
|
|
|
|
43
|
push @{$self->{'flush_code'}}, \@struct; |
|
22
|
|
|
|
|
56
|
|
109
|
|
|
|
|
|
|
|
110
|
22
|
|
|
|
|
45
|
return; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |