]> git.donarmstrong.com Git - perltidy.git/commitdiff
code cleanups
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 29 Oct 2019 19:12:37 +0000 (12:12 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 29 Oct 2019 19:12:37 +0000 (12:12 -0700)
lib/Perl/Tidy.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm

index 825f331593ffc1f98ac8c8237150ef2097475119..f0106612f00873f11af50dbe01ca7d9f0a3dfdb8 100644 (file)
@@ -273,7 +273,7 @@ sub catfile {
     my $test_file = $path . $name;
     my ( $test_name, $test_path ) = fileparse($test_file);
     return $test_file if ( $test_name eq $name );
-    return if ( $^O eq 'VMS' );
+    return            if ( $^O eq 'VMS' );
 
     # this should work at least for Windows and Unix:
     $test_file = $path . '/' . $name;
@@ -1812,7 +1812,7 @@ sub generate_options {
     $add_option->( 'trim-pod',                                  'trp',   '!' );
     $add_option->( 'want-left-space',                           'wls',   '=s' );
     $add_option->( 'want-right-space',                          'wrs',   '=s' );
-    $add_option->( 'space-prototype-paren',                     'spp',  '=i' );
+    $add_option->( 'space-prototype-paren',                     'spp',   '=i' );
 
     ########################################
     $category = 4;    # Comment controls
index d537b9c650e45b8d24c498809545abff24a50786..cafe0d6f28064949aea42c6c1d9c9bf93f390226 100644 (file)
@@ -151,7 +151,7 @@ sub check_options {
     # Check Tokenizer parameters
     my $rOpts = shift;
 
-    %is_sub = ( );
+    %is_sub = ();
     $is_sub{'sub'} = 1;
 
     # Install any aliases to 'sub'
@@ -6193,7 +6193,7 @@ sub scan_identifier_do {
                 # In something like '$${' we have type '$$' (and only
                 # part of an identifier)
                 && !( $identifier =~ /\$$/ && $tok eq '{' )
-                && ( $identifier !~ /^(sub |package )$/ )
+                && ( $identifier  !~ /^(sub |package )$/ )
               )
             {
                 $type = 'i';
index af12cb62bd77251f0d714ef8cb382af1ebb7c043..326f526761c87ef9df1186be4496dd131d5f520b 100644 (file)
@@ -2581,6 +2581,12 @@ sub delete_unmatched_tokens {
         #   is_deeply( $foo->hash_int, {}, "hash_int - correct contents" );
         $is_marginal ||= ( $all_high_level && $raw_tokb eq '{' );
 
+        # lines with differing number of alignment tokens are marginal
+        # except for assignments
+        $is_marginal ||=
+          ( $previous_maximum_jmax_seen != $previous_minimum_jmax_seen )
+          && !$is_assignment{$raw_tokb};
+
         # See if the lines end with semicolons...
         my $rpatterns0 = $group_lines[0]->get_rpatterns();
         my $rpatterns1 = $group_lines[1]->get_rpatterns();
@@ -2681,14 +2687,8 @@ sub delete_unmatched_tokens {
             }
         }
 
-        my $do_not_align =
-
-          # don't align if it was just a marginal match
-          $is_marginal
-
-          # or lines with differing number of alignment tokens
-          || ( $previous_maximum_jmax_seen != $previous_minimum_jmax_seen
-            && !$leading_equals );
+        # don't align if it was just a marginal match
+        my $do_not_align = $is_marginal;
 
         # But try to convert them into a simple comment group if the first line
         # a has side comment