line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CSS::Struct::Output::Structure; |
2
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
98751
|
use base qw(CSS::Struct::Output); |
|
11
|
|
|
|
|
90
|
|
|
11
|
|
|
|
|
6671
|
|
4
|
11
|
|
|
11
|
|
379520
|
use strict; |
|
11
|
|
|
|
|
32
|
|
|
11
|
|
|
|
|
236
|
|
5
|
11
|
|
|
11
|
|
56
|
use warnings; |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
423
|
|
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
67
|
use Error::Pure qw(err); |
|
11
|
|
|
|
|
24
|
|
|
11
|
|
|
|
|
1356
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = 0.02; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub flush { |
12
|
19
|
|
|
19
|
1
|
1567
|
my ($self, $reset_flag) = @_; |
13
|
|
|
|
|
|
|
|
14
|
19
|
|
|
|
|
38
|
my $ouf = $self->{'output_handler'}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Text output. |
17
|
19
|
|
|
|
|
35
|
my $ret_ar; |
18
|
19
|
100
|
|
|
|
54
|
if ($ouf) { |
19
|
7
|
|
|
|
|
14
|
foreach my $line_ar (@{$self->{'flush_code'}}) { |
|
7
|
|
|
|
|
29
|
|
20
|
10
|
|
|
|
|
94
|
my $line = "['"; |
21
|
10
|
|
|
|
|
172
|
$line .= join "', '", @{$line_ar}; |
|
10
|
|
|
|
|
46
|
|
22
|
10
|
|
|
|
|
31
|
$line .= "']".$self->{'output_sep'}; |
23
|
11
|
|
|
11
|
|
106
|
no warnings; |
|
11
|
|
|
|
|
43
|
|
|
11
|
|
|
|
|
5347
|
|
24
|
10
|
50
|
|
|
|
21
|
print {$ouf} $line |
|
10
|
|
|
|
|
55
|
|
25
|
|
|
|
|
|
|
or err 'Cannot write to output handler.'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Structure. |
29
|
|
|
|
|
|
|
} else { |
30
|
12
|
|
|
|
|
28
|
$ret_ar = $self->{'flush_code'}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Reset. |
34
|
19
|
100
|
|
|
|
296
|
if ($reset_flag) { |
35
|
1
|
|
|
|
|
4
|
$self->reset; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
19
|
|
|
|
|
54
|
return $ret_ar; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# At-rules. |
42
|
|
|
|
|
|
|
sub _put_at_rules { |
43
|
2
|
|
|
2
|
|
81
|
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
|
|
120
|
my ($self, @comments) = @_; |
53
|
|
|
|
|
|
|
|
54
|
4
|
|
|
|
|
13
|
$self->_put_structure('c', @comments); |
55
|
|
|
|
|
|
|
|
56
|
4
|
|
|
|
|
11
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Definition. |
60
|
|
|
|
|
|
|
sub _put_definition { |
61
|
2
|
|
|
2
|
|
80
|
my ($self, $key, $value) = @_; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
6
|
$self->_put_structure('d', $key, $value); |
64
|
|
|
|
|
|
|
|
65
|
2
|
|
|
|
|
6
|
return; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# End of selector. |
69
|
|
|
|
|
|
|
sub _put_end_of_selector { |
70
|
2
|
|
|
2
|
|
87
|
my $self = shift; |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
|
|
6
|
$self->_put_structure('e'); |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
5
|
return; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Instruction. |
78
|
|
|
|
|
|
|
sub _put_instruction { |
79
|
2
|
|
|
2
|
|
102
|
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
|
|
73
|
my ($self, @raw_data) = @_; |
89
|
|
|
|
|
|
|
|
90
|
2
|
|
|
|
|
8
|
$self->_put_structure('r', @raw_data); |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
|
|
7
|
return; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Selectors. |
96
|
|
|
|
|
|
|
sub _put_selector { |
97
|
8
|
|
|
8
|
|
194
|
my ($self, $selector) = @_; |
98
|
|
|
|
|
|
|
|
99
|
8
|
|
|
|
|
22
|
$self->_put_structure('s', $selector); |
100
|
|
|
|
|
|
|
|
101
|
8
|
|
|
|
|
15
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Put common structure. |
105
|
|
|
|
|
|
|
sub _put_structure { |
106
|
22
|
|
|
22
|
|
61
|
my ($self, @struct) = @_; |
107
|
|
|
|
|
|
|
|
108
|
22
|
|
|
|
|
38
|
push @{$self->{'flush_code'}}, \@struct; |
|
22
|
|
|
|
|
61
|
|
109
|
|
|
|
|
|
|
|
110
|
22
|
|
|
|
|
42
|
return; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
# Reset flush code. |
114
|
|
|
|
|
|
|
sub _reset_flush_code { |
115
|
19
|
|
|
19
|
|
17886
|
my $self = shift; |
116
|
|
|
|
|
|
|
|
117
|
19
|
|
|
|
|
62
|
$self->{'flush_code'} = undef; |
118
|
|
|
|
|
|
|
|
119
|
19
|
|
|
|
|
44
|
return; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__END__ |