]> git.donarmstrong.com Git - perltidy.git/commitdiff
avoid break between bareword and paren, issue b1299
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 29 Dec 2021 14:05:36 +0000 (06:05 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 29 Dec 2021 14:05:36 +0000 (06:05 -0800)
dev-bin/b1262.in [deleted file]
dev-bin/b1262.par [deleted file]
dev-bin/run_convergence_tests.pl.data
lib/Perl/Tidy/Formatter.pm

diff --git a/dev-bin/b1262.in b/dev-bin/b1262.in
deleted file mode 100644 (file)
index f5d27ba..0000000
+++ /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 (file)
index 2519367..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
---break-after-all-operators
---delete-old-whitespace
---maximum-line-length=14
---opening-paren-right
---variable-maximum-line-length
index 9dd03699a13aa630a60c685ce2a3cfc4fc710346..ba9b08c0cc22577206b2577d05f3de8b1b9c49ef 100644 (file)
@@ -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" ) )
index c386e40042ac808c3301aef7b76b5f3a3f63c87f..9684916b393ef807c0b4a89a9eca00a42911b549 100644 (file)
@@ -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