From bef9a83554554da2faf27eda0d93315f06e4b5a6 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 17 Jan 2021 05:21:27 -0800 Subject: [PATCH] Modified spacing rule for token type 'Y' --- lib/Perl/Tidy/Formatter.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 5270f5fa..f30a8d14 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -2550,6 +2550,11 @@ EOM # (testfiles prnterr1.t with --extrude and mangle.t with --mangle) || $typel eq 'Z' + # Added 'Y' here 16 Jan 2021 to prevent -mangle option from removing + # space after type Y. Otherwise, it will get parsed as type 'Z' later + # and any space would have to be added back manually if desired. + || $typel eq 'Y' + # Perl is sensitive to whitespace after the + here: # $b = xvals $a + 0.1 * yvals $a; || $typell eq 'Z' && $typel =~ /^[\/\?\+\-\*]$/ @@ -2560,9 +2565,10 @@ EOM # keep paren separate in 'use Foo::Bar ()' ( $typel eq 'w' && $typell eq 'k' && $tokenll eq 'use' ) - # keep any space between filehandle and paren: + # OLD: keep any space between filehandle and paren: # file mangle.t with --mangle: - || $typel eq 'Y' + # NEW: this test is no longer necessary here (moved above) + ## || $typel eq 'Y' # must have space between grep and left paren; "grep(" will fail || $is_sort_grep_map{$tokenl} -- 2.39.5