From: Steve Hancock Date: Wed, 29 Dec 2021 14:05:36 +0000 (-0800) Subject: avoid break between bareword and paren, issue b1299 X-Git-Tag: 20211029.05~16 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2f1c08ea60c93c67338c11d8fa12306308311328;p=perltidy.git avoid break between bareword and paren, issue b1299 --- diff --git a/dev-bin/b1262.in b/dev-bin/b1262.in deleted file mode 100644 index f5d27bad..00000000 --- a/dev-bin/b1262.in +++ /dev/null @@ -1,23 +0,0 @@ -# S1 - @theme_args = - get_themes( - \%opt, - ( $2 ? $2 : - ( - shift( - @theme_args) - || - shift(@ARGV) - ) ) ); - -# S2 - @theme_args = - get_themes( - \%opt, - ( $2 ? - $2 : ( - shift( - @theme_args) - || - shift(@ARGV) - ) ) ); diff --git a/dev-bin/b1262.par b/dev-bin/b1262.par deleted file mode 100644 index 25193670..00000000 --- a/dev-bin/b1262.par +++ /dev/null @@ -1,5 +0,0 @@ ---break-after-all-operators ---delete-old-whitespace ---maximum-line-length=14 ---opening-paren-right ---variable-maximum-line-length diff --git a/dev-bin/run_convergence_tests.pl.data b/dev-bin/run_convergence_tests.pl.data index 9dd03699..ba9b08c0 100644 --- a/dev-bin/run_convergence_tests.pl.data +++ b/dev-bin/run_convergence_tests.pl.data @@ -8614,6 +8614,36 @@ my $file = $menubar->Menubutton( --maximum-line-length=91 --square-bracket-vertical-tightness=1 +==> b1299.in <== +# S1 + $cod_offset= + $flds[6]- + ( + ($predobj->start( + ) + - + 1 + )% 3); + +# S2 + $cod_offset= + $flds[6]- + ( + ($predobj-> + start + ( + ) + - + 1 + )% 3); + +==> b1299.par <== +--noadd-whitespace +--continuation-indentation=10 +--ignore-old-breakpoints +--indent-columns=8 +--maximum-line-length=65 + ==> b131.in <== unless ( open( SCORE, "+>>$Score_File" ) ) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index c386e400..9684916b 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -4153,6 +4153,18 @@ EOM && $is_container_token{$next_nonblank_token} ) { $rtype = $next_nonblank_type . $next_nonblank_token; + + # Do not separate a bareword identifier from its paren: b1299 + # This is currently needed for stability because if the bareword + # gets separated from a preceding '->' and following '(' then + # the tokenizer may switch from type 'i' to type 'w'. This + # patch will prevent this by keeping it adjacent to its '('. + if ( $next_nonblank_token eq '(' + && $ltype eq 'i' + && substr( $token, 0, 1 ) =~ /^\w$/ ) + { + $ltype = 'w'; + } } # apply binary rules which apply regardless of space between tokens