$ws = WS_NO;
}
}
+ elsif ( $type eq 'k' ) {
+
+ # Keyword 'foreach' is a special case for the -kpit logic since the
+ # opening paren does not always immediately follow the keyword. So
+ # we have to search forward for the paren in this case. I have
+ # limited the search to 10 tokens ahead, just in case somebody
+ # has a big file and no opening paren. This should be enough for
+ # all normal code.
+ if ( $token eq 'foreach'
+ && %keyword_paren_inner_tightness
+ && defined( $keyword_paren_inner_tightness{$token} )
+ && $j < $jmax )
+ {
+ my $jp = $j;
+ for ( my $inc = 1 ; $inc < 10 ; $inc++ ) {
+ $jp++;
+ last if ( $jp > $jmax );
+ next unless ( $rLL->[$jp]->[_TOKEN_] eq '(' );
+ my $seqno = $rLL->[$jp]->[_TYPE_SEQUENCE_];
+ $set_container_ws_by_keyword->( $token, $seqno );
+ last;
+ }
+ }
+ }
my $ws_4;
$ws_4 = $ws
# token
if ( $pad_spaces < 0 ) {
+ # Deactivated for -kpit due to conflict. This block deletes
+ # a space in an attempt to improve alignment in some cases,
+ # but it may conflict with user spacing requests. For now
+ # it is just deactivated if the -kpit option is used, to
+ # avoid changing existing formatting, but really it adds
+ # little value and could eventually be completely removed.
if ( $pad_spaces == -1 ) {
- if ( $ipad > $ibeg && $types_to_go[ $ipad - 1 ] eq 'b' )
+ if ( $ipad > $ibeg
+ && $types_to_go[ $ipad - 1 ] eq 'b'
+ && !%keyword_paren_inner_tightness )
{
$self->pad_token( $ipad - 1, $pad_spaces );
}
if ( seek( DATA, 0, 0 ) ) { ... }
+
+# The foreach keyword may be separated from the next opening paren
+foreach $req (@bgQueue) {
+ ...;
+}
+
+# This had trouble because a later padding operation removed the inside space
+while ($CmdJob eq "" && @CmdQueue > 0 && $RunNightlyWhenIdle != 1
+ || @CmdQueue > 0
+ && $RunNightlyWhenIdle == 2
+ && $bpc->isAdminJob( $CmdQueue[0]->{host} ) )
+{
+ ...;
+}
+
if ( seek(DATA, 0, 0) ) { ... }
+
+# The foreach keyword may be separated from the next opening paren
+foreach $req ( @bgQueue ) {
+ ...;
+}
+
+# This had trouble because a later padding operation removed the inside space
+while ( $CmdJob eq "" && @CmdQueue > 0 && $RunNightlyWhenIdle != 1
+ || @CmdQueue > 0
+ && $RunNightlyWhenIdle == 2
+ && $bpc->isAdminJob($CmdQueue[0]->{host}) )
+{
+ ...;
+}
+
if ( seek(DATA, 0, 0) ) { ... }
+
+# The foreach keyword may be separated from the next opening paren
+foreach $req(@bgQueue) {
+ ...
+}
+
+# This had trouble because a later padding operation removed the inside space
+while ($CmdJob eq "" && @CmdQueue > 0 && $RunNightlyWhenIdle != 1
+ || @CmdQueue > 0 && $RunNightlyWhenIdle == 2 && $bpc->isAdminJob($CmdQueue[0]->{host})) {
+ ...
+}
+
../snippets20.t kpit.kpit
../snippets20.t kpitl.def
../snippets20.t kpitl.kpitl
+../snippets20.t hanging_side_comments3.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
-../snippets20.t hanging_side_comments3.def
'kpit' => <<'----------',
if ( seek(DATA, 0, 0) ) { ... }
+
+# The foreach keyword may be separated from the next opening paren
+foreach $req(@bgQueue) {
+ ...
+}
+
+# This had trouble because a later padding operation removed the inside space
+while ($CmdJob eq "" && @CmdQueue > 0 && $RunNightlyWhenIdle != 1
+ || @CmdQueue > 0 && $RunNightlyWhenIdle == 2 && $bpc->isAdminJob($CmdQueue[0]->{host})) {
+ ...
+}
+
----------
'kpitl' => <<'----------',
params => "def",
expect => <<'#14...........',
if ( seek( DATA, 0, 0 ) ) { ... }
+
+# The foreach keyword may be separated from the next opening paren
+foreach $req (@bgQueue) {
+ ...;
+}
+
+# This had trouble because a later padding operation removed the inside space
+while ($CmdJob eq "" && @CmdQueue > 0 && $RunNightlyWhenIdle != 1
+ || @CmdQueue > 0
+ && $RunNightlyWhenIdle == 2
+ && $bpc->isAdminJob( $CmdQueue[0]->{host} ) )
+{
+ ...;
+}
+
#14...........
},
params => "kpit",
expect => <<'#15...........',
if ( seek(DATA, 0, 0) ) { ... }
+
+# The foreach keyword may be separated from the next opening paren
+foreach $req ( @bgQueue ) {
+ ...;
+}
+
+# This had trouble because a later padding operation removed the inside space
+while ( $CmdJob eq "" && @CmdQueue > 0 && $RunNightlyWhenIdle != 1
+ || @CmdQueue > 0
+ && $RunNightlyWhenIdle == 2
+ && $bpc->isAdminJob($CmdQueue[0]->{host}) )
+{
+ ...;
+}
+
#15...........
},