From: Steve Hancock Date: Mon, 15 Nov 2021 00:23:25 +0000 (-0800) Subject: fix b1251, avoid new welds of sheared parens X-Git-Tag: 20211029.01~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9fd8a1552f2fa9d1ace3b8f045b93953aa4d6483;p=perltidy.git fix b1251, avoid new welds of sheared parens --- diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 9141fa4c..0e6a822b 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -8154,6 +8154,46 @@ WriteMakefile( --line-up-parentheses --maximum-line-length=35 +==> b1250.in <== +# S1 + @dependents= + ( + split( + $delim,$dependent{$ctr} ) + ); +# S2 + @dependents= + (split( $delim,$dependent{$ctr} )); + +==> b1250.par <== +--noadd-whitespace +--break-before-paren-and-indent=1 +--break-before-paren=1 +--continuation-indentation=7 +--delete-old-whitespace +--extended-continuation-indentation +--indent-columns=2 +--maximum-line-length=39 +--paren-vertical-tightness-closing=2 +--paren-vertical-tightness=1 +--weld-nested-containers + +==> b1251.in <== +# S1 + if ( + !( $line =~ + /\\(nonumber|(no)?tag)/ ) ) +# S2 + if ( !($line =~ /\\(nonumber|(no)?tag)/ ) ) + +==> b1251.par <== +--indent-columns=7 +--maximum-line-length=57 +--paren-vertical-tightness-closing=1 +--paren-vertical-tightness=1 +--space-keyword-paren +--weld-nested-containers + ==> b1252.in <== # S1 @pack= @@ -8192,6 +8232,48 @@ WriteMakefile( --vertical-tightness=0 --weld-nested-containers +==> b1255.in <== +printf + ( +"%-20s %-50s\n", + "-" + x 20, + "-" + x 50 + ); + +printf + ( +"%-20s %-50s\n", + "-" x + 20, + "-" + x 50 + ); + + +==> b1255.par <== +--noadd-whitespace +--ignore-old-breakpoints +--line-up-parentheses +--maximum-line-length=6 +--variable-maximum-line-length +--want-break-before='x = //= > * == <= + & &= !~ x &&= !~ *= + &&=' + +==> b1256.in <== +# S1 + &$out( assemble_insn( + $insn, $arg ) ); +# S2 + &$out( + assemble_insn( + $insn, $arg ) ); + +==> b1256.par <== +--nodelete-old-newlines +--paren-vertical-tightness-closing=2 +--weld-nested-containers + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 242b81f3..7eff258b 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -28,8 +28,8 @@ # CODE SECTION 11: Code to break long lists # sub scan_list # CODE SECTION 12: Code for setting indentation -# CODE SECTION 13: Preparing batches for vertical alignment -# sub send_lines_to_vertical_aligner +# CODE SECTION 13: Preparing batch of lines for vertical alignment +# sub convey_batch_to_vertical_aligner # CODE SECTION 14: Code for creating closing side comments # sub add_closing_side_comment # CODE SECTION 15: Summarize @@ -7342,7 +7342,7 @@ EOM # Only save ending K indexes of code types which are blank # or 'VER'. These will be used for a convergence check. - # See related code in sub 'send_lines_to_vertical_aligner'. + # See related code in sub 'convey_batch_to_vertical_aligner' my $CODE_type = $line_of_tokens->{_code_type}; if ( !$CODE_type || $CODE_type eq 'VER' ) @@ -8474,6 +8474,7 @@ sub weld_nested_containers { my $iline_ic = $inner_closing->[_LINE_INDEX_]; my $iline_oc = $outer_closing->[_LINE_INDEX_]; my $token_oo = $outer_opening->[_TOKEN_]; + my $token_io = $inner_opening->[_TOKEN_]; my $is_multiline_weld = $iline_oo == $iline_io @@ -8481,9 +8482,8 @@ sub weld_nested_containers { && $iline_io != $iline_ic; if (DEBUG_WELD) { - my $token_io = $rLL->[$Kinner_opening]->[_TOKEN_]; - my $len_oo = $rLL->[$Kouter_opening]->[_CUMULATIVE_LENGTH_]; - my $len_io = $rLL->[$Kinner_opening]->[_CUMULATIVE_LENGTH_]; + my $len_oo = $rLL->[$Kouter_opening]->[_CUMULATIVE_LENGTH_]; + my $len_io = $rLL->[$Kinner_opening]->[_CUMULATIVE_LENGTH_]; $Msg .= <excess_line_length_for_Krange( $Kstart, $Kstop ); - # Note: coding simplified here for case b1219 + # Coding simplified here for case b1219. $is_one_line_weld = $excess <= 0; } @@ -13385,7 +13401,7 @@ EOM $this_batch->[_batch_count_] = $batch_count; $this_batch->[_rix_seqno_controlling_ci_] = []; - $self->send_lines_to_vertical_aligner(); + $self->convey_batch_to_vertical_aligner(); my $level = $levels_to_go[$ibeg]; $self->[_last_last_line_leading_level_] = @@ -13850,7 +13866,7 @@ EOM $this_batch->[_batch_count_] = $batch_count; $this_batch->[_rix_seqno_controlling_ci_] = \@ix_seqno_controlling_ci; - $self->send_lines_to_vertical_aligner(); + $self->convey_batch_to_vertical_aligner(); #------------------------------------------------------------------- # Write requested number of blank lines after an opening block brace @@ -20889,9 +20905,9 @@ sub reduce_lp_indentation { # CODE SECTION 13: Preparing batches for vertical alignment ########################################################### -sub check_send_lines_input { +sub check_convey_batch_input { - # Check for valid input to sub send_lines_to_vertical_aligner. An + # Check for valid input to sub convey_batch_to_vertical_aligner. An # error here would most likely be due to an error in the calling # routine 'sub grind_batch_of_CODE'. my ( $self, $ri_first, $ri_last ) = @_; @@ -20932,7 +20948,7 @@ EOM return; } -sub send_lines_to_vertical_aligner { +sub convey_batch_to_vertical_aligner { my ($self) = @_; @@ -20948,7 +20964,7 @@ sub send_lines_to_vertical_aligner { my $ri_first = $this_batch->[_ri_first_]; my $ri_last = $this_batch->[_ri_last_]; - $self->check_send_lines_input( $ri_first, $ri_last ) if (DEVEL_MODE); + $self->check_convey_batch_input( $ri_first, $ri_last ) if (DEVEL_MODE); if ( !defined($ri_first) || !@{$ri_first} ) {