Fault("Undefined entry for k=$Knnb") if (DEVEL_MODE);
return;
}
- if ( $rLL->[$Knnb]->[_TYPE_] ne 'b'
- && $rLL->[$Knnb]->[_TYPE_] ne '#' )
+ my $type = $rLL->[$Knnb]->[_TYPE_];
+ if (
+ $type ne 'b'
+ && $type ne '#'
+
+ # c269: a zero-length q is a blank before hanging side comment
+ && ( $type ne 'q'
+ || length( $rLL->[$Knnb]->[_TOKEN_] ) )
+ )
{
return $Knnb;
}
# return the index K of the next nonblank token, or
# return undef if none
+ # NOTE: does not skip over the leading type 'q' of a hanging side comment
+ # (use K_next_code)
return if ( !defined($KK) );
return if ( $KK < 0 );
}
my $Kpnb = $KK - 1;
while ( $Kpnb >= 0 ) {
- if ( $rLL->[$Kpnb]->[_TYPE_] ne 'b'
- && $rLL->[$Kpnb]->[_TYPE_] ne '#' )
+ my $type = $rLL->[$Kpnb]->[_TYPE_];
+ if (
+ $type ne 'b'
+ && $type ne '#'
+
+ # c269: a zero-length q is a blank before hanging side comment
+ && ( $type ne 'q'
+ || length( $rLL->[$Kpnb]->[_TOKEN_] ) )
+ )
{
return $Kpnb;
}
# return index of previous nonblank token before item K;
# Call with $KK=undef to start search at the top of the array
+ # NOTE: does not skip over the leading type 'q' of a hanging side comment
+ # (use K_previous_code)
my ( $self, $KK, $rLL ) = @_;
# use the standard array unless given otherwise
--- /dev/null
+if ($xxxxx) {
+ $file = "$xxxxx";
+}
+elsif ($yyyyyy) {
+ $file = "$yyyyy";
+} # side comment
+ # hanging side comment
+elsif ($zzzzz) {
+
+ # comment
+}
--- /dev/null
+if ($xxxxx) {
+ $file = "$xxxxx";
+}
+elsif ($yyyyyy) {
+ $file = "$yyyyy";
+} # side comment
+ # hanging side comment
+elsif ($zzzzz) {
+
+ # comment
+}
+else {
+ ##FIXME - added with perltidy -ame
+}
--- /dev/null
+if ($xxxxx) {
+ $file = "$xxxxx";
+}
+elsif ($yyyyyy) {
+ $file = "$yyyyy";
+} # side comment
+ # hanging side comment
+elsif ($zzzzz) {
+
+ # comment
+}
../snippets28.t lrt.lrt
../snippets28.t ame.ame
../snippets28.t ame.def
+../snippets28.t git124.def
../snippets3.t ce_wn1.ce_wn
../snippets3.t ce_wn1.def
../snippets3.t colin.colin
../snippets9.t rt98902.def
../snippets9.t rt98902.rt98902
../snippets9.t rt99961.def
-../snippets28.t git124.def
+../snippets28.t c269.c269
+../snippets28.t c269.def
#14 ame.ame
#15 ame.def
#16 git124.def
+#17 c269.c269
+#18 c269.def
# To locate test #13 you can search for its name or the string '#13'
###########################################
$rparams = {
'ame' => "--add-missing-else",
+ 'c269' => "-ame",
'def' => "",
'git116' => "-viu",
'lrt' => "--line-range-tidy=2:3",
elsif ( $level == 2 ) { $val = $global{'chapter'} }
----------
+ 'c269' => <<'----------',
+if ($xxxxx) {
+ $file = "$xxxxx";
+}
+elsif ($yyyyyy) {
+ $file = "$yyyyy";
+} # side comment
+ # hanging side comment
+elsif ($zzzzz) {
+
+ # comment
+}
+----------
+
'git116' => <<'----------',
print "Tried to add: @ResolveRPM\n" if ( @ResolveRPM and !$Quiet );
print "Would need: @DepList\n" if ( @DepList and !$Quiet );
}
#16...........
},
+
+ 'c269.c269' => {
+ source => "c269",
+ params => "c269",
+ expect => <<'#17...........',
+if ($xxxxx) {
+ $file = "$xxxxx";
+}
+elsif ($yyyyyy) {
+ $file = "$yyyyy";
+} # side comment
+ # hanging side comment
+elsif ($zzzzz) {
+
+ # comment
+}
+else {
+ ##FIXME - added with perltidy -ame
+}
+#17...........
+ },
+
+ 'c269.def' => {
+ source => "c269",
+ params => "def",
+ expect => <<'#18...........',
+if ($xxxxx) {
+ $file = "$xxxxx";
+}
+elsif ($yyyyyy) {
+ $file = "$yyyyy";
+} # side comment
+ # hanging side comment
+elsif ($zzzzz) {
+
+ # comment
+}
+#18...........
+ },
};
my $ntests = 0 + keys %{$rtests};