my @out;
my $data_crlf;
my @pshow;
+ my @altshow;
my $plvl;
my $line;
for my $s (@entiretest) {
$rev ^= $feature{$cond} ? 1 : 0;
push @pshow, $show; # push the previous state
$plvl++;
- $show = $rev;
+ if($show) {
+ # only if this was showing before we can allow the alternative
+ # to go showing as well
+ push @altshow, $rev ^ 1; # push the reversed show state
+ }
+ else {
+ push @altshow, 0; # the alt should still hide
+ }
+ if($show) {
+ # we only allow show if already showing
+ $show = $rev;
+ }
next;
}
elsif($s =~ /^ *%else/) {
print STDERR "error: test$testnum:$line: %else no %if\n";
last;
}
- $show ^= 1;
+ $show = pop @altshow;
+ push @altshow, $show; # put it back for consistency
next;
}
elsif($s =~ /^ *%endif/) {
last;
}
$show = pop @pshow;
+ pop @altshow; # not used here but we must pop it
next;
}
if($show) {