blib/lib/JavaScript/Minifier.pm

filter: Statementstmt 96.2% 155 / 161 Branchbran 89.6% 95 / 106 Conditioncond 80.8% 177 / 219 MC/DCmcdc 60.5% 66 / 109 Subroutinesub 100% 20 / 20 Podpod 0.0% 0 / 16 totaltotal 81.3% 513 / 631 CC 127 SCAR 39.1
CC
127
Cov
88%
minify
85.0
putLiteral
22.8
onWhitespaceConditionalComment
9.6
CRAP 50.0
↑ Summary
1 package JavaScript::Minifier;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 our $VERSION = '1.17'; # VERSION
7  
8 4 require Exporter;
9 4 our @ISA = qw(Exporter);
10 4 our @EXPORT = qw(minify);
11  
12 # string 'return' as array to handle special case of returning a regexp from a function
13 4 my @return = qw(r e t u r n);
14  
15 #return true if the character is allowed in identifier.
16 432 ▶sub isAlphanum {
Subroutine isAlphanum: called CC=2 SCAR=7.2
Pod undocumented
17 432 ▶ return ($_[0] =~ /[\w\$\\]/ || ord($_[0]) > 126);
Condition66%2/3
$_[0] =~ /[\w\$\\]/ || ord $_[0] > 126
l!l&&r!l&&!r
2540178
MC/DC50%1/2
$_[0] =~ /[\w\$\\]/ || ord $_[0] > 126
$_[0] =~ /[\w\$\\]/ ord $_[0] > 126
Truth table66%2/3
A || B
A= $_[0] =~ /[\w\$\\]/B= ord $_[0] > 126
ABresult
1X1
011
000
18 }
19  
20 427 ▶sub isEndspace {
Subroutine isEndspace: called CC=3 SCAR=11.7
Pod undocumented
21 427 ▶ return ($_[0] eq "\n" || $_[0] eq "\r" || $_[0] eq "\f");
Condition66%4/6
$_[0] eq "\n" || $_[0] eq "\r" || $_[0] eq "\f"
l!l&&r!l&&!r
1550272
$_[0] eq "\n" or $_[0] eq "\r"
l!l&&r!l&&!r
1550272
MC/DC33%1/3
$_[0] eq "\n" || $_[0] eq "\r" || $_[0] eq "\f"
$_[0] eq "\n" $_[0] eq "\r" $_[0] eq "\f"
Truth table50%2/4
A or B || C
A= $_[0] eq "\n"B= $_[0] eq "\r"C= $_[0] eq "\f"
ABCresult
1XX1
01X1
0011
0000
22 }
23  
24 2537 ▶sub isWhitespace {
Subroutine isWhitespace: called CC=5 SCAR=16.7
Pod undocumented
25 2537 ▶ return ($_[0] eq ' ' || $_[0] eq "\t" || $_[0] eq "\n"
Condition75%9/12
$_[0] eq ' ' || $_[0] eq "\t" || $_[0] eq "\n" || $_[0] eq "\r" || $_[0] eq "\f"
l!l&&r!l&&!r
73201805
$_[0] eq " " or $_[0] eq "\t" or $_[0] eq "\n" or $_[0] eq "\r"
l!l&&r!l&&!r
73201805
$_[0] eq " " or $_[0] eq "\t" or $_[0] eq "\n"
l!l&&r!l&&!r
4532791805
$_[0] eq " " or $_[0] eq "\t"
l!l&&r!l&&!r
45302084
MC/DC40%2/5
$_[0] eq ' ' || $_[0] eq "\t" || $_[0] eq "\n" || $_[0] eq "\r" || $_[0] eq "\f"
$_[0] eq " " $_[0] eq "\t" $_[0] eq "\n" $_[0] eq "\r" $_[0] eq "\f"
Truth table50%3/6
A or B or C or D || E
A= $_[0] eq " "B= $_[0] eq "\t"C= $_[0] eq "\n"D= $_[0] eq "\r"E= $_[0] eq "\f"
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
26 || $_[0] eq "\r" || $_[0] eq "\f");
27 }
28  
29 # New line characters before or after these characters can be removed.
30 # Not + - / in this list because they require special care.
31 58 ▶sub isInfix {
Subroutine isInfix: called CC=1 SCAR=0.0
Pod undocumented
32 58 $_[0] =~ /[,;:=&%*<>\?\|\n]/;
33 }
34  
35 # New line characters after these characters can be removed.
36 31 ▶sub isPrefix {
Subroutine isPrefix: called CC=2 SCAR=7.2
Pod undocumented
37 31 ▶ return ($_[0] =~ /[\{\(\[!]/ || isInfix($_[0]));
Condition66%2/3
$_[0] =~ /[\{\(\[!]/ || isInfix($_[0])
l!l&&r!l&&!r
01615
MC/DC50%1/2
$_[0] =~ /[\{\(\[!]/ || isInfix($_[0])
$_[0] =~ /[\{\(\[!]/ isInfix($_[0])
Truth table66%2/3
A || B
A= $_[0] =~ /[\{\(\[!]/B= isInfix($_[0])
ABresult
1X1
011
000
38 }
39  
40 # New line characters before these characters can removed.
41 41 ▶sub isPostfix {
Subroutine isPostfix: called CC=2 SCAR=7.2
Pod undocumented
42 41 ▶ return ($_[0] =~ /[\}\)\]]/ || isInfix($_[0]));
Condition66%2/3
$_[0] =~ /[\}\)\]]/ || isInfix($_[0])
l!l&&r!l&&!r
14027
MC/DC50%1/2
$_[0] =~ /[\}\)\]]/ || isInfix($_[0])
$_[0] =~ /[\}\)\]]/ isInfix($_[0])
Truth table66%2/3
A || B
A= $_[0] =~ /[\}\)\]]/B= isInfix($_[0])
ABresult
1X1
011
000
43 }
44  
45 # -----------------------------------------------------------------------------
46  
47 1427 ▶sub _get {
Subroutine _get: called CC=5 SCAR=16.2
48 1427 my $s = shift;
49  
50 1427 ▶ if ($s->{inputType} eq 'file') {
Branch: 2 branches
BranchTrueFalseTotal
if ($s->{'inputType'} eq 'file') { } 1289 138 1427
elsif ($s->{'inputType'} eq 'string') { } 138 0 138
51 1289 my $char = getc($s->{input});
52 1289 ▶ $s->{last_read_char} = $char
Branch: 1 branch
BranchTrueFalseTotal
if defined $char 1229 60 1289
53 if defined $char;
54  
55 1289 return $char;
56 }
57 elsif ($s->{inputType} eq 'string') {
58 138 ▶ if ($s->{'inputPos'} < length($s->{input})) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->{'inputPos'} < length $s->{'input'}) { } 118 20 138
59 return $s->{last_read_char}
60 118 = substr($s->{input}, $s->{inputPos}++, 1);
61 }
62 else { # Simulate getc() when off the end of the input string.
63 20 return undef;
64 }
65 }
66 else {
67 0 die "no input";
68 }
69 }
70  
71 743 ▶sub _put {
Subroutine _put: called CC=2 SCAR=6.9
72 743 my $s = shift;
73 743 my $x = shift;
74 743 my $outfile = ($s->{outfile});
75 743 ▶ if (defined($s->{outfile})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{'outfile'}) { } 657 86 743
76 657 print $outfile $x;
77 }
78 else {
79 86 $s->{output} .= $x;
80 }
81 }
82  
83 # -----------------------------------------------------------------------------
84  
85 # print a
86 # move b to a
87 # move c to b
88 # move d to c
89 # new d
90 #
91 # i.e. print a and advance
92 575 ▶sub action1 {
Subroutine action1: called CC=2 SCAR=6.9
Pod undocumented
93 575 my $s = shift;
94 575 ▶ if (!isWhitespace($s->{a})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (isWhitespace($s->{"a"})) 495 80 575
95 495 $s->{lastnws} = $s->{a};
96 }
97 575 $s->{last} = $s->{a};
98 575 action2($s);
99 }
100  
101 # sneeky output $s->{a} for comments
102 740 ▶sub action2 {
Subroutine action2: called CC=1 SCAR=0.0
Pod undocumented
103 740 my $s = shift;
104 740 _put($s, $s->{a});
105 740 action3($s);
106 }
107  
108 # move b to a
109 # move c to b
110 # move d to c
111 # new d
112 #
113 # i.e. delete a
114 1243 ▶sub action3 {
Subroutine action3: called CC=1 SCAR=0.0
Pod undocumented
115 1243 my $s = shift;
116 1243 $s->{a} = $s->{b};
117 1243 action4($s);
118 }
119  
120 # move c to b
121 # move d to c
122 # new d
123 #
124 # i.e. delete b
125 1342 ▶sub action4 {
Subroutine action4: called CC=1 SCAR=0.0
Pod undocumented
126 1342 my $s = shift;
127 1342 $s->{b} = $s->{c};
128 1342 $s->{c} = $s->{d};
129 1342 $s->{d} = _get($s);
130 }
131  
132 # -----------------------------------------------------------------------------
133  
134 # put string and regexp literals
135 # when this sub is called, $s->{a} is on the opening delimiter character
136 15 ▶sub putLiteral {
Subroutine putLiteral: called CC=14 SCAR=31.3
Pod undocumented
137 15 my $s = shift;
138 15 my $delimiter = $s->{a}; # ', " or /
139 15 action1($s);
140 do {
141 93 ▶ while (defined($s->{a}) && $s->{a} eq '\\') { # escape character only escapes only the next one character
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"} and $s->{"a"} eq "\\") 11 93 104
Condition66%2/3
defined $s->{"a"} and $s->{"a"} eq "\\"
!ll&&!rl&&r
09311
MC/DC50%1/2
defined $s->{"a"} and $s->{"a"} eq "\\"
defined $s->{"a"} $s->{"a"} eq "\\"
Truth table66%2/3
A and B
A= defined $s->{"a"}B= $s->{"a"} eq "\\"
ABresult
0X0
100
111
142 11 action1($s);
143 11 action1($s);
144 }
145 93 ▶ if ($s->{regexp_flag} && $s->{a} eq '[') { # note character class inside regexp, in character class inside regexp there could be unescaped delimiter
Branch: 2 branches
BranchTrueFalseTotal
if ($s->{'regexp_flag'} and $s->{'a'} eq '[') { } 0 93 93
elsif ($s->{'regexp_flag'} and $s->{'a'} eq ']') { } 0 125 125
Condition66%2/3
$s->{"regexp_flag"} and $s->{"a"} eq "["
!ll&&!rl&&r
32610
MC/DC0%0/2
$s->{"regexp_flag"} and $s->{"a"} eq "["
$s->{"regexp_flag"} $s->{"a"} eq "["
Truth table66%2/3
A and B
A= $s->{"regexp_flag"}B= $s->{"a"} eq "["
ABresult
0X0
100
111
146 0 $s->{charclass_flag} = 1;
147 }
148 ▶ elsif ($s->{regexp_flag} && $s->{a} eq ']') {
Condition66%2/3
$s->{"regexp_flag"} and $s->{"a"} eq "]"
!ll&&!rl&&r
32610
MC/DC0%0/2
$s->{"regexp_flag"} and $s->{"a"} eq "]"
$s->{"regexp_flag"} $s->{"a"} eq "]"
Truth table66%2/3
A and B
A= $s->{"regexp_flag"}B= $s->{"a"} eq "]"
ABresult
0X0
100
111
149 0 $s->{charclass_flag} = 0;
150 }
151 93 action1($s);
152 15 ▶ } until ($s->{last} eq $delimiter && !($s->{regexp_flag} && $s->{charclass_flag}) || !defined($s->{a}));
Branch: 1 branch
BranchTrueFalseTotal
($s->{"last"} eq $delimiter and not $s->{"regexp_flag"} && $s->{"charclass_flag"} or not defined $s->{"a"}) or do { do { while (defined $s->{"a"} and $s->{"a"} eq "\\") { action1($s); action1($s); } ; if ($s->{"regexp_flag"} and $s->{"a"} eq "[") { $s->{"charclass_flag"} = 1; } elsif ($s->{"regexp_flag"} and $s->{"a"} eq "]") { $s->{"charclass_flag"} = 0; } ; action1($s) } } 15 78 93
Condition66%6/9
$s->{"last"} eq $delimiter and not $s->{"regexp_flag"} && $s->{"charclass_flag"} or not defined $s->{"a"}
l!l&&r!l&&!r
15078
$s->{"last"} eq $delimiter and not $s->{"regexp_flag"} && $s->{"charclass_flag"}
!ll&&!rl&&r
78015
$s->{'regexp_flag'} && $s->{'charclass_flag'}
!ll&&!rl&&r
690
MC/DC25%1/4
$s->{"last"} eq $delimiter and not $s->{"regexp_flag"} && $s->{"charclass_flag"} or not defined $s->{"a"}
$s->{"last"} eq $delimiter $s->{'regexp_flag'} $s->{'charclass_flag'} not defined $s->{"a"}
Truth table50%3/6
A and not(B && C) or not(D)
A= $s->{"last"} eq $delimiterB= $s->{'regexp_flag'}C= $s->{'charclass_flag'}D= not defined $s->{"a"}
ABCDresult
10XX1
110X1
0XX11
11111
0XX00
11100
153 15 ▶ if ($s->{last} ne $delimiter) { # ran off end of file before printing the closing delimiter
Branch: 1 branch
BranchTrueFalseTotal
if ($s->{"last"} ne $delimiter) 0 15 15
154 0 ▶ die 'unterminated ' . ($delimiter eq '\'' ? 'single quoted string' : $delimiter eq '"' ? 'double quoted string' : 'regular expression') . ' literal, stopped';
Branch: 2 branches
BranchTrueFalseTotal
$delimiter eq q['] ? : 0 0 0
$delimiter eq '"' ? : 0 0 0
155 }
156 }
157  
158 # -----------------------------------------------------------------------------
159  
160 # If $s->{a} is a whitespace then collapse all following whitespace.
161 # If any of the whitespace is a new line then ensure $s->{a} is a new line
162 # when this function ends.
163 420 ▶sub collapseWhitespace {
Subroutine collapseWhitespace: called CC=7 SCAR=19.5
Pod undocumented
164 420 my $s = shift;
165 420 ▶ while (defined($s->{a}) && isWhitespace($s->{a}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"} and isWhitespace($s->{"b"})) 99 420 519
Condition100%9/9
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"} and isWhitespace($s->{"b"})
!ll&&!rl&&r
23718399
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"}
!ll&&!rl&&r
2334282
defined $s->{"a"} and isWhitespace($s->{"a"})
!ll&&!rl&&r
10223286
MC/DC100%4/4
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"} and isWhitespace($s->{"b"})
defined $s->{"a"} isWhitespace($s->{"a"}) defined $s->{"b"} isWhitespace($s->{"b"})
Truth table100%5/5
A and B and C and D
A= defined $s->{"a"}B= isWhitespace($s->{"a"})C= defined $s->{"b"}D= isWhitespace($s->{"b"})
ABCDresult
0XXX0
10XX0
110X0
11100
11111
166 defined($s->{b}) && isWhitespace($s->{b})) {
167 99 ▶ if (isEndspace($s->{a}) || isEndspace($s->{b})) {
Branch: 1 branch
BranchTrueFalseTotal
if (isEndspace($s->{"a"}) or isEndspace($s->{"b"})) 82 17 99
Condition100%3/3
isEndspace($s->{"a"}) or isEndspace($s->{"b"})
l!l&&r!l&&!r
622017
MC/DC100%2/2
isEndspace($s->{"a"}) or isEndspace($s->{"b"})
isEndspace($s->{"a"}) isEndspace($s->{"b"})
Truth table100%3/3
A or B
A= isEndspace($s->{"a"})B= isEndspace($s->{"b"})
ABresult
1X1
011
000
168 82 $s->{a} = "\n";
169 }
170 99 action4($s); # delete b
171 }
172 }
173  
174 # Advance $s->{a} to non-whitespace or end of file.
175 # Doesn't print any of this whitespace.
176 241 ▶sub skipWhitespace {
Subroutine skipWhitespace: called CC=3 SCAR=11.0
Pod undocumented
177 241 my $s = shift;
178 241 ▶ while (defined($s->{a}) && isWhitespace($s->{a})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"} and isWhitespace($s->{"a"})) 193 241 434
Condition100%3/3
defined $s->{"a"} and isWhitespace($s->{"a"})
!ll&&!rl&&r
14227193
MC/DC100%2/2
defined $s->{"a"} and isWhitespace($s->{"a"})
defined $s->{"a"} isWhitespace($s->{"a"})
Truth table100%3/3
A and B
A= defined $s->{"a"}B= isWhitespace($s->{"a"})
ABresult
0X0
100
111
179 193 action3($s);
180 }
181 }
182  
183 # Advance $s->{a} to non-whitespace or end of file
184 # If any of the whitespace is a new line then print one new line.
185 125 ▶sub preserveEndspace {
Subroutine preserveEndspace: called CC=5 SCAR=16.1
Pod undocumented
186 125 my $s = shift;
187 125 collapseWhitespace($s);
188 125 ▶ if (defined($s->{a}) && isEndspace($s->{a}) && defined($s->{b}) && !isPostfix($s->{b}) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"} and isEndspace($s->{"a"}) and defined $s->{"b"} and not isPostfix($s->{"b"})) 27 98 125
Condition100%9/9
defined $s->{"a"} and isEndspace($s->{"a"}) and defined $s->{"b"} and not isPostfix($s->{"b"})
!ll&&!rl&&r
841427
defined $s->{"a"} and isEndspace($s->{"a"}) and defined $s->{"b"}
!ll&&!rl&&r
82241
defined $s->{"a"} and isEndspace($s->{"a"})
!ll&&!rl&&r
47843
MC/DC100%4/4
defined $s->{"a"} and isEndspace($s->{"a"}) and defined $s->{"b"} and not isPostfix($s->{"b"})
defined $s->{"a"} isEndspace($s->{"a"}) defined $s->{"b"} not isPostfix($s->{"b"})
Truth table100%5/5
A and B and C and not(D)
A= defined $s->{"a"}B= isEndspace($s->{"a"})C= defined $s->{"b"}D= not isPostfix($s->{"b"})
ABCDresult
0XXX0
10XX0
110X0
11100
11111
189 27 action1($s);
190 }
191 125 skipWhitespace($s);
192 }
193  
194 28 ▶sub onWhitespaceConditionalComment {
Subroutine onWhitespaceConditionalComment: called CC=9 SCAR=22.6
Pod undocumented
195 28 my $s = shift;
196 return (defined($s->{a}) && isWhitespace($s->{a}) &&
197 defined($s->{b}) && $s->{b} eq '/' &&
198 defined($s->{c}) && ($s->{c} eq '/' || $s->{c} eq '*') &&
199 28 ▶ defined($s->{d}) && $s->{d} eq '@');
Condition79%19/24
defined $s->{'a'} && isWhitespace($s->{'a'}) && defined $s->{'b'} && $s->{'b'} eq '/' && defined $s->{'c'} && ($s->{'c'} eq '/' || $s->{'c'} eq '*') && defined $s->{'d'} && $s->{'d'} eq '@'
!ll&&!rl&&r
2044
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"} and $s->{"b"} eq "/" and defined $s->{"c"} and $s->{"c"} eq "/" || $s->{"c"} eq "*" and defined $s->{"d"}
!ll&&!rl&&r
2008
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"} and $s->{"b"} eq "/" and defined $s->{"c"} and $s->{"c"} eq "/" || $s->{"c"} eq "*"
!ll&&!rl&&r
2008
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"} and $s->{"b"} eq "/" and defined $s->{"c"}
!ll&&!rl&&r
2008
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"} and $s->{"b"} eq "/"
!ll&&!rl&&r
1378
defined $s->{"a"} and isWhitespace($s->{"a"}) and defined $s->{"b"}
!ll&&!rl&&r
12115
defined $s->{"a"} and isWhitespace($s->{"a"})
!ll&&!rl&&r
01216
$s->{"c"} eq "/" or $s->{"c"} eq "*"
l!l&&r!l&&!r
440
MC/DC44%4/9
defined $s->{'a'} && isWhitespace($s->{'a'}) && defined $s->{'b'} && $s->{'b'} eq '/' && defined $s->{'c'} && ($s->{'c'} eq '/' || $s->{'c'} eq '*') && defined $s->{'d'} && $s->{'d'} eq '@'
defined $s->{"a"} isWhitespace($s->{"a"}) defined $s->{"b"} $s->{"b"} eq "/" defined $s->{"c"} $s->{"c"} eq "/" $s->{"c"} eq "*" defined $s->{"d"} $s->{'d'} eq '@'
Truth table58%7/12
A and B and C and D and E and F or G and H && I
A= defined $s->{"a"}B= isWhitespace($s->{"a"})C= defined $s->{"b"}D= $s->{"b"} eq "/"E= defined $s->{"c"}F= $s->{"c"} eq "/"G= $s->{"c"} eq "*"H= defined $s->{"d"}I= $s->{'d'} eq '@'
ABCDEFGHIresult
0XXXXXXXX0
10XXXXXXX0
110XXXXXX0
1110XXXXX0
11110XXXX0
1111100XX0
111111X0X0
11111010X0
111111X100
1111101100
111111X111
1111101111
200 }
201  
202 # -----------------------------------------------------------------------------
203  
204 20 ▶sub minify {
Subroutine minify: called CC=79 SCAR=44.4
Pod undocumented
205 20 my %h = @_;
206 # Immediately turn hash into a hash reference so that notation is the same in this function
207 # as others. Easier refactoring.
208 20 my $s = \%h; # hash reference for "state". This module is functional programming and the state is passed between functions.
209  
210 # determine if the the input is a string or a file handle.
211 20 my $ref = \$s->{input};
212 20 ▶ if (defined($ref) && ref($ref) eq 'SCALAR'){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ref and ref $ref eq 'SCALAR') { } 5 15 20
Condition66%2/3
defined $ref and ref $ref eq "SCALAR"
!ll&&!rl&&r
0155
MC/DC50%1/2
defined $ref and ref $ref eq "SCALAR"
defined $ref ref $ref eq "SCALAR"
Truth table66%2/3
A and B
A= defined $refB= ref $ref eq "SCALAR"
ABresult
0X0
100
111
213 5 $s->{inputPos} = 0;
214 5 $s->{inputType} = 'string';
215 }
216 else {
217 15 $s->{inputType} = 'file';
218 }
219  
220 # Determine if the output is to a string or a file.
221 20 ▶ if (!defined($s->{outfile})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $s->{"outfile"}) 5 15 20
222 5 $s->{output} = '';
223 }
224  
225 # Print the copyright notice first
226 20 ▶ if ($s->{copyright}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->{"copyright"}) 1 19 20
227 1 _put($s, '/* ' . $s->{copyright} . ' */');
228 }
229  
230 # Initialize the buffer.
231 do {
232 25 $s->{a} = _get($s);
233 20 ▶ } while (defined($s->{a}) && isWhitespace($s->{a}));
Branch: 1 branch
BranchTrueFalseTotal
defined $s->{"a"} and isWhitespace($s->{"a"}) and do { do { $s->{"a"} = _get($s) } } 5 20 25
Condition66%2/3
defined $s->{"a"} and isWhitespace($s->{"a"})
!ll&&!rl&&r
0205
MC/DC50%1/2
defined $s->{"a"} and isWhitespace($s->{"a"})
defined $s->{"a"} isWhitespace($s->{"a"})
Truth table66%2/3
A and B
A= defined $s->{"a"}B= isWhitespace($s->{"a"})
ABresult
0X0
100
111
234 20 $s->{b} = _get($s);
235 20 $s->{c} = _get($s);
236 20 $s->{d} = _get($s);
237 20 $s->{regexp_flag} = 0;
238 20 $s->{charclass_flag} = 0;
239 20 $s->{return_flag} = 0;
240 20 $s->{return_string} = '';
241 20 $s->{last} = undef; # assign for safety
242 20 $s->{lastnws} = undef; # assign for safety
243  
244 # local variables
245 20 my $ccFlag; # marks if a comment is an Internet Explorer conditional comment and should be printed to output
246  
247 20 ▶ while (defined($s->{a})) { # on this line $s->{a} should always be a non-whitespace character or undef (i.e. end of file)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"}) 460 20 480
248  
249 460 ▶ if (isWhitespace($s->{a})) { # check that this program is running correctly
Branch: 1 branch
BranchTrueFalseTotal
if (isWhitespace($s->{"a"})) 0 460 460
250 0 die 'minifier bug: minify while loop starting with whitespace, stopped';
251 }
252  
253 # track 'return' operator
254 460 ▶ if ($s->{a} ne '/') {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->{"a"} ne "/") 365 95 460
255 365 ▶ $s->{return_flag} = defined($return[length($s->{return_string})]) && $s->{a} eq $return[length($s->{return_string})];
Condition66%2/3
defined $return[length $s->{'return_string'}] && $s->{'a'} eq $return[length $s->{'return_string'}]
!ll&&!rl&&r
034718
MC/DC50%1/2
defined $return[length $s->{'return_string'}] && $s->{'a'} eq $return[length $s->{'return_string'}]
defined $return[length $s->{'return_string'}] $s->{'a'} eq $return[length $s->{'return_string'}]
Truth table66%2/3
A && B
A= defined $return[length $s->{'return_string'}]B= $s->{'a'} eq $return[length $s->{'return_string'}]
ABresult
0X0
100
111
256 365 ▶ $s->{return_string} = $s->{return_flag} ? $s->{return_string} . $s->{a} : '';
Branch: 1 branch
BranchTrueFalseTotal
$s->{'return_flag'} ? : 18 347 365
257 }
258  
259 # Each branch handles trailing whitespace and ensures $s->{a} is on non-whitespace or undef when branch finishes
260 460 ▶ if ($s->{a} eq '/') { # a division, comment, or regexp literal
Branch: 6 branches
BranchTrueFalseTotal
if ($s->{'a'} eq '/') { } 95 365 460
elsif ($s->{'a'} eq q['] or $s->{'a'} eq '"') { } 6 359 365
elsif ($s->{'a'} eq '+' or $s->{'a'} eq '-') { } 31 328 359
elsif (isAlphanum($s->{'a'})) { } 213 115 328
elsif ($s->{'a'} eq ']' or $s->{'a'} eq '}' or $s->{'a'} eq ')') { } 31 84 115
elsif ($s->{'stripDebug'} and $s->{'a'} eq ';' and defined $s->{'b'} and $s->{'b'} eq ';' and defined $s->{'c'} and $s->{'c'} eq ';') { } 1 83 84
261 95 ▶ if (defined($s->{b}) && $s->{b} eq '/') { # slash-slash comment
Branch: 3 branches
BranchTrueFalseTotal
if (defined $s->{'b'} and $s->{'b'} eq '/') { } 29 66 95
elsif (defined $s->{'b'} and $s->{'b'} eq '*') { } 38 28 66
elsif (defined $s->{'lastnws'} and $s->{'lastnws'} eq ')' || $s->{'lastnws'} eq ']' || $s->{'lastnws'} eq '.' || isAlphanum($s->{'lastnws'}) and !$s->{'return_flag'} || length $s->{'return_string'} != scalar @return) { } 19 9 28
Condition66%2/3
defined $s->{"b"} and $s->{"b"} eq "/"
!ll&&!rl&&r
06629
MC/DC50%1/2
defined $s->{"b"} and $s->{"b"} eq "/"
defined $s->{"b"} $s->{"b"} eq "/"
Truth table66%2/3
A and B
A= defined $s->{"b"}B= $s->{"b"} eq "/"
ABresult
0X0
100
111
262 29 ▶ $ccFlag = defined($s->{c}) && $s->{c} eq '@'; # tests in IE7 show no space allowed between slashes and at symbol
Condition66%2/3
defined $s->{'c'} && $s->{'c'} eq '@'
!ll&&!rl&&r
01514
MC/DC50%1/2
defined $s->{'c'} && $s->{'c'} eq '@'
defined $s->{'c'} $s->{'c'} eq '@'
Truth table66%2/3
A && B
A= defined $s->{'c'}B= $s->{'c'} eq '@'
ABresult
0X0
100
111
263 do {
264 156 ▶ $ccFlag ? action2($s) : action3($s);
Branch: 1 branch
BranchTrueFalseTotal
$ccFlag ? : 68 88 156
265 29 ▶ } until (!defined($s->{a}) || isEndspace($s->{a}));
Branch: 1 branch
BranchTrueFalseTotal
(not defined $s->{"a"} or isEndspace($s->{"a"})) or do { do { $ccFlag ? action2($s) : action3($s) } } 29 127 156
Condition66%2/3
not defined $s->{"a"} or isEndspace($s->{"a"})
l!l&&r!l&&!r
029127
MC/DC50%1/2
not defined $s->{"a"} or isEndspace($s->{"a"})
not defined $s->{"a"} isEndspace($s->{"a"})
Truth table66%2/3
not(A) or B
A= not defined $s->{"a"}B= isEndspace($s->{"a"})
ABresult
1X1
011
000
266 29 ▶ if (defined($s->{a})) { # $s->{a} is a new line
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"}) 29 0 29
267 29 ▶ if ($ccFlag) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ccFlag) { } 14 15 29
elsif (defined $s->{'last'} and not isEndspace($s->{'last'}) and not isPrefix($s->{'last'})) { } 8 7 15
268 14 action1($s); # cannot use preserveEndspace($s) here because it might not print the new line
269 14 skipWhitespace($s);
270 }
271 ▶ elsif (defined($s->{last}) && !isEndspace($s->{last}) && !isPrefix($s->{last})) {
Condition100%6/6
defined $s->{"last"} and not isEndspace($s->{"last"}) and not isPrefix($s->{"last"})
!ll&&!rl&&r
258
defined $s->{"last"} and not isEndspace($s->{"last"})
!ll&&!rl&&r
1113
MC/DC100%3/3
defined $s->{"last"} and not isEndspace($s->{"last"}) and not isPrefix($s->{"last"})
defined $s->{"last"} not isEndspace($s->{"last"}) not isPrefix($s->{"last"})
Truth table100%4/4
A and not(B) and not(C)
A= defined $s->{"last"}B= not isEndspace($s->{"last"})C= not isPrefix($s->{"last"})
ABCresult
0XX0
10X0
1100
1111
272 8 preserveEndspace($s);
273 }
274 else {
275 7 skipWhitespace($s);
276 }
277 }
278 }
279 ▶ elsif (defined($s->{b}) && $s->{b} eq '*') { # slash-star comment
Condition66%2/3
defined $s->{"b"} and $s->{"b"} eq "*"
!ll&&!rl&&r
02838
MC/DC50%1/2
defined $s->{"b"} and $s->{"b"} eq "*"
defined $s->{"b"} $s->{"b"} eq "*"
Truth table66%2/3
A and B
A= defined $s->{"b"}B= $s->{"b"} eq "*"
ABresult
0X0
100
111
280 38 ▶ $ccFlag = defined($s->{c}) && $s->{c} eq '@'; # test in IE7 shows no space allowed between star and at symbol
Condition66%2/3
defined $s->{'c'} && $s->{'c'} eq '@'
!ll&&!rl&&r
02315
MC/DC50%1/2
defined $s->{'c'} && $s->{'c'} eq '@'
defined $s->{'c'} $s->{'c'} eq '@'
Truth table66%2/3
A && B
A= defined $s->{'c'}B= $s->{'c'} eq '@'
ABresult
0X0
100
111
281 do {
282 265 ▶ $ccFlag ? action2($s) : action3($s);
Branch: 1 branch
BranchTrueFalseTotal
$ccFlag ? : 67 198 265
283 38 ▶ } until (!defined($s->{b}) || ($s->{a} eq '*' && $s->{b} eq '/'));
Branch: 1 branch
BranchTrueFalseTotal
(not defined $s->{"b"} or $s->{"a"} eq "*" and $s->{"b"} eq "/") or do { do { $ccFlag ? action2($s) : action3($s) } } 38 227 265
Condition83%5/6
not defined $s->{"b"} or $s->{"a"} eq "*" and $s->{"b"} eq "/"
l!l&&r!l&&!r
038227
$s->{"a"} eq "*" and $s->{"b"} eq "/"
!ll&&!rl&&r
1854238
MC/DC66%2/3
not defined $s->{"b"} or $s->{"a"} eq "*" and $s->{"b"} eq "/"
not defined $s->{"b"} $s->{"a"} eq "*" $s->{"b"} eq "/"
Truth table75%3/4
not(A) or B and C
A= not defined $s->{"b"}B= $s->{"a"} eq "*"C= $s->{"b"} eq "/"
ABCresult
1XX1
0111
00X0
0100
284 38 ▶ if (defined($s->{b})) { # $s->{a} is asterisk and $s->{b} is foreslash
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{'b'}) { } 38 0 38
285 38 ▶ if ($ccFlag) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ccFlag) { } 15 23 38
286 15 action2($s); # the *
287 15 action2($s); # the /
288 # inside the conditional comment there may be a missing terminal semi-colon
289 15 preserveEndspace($s);
290 }
291 else { # the comment is being removed
292 23 action3($s); # the *
293 23 $s->{a} = ' '; # the /
294 23 collapseWhitespace($s);
295 23 ▶ if (defined($s->{last}) && defined($s->{b}) &&
Branch: 2 branches
BranchTrueFalseTotal
if (defined $s->{'last'} and defined $s->{'b'} and isAlphanum($s->{'last'}) && (isAlphanum($s->{'b'}) || $s->{'b'} eq '.') || $s->{'last'} eq '+' && $s->{'b'} eq '+' || $s->{'last'} eq '-' && $s->{'b'} eq '-') { } 4 19 23
elsif (defined $s->{'last'} and not isPrefix($s->{'last'})) { } 7 12 19
Condition87%21/24
defined $s->{"last"} and defined $s->{"b"} and isAlphanum($s->{"last"}) && (isAlphanum($s->{"b"}) || $s->{"b"} eq ".") || $s->{"last"} eq "+" && $s->{"b"} eq "+" || $s->{"last"} eq "-" && $s->{"b"} eq "-"
!ll&&!rl&&r
1184
defined $s->{"last"} and defined $s->{"b"}
!ll&&!rl&&r
1022
isAlphanum($s->{"last"}) and isAlphanum($s->{"b"}) || $s->{"b"} eq "." or $s->{"last"} eq "+" and $s->{"b"} eq "+" or $s->{"last"} eq "-" and $s->{"b"} eq "-"
l!l&&r!l&&!r
3118
isAlphanum($s->{"last"}) and isAlphanum($s->{"b"}) || $s->{"b"} eq "." or $s->{"last"} eq "+" and $s->{"b"} eq "+"
l!l&&r!l&&!r
2119
isAlphanum($s->{"last"}) and isAlphanum($s->{"b"}) || $s->{"b"} eq "."
!ll&&!rl&&r
1642
isAlphanum($s->{"b"}) or $s->{"b"} eq "."
l!l&&r!l&&!r
114
$s->{"last"} eq "+" and $s->{"b"} eq "+"
!ll&&!rl&&r
1901
$s->{"last"} eq "-" and $s->{"b"} eq "-"
!ll&&!rl&&r
1801
MC/DC66%6/9
defined $s->{"last"} and defined $s->{"b"} and isAlphanum($s->{"last"}) && (isAlphanum($s->{"b"}) || $s->{"b"} eq ".") || $s->{"last"} eq "+" && $s->{"b"} eq "+" || $s->{"last"} eq "-" && $s->{"b"} eq "-"
defined $s->{"last"} defined $s->{"b"} isAlphanum($s->{"last"}) isAlphanum($s->{"b"}) $s->{"b"} eq "." $s->{"last"} eq "+" $s->{"b"} eq "+" $s->{"last"} eq "-" $s->{"b"} eq "-"
Truth table38%7/18
A and B and C and D or E or F and G or H and I
A= defined $s->{"last"}B= defined $s->{"b"}C= isAlphanum($s->{"last"})D= isAlphanum($s->{"b"})E= $s->{"b"} eq "."F= $s->{"last"} eq "+"G= $s->{"b"} eq "+"H= $s->{"last"} eq "-"I= $s->{"b"} eq "-"
ABCDEFGHIresult
0XXXXXXXX0
10XXXXXXX0
110XX0X0X0
110XX0X100
110XX100X0
110XX10100
111000X0X0
111000X100
11100100X0
1110010100
1111XXXXX1
11101XXXX1
110XX11XX1
1110011XX1
110XX0X111
110XX10111
111000X111
1110010111
296 ((isAlphanum($s->{last}) && (isAlphanum($s->{b})||$s->{b} eq '.')) ||
297 ($s->{last} eq '+' && $s->{b} eq '+') || ($s->{last} eq '-' && $s->{b} eq '-'))) { # for a situation like 5-/**/-2 or a/**/a
298 # When entering this block $s->{a} is whitespace.
299 # The comment represented whitespace that cannot be removed. Therefore replace the now gone comment with a whitespace.
300 4 action1($s);
301 }
302 ▶ elsif (defined($s->{last}) && !isPrefix($s->{last})) {
Condition100%3/3
defined $s->{"last"} and not isPrefix($s->{"last"})
!ll&&!rl&&r
1117
MC/DC100%2/2
defined $s->{"last"} and not isPrefix($s->{"last"})
defined $s->{"last"} not isPrefix($s->{"last"})
Truth table100%3/3
A and not(B)
A= defined $s->{"last"}B= not isPrefix($s->{"last"})
ABresult
0X0
100
111
303 7 preserveEndspace($s);
304 }
305 else {
306 12 skipWhitespace($s);
307 }
308 }
309 }
310 else {
311 0 die 'unterminated comment, stopped';
312 }
313 }
314 ▶ elsif ((defined($s->{lastnws}) && ($s->{lastnws} eq ')' || $s->{lastnws} eq ']' ||
Condition66%12/18
defined $s->{"lastnws"} and $s->{"lastnws"} eq ")" || $s->{"lastnws"} eq "]" || $s->{"lastnws"} eq "." || isAlphanum($s->{"lastnws"}) and !$s->{"return_flag"} || length $s->{"return_string"} != scalar @return
!ll&&!rl&&r
9019
defined $s->{"lastnws"} and $s->{"lastnws"} eq ")" || $s->{"lastnws"} eq "]" || $s->{"lastnws"} eq "." || isAlphanum($s->{"lastnws"})
!ll&&!rl&&r
0919
$s->{"lastnws"} eq ")" or $s->{"lastnws"} eq "]" or $s->{"lastnws"} eq "." or isAlphanum($s->{"lastnws"})
l!l&&r!l&&!r
1189
$s->{"lastnws"} eq ")" or $s->{"lastnws"} eq "]" or $s->{"lastnws"} eq "."
l!l&&r!l&&!r
1027
$s->{"lastnws"} eq ")" or $s->{"lastnws"} eq "]"
l!l&&r!l&&!r
0127
not $s->{"return_flag"} or length $s->{"return_string"} != scalar @return
l!l&&r!l&&!r
1900
MC/DC28%2/7
defined $s->{"lastnws"} and $s->{"lastnws"} eq ")" || $s->{"lastnws"} eq "]" || $s->{"lastnws"} eq "." || isAlphanum($s->{"lastnws"}) and !$s->{"return_flag"} || length $s->{"return_string"} != scalar @return
defined $s->{"lastnws"} $s->{"lastnws"} eq ")" $s->{"lastnws"} eq "]" $s->{"lastnws"} eq "." isAlphanum($s->{"lastnws"}) not $s->{"return_flag"} length $s->{"return_string"} != scalar @return
Truth table21%3/14
A and B or C or D or E and not(F) or G
A= defined $s->{"lastnws"}B= $s->{"lastnws"} eq ")"C= $s->{"lastnws"} eq "]"D= $s->{"lastnws"} eq "."E= isAlphanum($s->{"lastnws"})F= not $s->{"return_flag"}G= length $s->{"return_string"} != scalar @return
ABCDEFGresult
0XXXXXX0
10000XX0
11XXX000
101XX000
1001X000
10001000
11XXX1X1
11XXX011
101XX1X1
101XX011
1001X1X1
1001X011
100011X1
10001011
315 $s->{lastnws} eq '.' || isAlphanum($s->{lastnws}))) && (!$s->{return_flag} || length($s->{return_string}) != scalar(@return))) { # division
316  
317 19 action1($s);
318 19 collapseWhitespace($s);
319 # don't want a division to become a slash-slash comment with following conditional comment
320 19 ▶ onWhitespaceConditionalComment($s) ? action1($s) : preserveEndspace($s);
Branch: 1 branch
BranchTrueFalseTotal
onWhitespaceConditionalComment($s) ? : 2 17 19
321 }
322 else { # regexp literal
323 9 $s->{regexp_flag} = 1;
324 9 putLiteral($s);
325 9 collapseWhitespace($s);
326 # don't want closing delimiter to become a slash-slash comment with following conditional comment
327 9 ▶ onWhitespaceConditionalComment($s) ? action1($s) : preserveEndspace($s);
Branch: 1 branch
BranchTrueFalseTotal
onWhitespaceConditionalComment($s) ? : 2 7 9
328 }
329 }
330 ▶ elsif ($s->{a} eq '\'' || $s->{a} eq '"' ) { # string literal
Condition100%3/3
$s->{"a"} eq "'" or $s->{"a"} eq "\""
l!l&&r!l&&!r
15359
MC/DC100%2/2
$s->{"a"} eq "'" or $s->{"a"} eq "\""
$s->{"a"} eq "'" $s->{"a"} eq "\""
Truth table100%3/3
A or B
A= $s->{"a"} eq "'"B= $s->{"a"} eq "\""
ABresult
1X1
011
000
331 6 $s->{regexp_flag} = 0;
332 6 putLiteral($s);
333 6 preserveEndspace($s);
334 }
335 ▶ elsif ($s->{a} eq '+' || $s->{a} eq '-') { # careful with + + and - -
Condition100%3/3
$s->{"a"} eq "+" or $s->{"a"} eq "-"
l!l&&r!l&&!r
1516328
MC/DC100%2/2
$s->{"a"} eq "+" or $s->{"a"} eq "-"
$s->{"a"} eq "+" $s->{"a"} eq "-"
Truth table100%3/3
A or B
A= $s->{"a"} eq "+"B= $s->{"a"} eq "-"
ABresult
1X1
011
000
336 31 action1($s);
337 31 collapseWhitespace($s);
338 31 ▶ if (defined($s->{a}) && isWhitespace($s->{a})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"} and isWhitespace($s->{"a"})) 4 27 31
Condition100%3/3
defined $s->{"a"} and isWhitespace($s->{"a"})
!ll&&!rl&&r
1264
MC/DC100%2/2
defined $s->{"a"} and isWhitespace($s->{"a"})
defined $s->{"a"} isWhitespace($s->{"a"})
Truth table100%3/3
A and B
A= defined $s->{"a"}B= isWhitespace($s->{"a"})
ABresult
0X0
100
111
339 4 ▶ (defined($s->{b}) && $s->{b} eq $s->{last}) ? action1($s) : preserveEndspace($s);
Branch: 1 branch
BranchTrueFalseTotal
defined $s->{'b'} && $s->{'b'} eq $s->{'last'} ? : 2 2 4
Condition66%2/3
defined $s->{"b"} and $s->{"b"} eq $s->{"last"}
!ll&&!rl&&r
022
MC/DC50%1/2
defined $s->{"b"} and $s->{"b"} eq $s->{"last"}
defined $s->{"b"} $s->{"b"} eq $s->{"last"}
Truth table66%2/3
A and B
A= defined $s->{"b"}B= $s->{"b"} eq $s->{"last"}
ABresult
0X0
100
111
340 }
341 }
342 elsif (isAlphanum($s->{a})) { # keyword, identifiers, numbers
343 213 action1($s);
344 213 collapseWhitespace($s);
345 213 ▶ if (defined($s->{a}) && isWhitespace($s->{a})) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"a"} and isWhitespace($s->{"a"})) 49 164 213
Condition100%3/3
defined $s->{"a"} and isWhitespace($s->{"a"})
!ll&&!rl&&r
515949
MC/DC100%2/2
defined $s->{"a"} and isWhitespace($s->{"a"})
defined $s->{"a"} isWhitespace($s->{"a"})
Truth table100%3/3
A and B
A= defined $s->{"a"}B= isWhitespace($s->{"a"})
ABresult
0X0
100
111
346 # if $s->{b} is '.' could be (12 .toString()) which is property invocation. If space removed becomes decimal point and error.
347 49 ▶ (defined($s->{b}) && (isAlphanum($s->{b}) || $s->{b} eq '.')) ? action1($s) : preserveEndspace($s);
Branch: 1 branch
BranchTrueFalseTotal
defined $s->{'b'} && (isAlphanum($s->{'b'}) || $s->{'b'} eq '.') ? : 17 32 49
Condition83%5/6
defined $s->{"b"} and isAlphanum($s->{"b"}) || $s->{"b"} eq "."
!ll&&!rl&&r
03217
isAlphanum($s->{"b"}) or $s->{"b"} eq "."
l!l&&r!l&&!r
16132
MC/DC66%2/3
defined $s->{"b"} and isAlphanum($s->{"b"}) || $s->{"b"} eq "."
defined $s->{"b"} isAlphanum($s->{"b"}) $s->{"b"} eq "."
Truth table75%3/4
A and B or C
A= defined $s->{"b"}B= isAlphanum($s->{"b"})C= $s->{"b"} eq "."
ABCresult
0XX0
1000
11X1
1011
348 }
349 }
350 ▶ elsif ($s->{a} eq ']' || $s->{a} eq '}' || $s->{a} eq ')') { # no need to be followed by space but maybe needs following new line
Condition100%6/6
$s->{"a"} eq "]" or $s->{"a"} eq "}" or $s->{"a"} eq ")"
l!l&&r!l&&!r
171484
$s->{"a"} eq "]" or $s->{"a"} eq "}"
l!l&&r!l&&!r
71098
MC/DC100%3/3
$s->{"a"} eq "]" or $s->{"a"} eq "}" or $s->{"a"} eq ")"
$s->{"a"} eq "]" $s->{"a"} eq "}" $s->{"a"} eq ")"
Truth table100%4/4
A or B or C
A= $s->{"a"} eq "]"B= $s->{"a"} eq "}"C= $s->{"a"} eq ")"
ABCresult
1XX1
01X1
0011
0000
351 31 action1($s);
352 31 preserveEndspace($s);
353 }
354 ▶ elsif ($s->{stripDebug} && $s->{a} eq ';' &&
Condition86%13/15
$s->{"stripDebug"} and $s->{"a"} eq ";" and defined $s->{"b"} and $s->{"b"} eq ";" and defined $s->{"c"} and $s->{"c"} eq ";"
!ll&&!rl&&r
8301
$s->{"stripDebug"} and $s->{"a"} eq ";" and defined $s->{"b"} and $s->{"b"} eq ";" and defined $s->{"c"}
!ll&&!rl&&r
8301
$s->{"stripDebug"} and $s->{"a"} eq ";" and defined $s->{"b"} and $s->{"b"} eq ";"
!ll&&!rl&&r
8211
$s->{"stripDebug"} and $s->{"a"} eq ";" and defined $s->{"b"}
!ll&&!rl&&r
8112
$s->{"stripDebug"} and $s->{"a"} eq ";"
!ll&&!rl&&r
7923
MC/DC66%4/6
$s->{"stripDebug"} and $s->{"a"} eq ";" and defined $s->{"b"} and $s->{"b"} eq ";" and defined $s->{"c"} and $s->{"c"} eq ";"
$s->{"stripDebug"} $s->{"a"} eq ";" defined $s->{"b"} $s->{"b"} eq ";" defined $s->{"c"} $s->{"c"} eq ";"
Truth table71%5/7
A and B and C and D and E and F
A= $s->{"stripDebug"}B= $s->{"a"} eq ";"C= defined $s->{"b"}D= $s->{"b"} eq ";"E= defined $s->{"c"}F= $s->{"c"} eq ";"
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
355 defined($s->{b}) && $s->{b} eq ';' &&
356 defined($s->{c}) && $s->{c} eq ';') {
357 1 action3($s); # delete one of the semi-colons
358 1 $s->{a} = '/'; # replace the other two semi-colons
359 1 $s->{b} = '/'; # so the remainder of line is removed
360 }
361 else { # anything else just prints and trailing whitespace discarded
362 83 action1($s);
363 83 skipWhitespace($s);
364 }
365 }
366  
367 20 ▶ if ( defined $s->{last_read_char} and $s->{last_read_char} =~ /\n/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $s->{"last_read_char"} and $s->{"last_read_char"} =~ /\n/) 2 18 20
Condition66%2/3
defined $s->{"last_read_char"} and $s->{"last_read_char"} =~ /\n/
!ll&&!rl&&r
0182
MC/DC50%1/2
defined $s->{"last_read_char"} and $s->{"last_read_char"} =~ /\n/
defined $s->{"last_read_char"} $s->{"last_read_char"} =~ /\n/
Truth table66%2/3
A and B
A= defined $s->{"last_read_char"}B= $s->{"last_read_char"} =~ /\n/
ABresult
0X0
100
111
368 2 _put($s, "\n");
369 }
370  
371 20 ▶ if (!defined($s->{outfile})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $s->{"outfile"}) 5 15 20
372 5 return $s->{output};
373 }
374  
375 } # minify()
376  
377 4 1;
378 __END__
↑ Summary