]> git.donarmstrong.com Git - perltidy.git/commitdiff
eliminate all issues identified with -wv
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 11 Dec 2023 01:34:00 +0000 (17:34 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 11 Dec 2023 01:34:00 +0000 (17:34 -0800)
lib/Perl/Tidy/Debugger.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/HtmlWriter.pm
lib/Perl/Tidy/Logger.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm

index 07d898dfd6471351dffd222e835c3b4619eaad09..1992e62ad2b29cf40677bc499cd9b1c585d1ec6d 100644 (file)
@@ -76,8 +76,6 @@ sub write_debug_entry {
     my $input_line_number = $line_of_tokens->{_line_number};
     my $line_type         = $line_of_tokens->{_line_type};
 
-    my ( $j, $num );
-
     my $token_str              = "$input_line_number: ";
     my $reconstructed_original = "$input_line_number: ";
 
@@ -99,7 +97,7 @@ sub write_debug_entry {
             $pattern .= $rtoken_type->[$j];
         }
         $reconstructed_original .= $rtokens->[$j];
-        $num = length( $rtokens->[$j] );
+        my $num      = length( $rtokens->[$j] );
         my $type_str = $rtoken_type->[$j];
 
         # be sure there are no blank tokens (shouldn't happen)
index 637d5025f01fab849b7fa230ff0dda2aa79f9653..4a39bb883e4ad8a0321f978b134d59ce49499b0e 100644 (file)
@@ -880,7 +880,8 @@ BEGIN {
 
 sub new {
 
-    my ( $class, @args ) = @_;
+    my ( $class, @arglist ) = @_;
+    if ( @arglist % 2 ) { croak "Odd number of items in arg hash list\n" }
 
     # we are given an object with a write_line() method to take lines
     my %defaults = (
@@ -891,7 +892,7 @@ sub new {
         is_encoded_data    => EMPTY_STRING,
         fh_tee             => undef,
     );
-    my %args = ( %defaults, @args );
+    my %args = ( %defaults, @arglist );
 
     my $length_function    = $args{length_function};
     my $is_encoded_data    = $args{is_encoded_data};
@@ -3132,11 +3133,11 @@ sub set_whitespace_flags {
                 # tightness = 1 means pad inside if "complex"
                 # tightness = 2 means never pad inside with space
 
-                my $tightness;
+                my $tightness_here;
                 if ( $last_block_type && $last_token eq '{' ) {
-                    $tightness = $rOpts_block_brace_tightness;
+                    $tightness_here = $rOpts_block_brace_tightness;
                 }
-                else { $tightness = $tightness{$last_token} }
+                else { $tightness_here = $tightness{$last_token} }
 
                 #=============================================================
                 # Patch for test problem <<snippets/fabrice_bug.in>>
@@ -3151,14 +3152,14 @@ sub set_whitespace_flags {
                 # to bt=1.  Note that here we must set tightness=1 and not 2 so
                 # that the closing space is also avoided
                 # (via the $j_tight_closing_paren flag in coding)
-                if ( $type eq 'w' && $token =~ /^\^/ ) { $tightness = 1 }
+                if ( $type eq 'w' && $token =~ /^\^/ ) { $tightness_here = 1 }
 
                 #=============================================================
 
-                if ( $tightness <= 0 ) {
+                if ( $tightness_here <= 0 ) {
                     $ws = WS_YES;
                 }
-                elsif ( $tightness > 1 ) {
+                elsif ( $tightness_here > 1 ) {
                     $ws = WS_NO;
                 }
                 else {
@@ -3222,11 +3223,9 @@ sub set_whitespace_flags {
                     && $j < $jmax )
                 {
                     my $level = $rLL->[$j]->[_LEVEL_];
-                    my $jp    = $j;
                     ## NOTE: we might use the KNEXT variable to avoid this loop
                     ## but profiling shows that little would be saved
-                    foreach my $inc ( 1 .. 9 ) {
-                        $jp++;
+                    foreach my $jp ( $j + 1 .. $j + 9 ) {
                         last if ( $jp > $jmax );
                         last if ( $rLL->[$jp]->[_LEVEL_] != $level );    # b1236
                         next unless ( $rLL->[$jp]->[_TOKEN_] eq '(' );
@@ -3302,16 +3301,16 @@ sub set_whitespace_flags {
 
                 if ( !defined($ws) ) {
 
-                    my $tightness;
+                    my $tightness_here;
                     my $block_type = $rblock_type_of_seqno->{$seqno}
                       || $block_type_for_tightness{$seqno};
 
                     if ( $block_type && $token eq '}' ) {
-                        $tightness = $rOpts_block_brace_tightness;
+                        $tightness_here = $rOpts_block_brace_tightness;
                     }
-                    else { $tightness = $tightness{$token} }
+                    else { $tightness_here = $tightness{$token} }
 
-                    $ws = ( $tightness > 1 ) ? WS_NO : WS_YES;
+                    $ws = ( $tightness_here > 1 ) ? WS_NO : WS_YES;
                 }
             }
 
@@ -3413,7 +3412,7 @@ sub set_whitespace_flags {
                 {
                     $ws =
                         $rOpts_space_function_paren
-                      ? $self->ws_space_function_paren( $j, $rtokh_last_last )
+                      ? $self->ws_space_function_paren($rtokh_last_last)
                       : WS_NO;
 
                     set_container_ws_by_keyword( $last_token, $seqno );
@@ -3623,9 +3622,9 @@ sub set_container_ws_by_keyword {
     # treatment for its inside space.  If so we set a hash value using the
     # sequence number as key.
     if ( $word && $sequence_number ) {
-        my $tightness = $keyword_paren_inner_tightness{$word};
-        if ( defined($tightness) && $tightness != 1 ) {
-            my $ws_flag = $tightness == 0 ? WS_YES : WS_NO;
+        my $tightness_here = $keyword_paren_inner_tightness{$word};
+        if ( defined($tightness_here) && $tightness_here != 1 ) {
+            my $ws_flag = $tightness_here == 0 ? WS_YES : WS_NO;
             $opening_container_inside_ws{$sequence_number} = $ws_flag;
             $closing_container_inside_ws{$sequence_number} = $ws_flag;
         }
@@ -3704,7 +3703,7 @@ sub ws_in_container {
 
 sub ws_space_function_paren {
 
-    my ( $self, $j, $rtokh_last_last ) = @_;
+    my ( $self, $rtokh_last_last ) = @_;
 
     # Called if --space-function-paren is set to see if it might cause
     # a problem.  The manual warns the user about potential problems with
@@ -8285,14 +8284,14 @@ EOM
 
     if (DEBUG_SET_CI) {
         my @output_lines;
-        foreach my $KK ( 0 .. $Klimit ) {
-            my $line = $debug_lines[$KK];
+        foreach my $Kd ( 0 .. $Klimit ) {
+            my $line = $debug_lines[$Kd];
             if ($line) {
-                my $Kp = $self->K_previous_code($KK);
-                my $Kn = $self->K_next_code($KK);
+                my $Kp = $self->K_previous_code($Kd);
+                my $Kn = $self->K_next_code($Kd);
                 if (   DEBUG_SET_CI > 1
                     || $Kp && $saw_ci_diff{$Kp}
-                    || $saw_ci_diff{$KK}
+                    || $saw_ci_diff{$Kd}
                     || $Kn && $saw_ci_diff{$Kn} )
                 {
                     push @output_lines, $line;
@@ -9060,7 +9059,6 @@ sub scan_variable_usage {
                     # always pop the stack if this token is on the stack
                     if ($is_on_stack) {
                         my $stack_item   = pop @{$rblock_stack};
-                        my $popped_seqno = $stack_item->{seqno};
                         my $rpopped_vars = $stack_item->{rvars};
 
                         # if we popped a block token
@@ -9107,11 +9105,11 @@ EOM
 
                     # if not on the stack: error if this is a block
                     elsif ($block_type) {
-                        my $lno          = $ix_line + 1;
-                        my $popped_seqno = $rblock_stack->[-1]->{seqno};
+                        my $lno         = $ix_line + 1;
+                        my $stack_seqno = $rblock_stack->[-1]->{seqno};
                         DEVEL_MODE
                           && Fault(
-"stack error: seqno=$seqno ne $popped_seqno near line $lno\n"
+"stack error: seqno=$seqno ne $stack_seqno near line $lno\n"
                           );
 
                         # give up - file may be unbalanced
@@ -20714,9 +20712,8 @@ EOM
         return if ( $parent_seqno_to_go[$i2] ne $parent_seqno_1 );
 
         if ( $i2 < $i1 ) { ( $i1, $i2 ) = ( $i2, $i1 ) }
-        my $K1  = $K_to_go[$i1];
-        my $K2  = $K_to_go[$i2];
-        my $rLL = $self->[_rLL_];
+        my $K1 = $K_to_go[$i1];
+        my $K2 = $K_to_go[$i2];
 
         my $depth_1 = $nesting_depth_to_go[$i1];
         return if ( $depth_1 < 0 );
@@ -20863,11 +20860,11 @@ sub break_equals {
     for my $n ( 1 .. 2 ) {
         my $il_n = $ri_left->[$n];
         my $ir_n = $ri_right->[$n];
-        foreach my $i ( $il_n + 1 .. $ir_n ) {
-            my $type = $types_to_go[$i];
+        foreach my $ii ( $il_n + 1 .. $ir_n ) {
+            my $type = $types_to_go[$ii];
             return
               if ( $is_assignment{$type}
-                && $nesting_depth_to_go[$i] eq $depth_beg );
+                && $nesting_depth_to_go[$ii] eq $depth_beg );
         }
     }
 
@@ -22152,7 +22149,7 @@ EOM
                   && $ibeg_2 == $iend_2
                   && token_sequence_length( $ibeg_2, $ibeg_2 ) <
                   $rOpts_short_concatenation_item_length );
-            my $is_ternary = (
+            my $is_ternary_joint = (
                 $type_ibeg_1 eq '?' && ( $ibeg_3 >= 0
                     && $types_to_go[$ibeg_3] eq ':' )
             );
@@ -22161,7 +22158,7 @@ EOM
             # will put ?/: at start of adjacent lines
             if (   $ibeg_1 != $iend_1
                 && !$is_short_quote
-                && !$is_ternary )
+                && !$is_ternary_joint )
             {
                 my $combine_ok = (
                     (
@@ -24094,7 +24091,7 @@ sub do_colon_breaks {
         @item_count_stack,
         @last_comma_index,
         @last_dot_index,
-        @last_nonblank_type,
+        @last_nonblank_type_stack,
         @old_breakpoint_count_stack,
         @opening_structure_index_stack,
         @rfor_semicolon_list,
@@ -24199,13 +24196,13 @@ sub do_colon_breaks {
             if ( $rOpts_comma_arrow_breakpoints == 3 && $seqno ) {
                 $override_cab3[$depth_t] = $self->[_roverride_cab3_]->{$seqno};
             }
-            $breakpoint_stack[$depth_t]       = $starting_breakpoint_count;
-            $container_type[$depth_t]         = EMPTY_STRING;
-            $identifier_count_stack[$depth_t] = 0;
-            $index_before_arrow[$depth_t]     = -1;
-            $interrupted_list[$depth_t]       = 1;
-            $item_count_stack[$depth_t]       = 0;
-            $last_nonblank_type[$depth_t]     = EMPTY_STRING;
+            $breakpoint_stack[$depth_t]         = $starting_breakpoint_count;
+            $container_type[$depth_t]           = EMPTY_STRING;
+            $identifier_count_stack[$depth_t]   = 0;
+            $index_before_arrow[$depth_t]       = -1;
+            $interrupted_list[$depth_t]         = 1;
+            $item_count_stack[$depth_t]         = 0;
+            $last_nonblank_type_stack[$depth_t] = EMPTY_STRING;
             $opening_structure_index_stack[$depth_t] = -1;
 
             $breakpoint_undo_stack[$depth_t]       = undef;
@@ -24263,7 +24260,8 @@ sub do_colon_breaks {
                 # barewords, identifiers (that is, anything that doesn't
                 # look like a function call)
                 # c250: added new sub identifier type 'S'
-                my $must_break_open = $last_nonblank_type[$dd] !~ /^[kwiUS]$/;
+                my $must_break_open =
+                  $last_nonblank_type_stack[$dd] !~ /^[kwiUS]$/;
 
                 $self->table_maker(
                     {
@@ -24497,9 +24495,9 @@ EOM
             # Look for breaks in this order:
             # 0   1    2   3
             # or  and  ||  &&
-            foreach my $i ( 0 .. 3 ) {
-                if ( $rand_or_list[$dd][$i] ) {
-                    foreach ( @{ $rand_or_list[$dd][$i] } ) {
+            foreach my $ii ( 0 .. 3 ) {
+                if ( $rand_or_list[$dd][$ii] ) {
+                    foreach ( @{ $rand_or_list[$dd][$ii] } ) {
                         $self->set_forced_breakpoint($_);
                     }
 
@@ -25248,7 +25246,7 @@ EOM
         $index_before_arrow[$depth]            = -1;
         $interrupted_list[$depth]              = 0;
         $item_count_stack[$depth]              = 0;
-        $last_nonblank_type[$depth]            = $last_nonblank_type;
+        $last_nonblank_type_stack[$depth]      = $last_nonblank_type;
         $opening_structure_index_stack[$depth] = $i;
 
         $breakpoint_undo_stack[$depth]       = $forced_breakpoint_undo_count;
@@ -27193,7 +27191,8 @@ sub get_maximum_fields_wanted {
         my $last_length       = undef;
         my $total_variation_1 = 0;
         my $total_variation_2 = 0;
-        my @total_variation_2 = ( 0, 0 );
+
+        my @total_variation_2_sums = ( 0, 0 );
 
         foreach my $j ( 0 .. $item_count - 1 ) {
 
@@ -27212,14 +27211,15 @@ sub get_maximum_fields_wanted {
             my $ll = $last_length_2[$is_odd];
             if ( defined($ll) ) {
                 my $dl = abs( $length - $ll );
-                $total_variation_2[$is_odd] += $dl;
+                $total_variation_2_sums[$is_odd] += $dl;
             }
             else {
                 $first_length_2[$is_odd] = $length;
             }
             $last_length_2[$is_odd] = $length;
         }
-        $total_variation_2 = $total_variation_2[0] + $total_variation_2[1];
+        $total_variation_2 =
+          $total_variation_2_sums[0] + $total_variation_2_sums[1];
 
         my $factor = ( $item_count > 10 ) ? 1 : ( $item_count > 5 ) ? 0.75 : 0;
         if ( $total_variation_2 >= $factor * $total_variation_1 ) {
@@ -33074,7 +33074,7 @@ sub set_vertical_tightness_flags {
 # These routines are called once per batch when the --closing-side-comments flag
 # has been set.
 
-    my %block_leading_text;
+    my $rblock_leading_text;
     my %block_opening_line_number;
     my $csc_new_statement_ok;
     my $csc_last_label;
@@ -33088,7 +33088,7 @@ sub set_vertical_tightness_flags {
     my $leading_block_text_line_number;
 
     sub initialize_csc_vars {
-        %block_leading_text           = ();
+        $rblock_leading_text          = {};
         %block_opening_line_number    = ();
         $csc_new_statement_ok         = 1;
         $csc_last_label               = EMPTY_STRING;
@@ -33263,11 +33263,11 @@ sub set_vertical_tightness_flags {
                 if ( $token eq '}' ) {
 
                     # restore any leading text saved when we entered this block
-                    if ( defined( $block_leading_text{$type_sequence} ) ) {
+                    if ( defined( $rblock_leading_text->{$type_sequence} ) ) {
                         ( $block_leading_text, $rblock_leading_if_elsif_text )
-                          = @{ $block_leading_text{$type_sequence} };
+                          = @{ $rblock_leading_text->{$type_sequence} };
                         $i_block_leading_text = $i;
-                        delete $block_leading_text{$type_sequence};
+                        delete $rblock_leading_text->{$type_sequence};
                         $rleading_block_if_elsif_text =
                           $rblock_leading_if_elsif_text;
                     }
@@ -33324,7 +33324,7 @@ sub set_vertical_tightness_flags {
                         if ( $accumulating_text_for_block eq $block_type ) {
 
                             # save any leading text before we enter this block
-                            $block_leading_text{$type_sequence} = [
+                            $rblock_leading_text->{$type_sequence} = [
                                 $leading_block_text,
                                 $rleading_block_if_elsif_text
                             ];
index dbd5f96b32cb2b54447802b11422f3b17f4f0ac5..04bf5a3017313fe6881c7cb2ea52ee7960b804a0 100644 (file)
@@ -9,6 +9,7 @@ use strict;
 use warnings;
 our $VERSION = '20230912.06';
 
+use Carp;
 use English qw( -no_match_vars );
 use File::Basename;
 
@@ -83,7 +84,8 @@ sub DESTROY {
 
 sub new {
 
-    my ( $class, @args ) = @_;
+    my ( $class, @arglist ) = @_;
+    if ( @arglist % 2 ) { croak "Odd number of items in arg hash list\n" }
 
     my %defaults = (
         input_file         => undef,
@@ -92,7 +94,7 @@ sub new {
         html_toc_extension => undef,
         html_src_extension => undef,
     );
-    my %args = ( %defaults, @args );
+    my %args = ( %defaults, @arglist );
 
     my $input_file         = $args{input_file};
     my $html_file          = $args{html_file};
index 712544f64b1261889b681015e5a9ce6cfa121ef2..935af1727c34febb52603ebb20571e040cd8416a 100644 (file)
@@ -9,6 +9,7 @@ package Perl::Tidy::Logger;
 use strict;
 use warnings;
 our $VERSION = '20230912.06';
+use Carp;
 use English qw( -no_match_vars );
 
 use constant DEVEL_MODE   => 0;
@@ -45,7 +46,8 @@ use constant DEFAULT_LOGFILE_GAP => 50;
 
 sub new {
 
-    my ( $class, @args ) = @_;
+    my ( $class, @arglist ) = @_;
+    if ( @arglist % 2 ) { croak "Odd number of items in arg hash list\n" }
 
     my %defaults = (
         rOpts           => undef,
@@ -56,7 +58,7 @@ sub new {
         is_encoded_data => undef,
     );
 
-    my %args = ( %defaults, @args );
+    my %args = ( %defaults, @arglist );
 
     my $rOpts           = $args{rOpts};
     my $log_file        = $args{log_file};
index df382081c9e7bf596599973d432648b6a812de77..3bde8ef4f8ed3dc9114c976adb7b68957e100430 100644 (file)
@@ -482,7 +482,8 @@ sub check_options {
 
 sub new {
 
-    my ( $class, @args ) = @_;
+    my ( $class, @arglist ) = @_;
+    if ( @arglist % 2 ) { croak "Odd number of items in arg hash list\n" }
 
     my %defaults = (
         source_object        => undef,
@@ -493,7 +494,7 @@ sub new {
         starting_line_number => 1,
         rOpts                => {},
     );
-    my %args = ( %defaults, @args );
+    my %args = ( %defaults, @arglist );
 
     # we are given an object with a get_line() method to supply source lines
     my $source_object = $args{source_object};
@@ -5671,7 +5672,10 @@ EOM
         #---------------------------------------------------------
 
         # Arrays to hold token values for this line:
-        my ( @levels, @block_type, @type_sequence, @token_type, @tokens );
+        my (
+            @output_levels,     @output_block_type, @output_type_sequence,
+            @output_token_type, @output_tokens
+        );
 
         $line_of_tokens->{_nesting_tokens_0} = $nesting_token_string;
 
@@ -5682,14 +5686,14 @@ EOM
         # Loop over tokens
         #-----------------
         # $i is the index of the pretoken which starts this full token
-        foreach my $i ( @{$routput_token_list} ) {
+        foreach my $ii ( @{$routput_token_list} ) {
 
-            my $type_i = $routput_token_type->[$i];
+            my $type_i = $routput_token_type->[$ii];
 
             #----------------------------------------
             # Section 1. Handle a non-sequenced token
             #----------------------------------------
-            if ( !$routput_type_sequence->[$i] ) {
+            if ( !$routput_type_sequence->[$ii] ) {
 
                 #-------------------------------
                 # Section 1.1. types ';' and 't'
@@ -5698,7 +5702,7 @@ EOM
                 # - output __END__, __DATA__, and format as type 'k' instead
                 #   of ';' to make html colors correct, etc.
                 if ( $is_semicolon_or_t{$type_i} ) {
-                    my $tok_i = $rtokens->[$i];
+                    my $tok_i = $rtokens->[$ii];
                     if ( $is_END_DATA_format_sub{$tok_i} ) {
                         $type_i = 'k';
                     }
@@ -5724,10 +5728,10 @@ EOM
                 #----------------------------------------------------
                 # Section 1.3. Store values for a non-sequenced token
                 #----------------------------------------------------
-                push( @levels,        $level_in_tokenizer );
-                push( @block_type,    EMPTY_STRING );
-                push( @type_sequence, EMPTY_STRING );
-                push( @token_type,    $type_i );
+                push( @output_levels,        $level_in_tokenizer );
+                push( @output_block_type,    EMPTY_STRING );
+                push( @output_type_sequence, EMPTY_STRING );
+                push( @output_token_type,    $type_i );
 
             }
 
@@ -5743,9 +5747,9 @@ EOM
                 my $level_i = $level_in_tokenizer;
 
                 # $tok_i is the PRE-token.  It only equals the token for symbols
-                my $tok_i = $rtokens->[$i];
+                my $tok_i = $rtokens->[$ii];
 
-                # $routput_indent_flag->[$i] indicates that we need a change
+                # $routput_indent_flag->[$ii] indicates that we need a change
                 # in level at a nested ternary, as follows
                 #     1 => at a nested ternary ?
                 #    -1 => at a nested ternary :
@@ -5758,7 +5762,7 @@ EOM
 
                     if ( $type_i eq '?' ) {
 
-                        if ( $routput_indent_flag->[$i] > 0 ) {
+                        if ( $routput_indent_flag->[$ii] > 0 ) {
                             $level_in_tokenizer++;
 
                             # break BEFORE '?' in a nested ternary
@@ -5775,7 +5779,7 @@ EOM
 
                             $level_in_tokenizer++;
 
-                            if ( $routput_block_type->[$i] ) {
+                            if ( $routput_block_type->[$ii] ) {
                                 $nesting_block_flag = 1;
                                 $nesting_block_string .= '1';
                             }
@@ -5804,7 +5808,7 @@ EOM
                         || $type_i eq 'R'
 
                         # only the second and higher ? : have levels
-                        || $type_i eq ':' && $routput_indent_flag->[$i] < 0
+                        || $type_i eq ':' && $routput_indent_flag->[$ii] < 0
                       )
                     {
 
@@ -5847,15 +5851,15 @@ EOM
 
                 # The starting nesting block string, which is used in any .LOG
                 # output, should include the first token of the line
-                if ( !@levels ) {
+                if ( !@output_levels ) {
                     $nesting_block_string_0 = $nesting_block_string;
                 }
 
                 # Store values for a sequenced token
-                push( @levels,        $level_i );
-                push( @block_type,    $routput_block_type->[$i] );
-                push( @type_sequence, $routput_type_sequence->[$i] );
-                push( @token_type,    $type_i );
+                push( @output_levels,        $level_i );
+                push( @output_block_type,    $routput_block_type->[$ii] );
+                push( @output_type_sequence, $routput_type_sequence->[$ii] );
+                push( @output_token_type,    $type_i );
 
             }
         }    ## End loop to over tokens
@@ -5867,13 +5871,13 @@ EOM
         $line_of_tokens->{_nesting_blocks_0} = $nesting_block_string_0;
 
         # Form and store the tokens
-        if (@levels) {
+        if (@output_levels) {
 
             my $im     = shift @{$routput_token_list};
             my $offset = $rtoken_map->[$im];
-            foreach my $i ( @{$routput_token_list} ) {
-                my $numc = $rtoken_map->[$i] - $offset;
-                push( @tokens, substr( $input_line, $offset, $numc ) );
+            foreach my $ii ( @{$routput_token_list} ) {
+                my $numc = $rtoken_map->[$ii] - $offset;
+                push( @output_tokens, substr( $input_line, $offset, $numc ) );
                 $offset += $numc;
 
                 # programming note: it seems most efficient to 'next' out of
@@ -5889,7 +5893,7 @@ EOM
 
             # Form and store the final token of this line
             my $numc = length($input_line) - $offset;
-            push( @tokens, substr( $input_line, $offset, $numc ) );
+            push( @output_tokens, substr( $input_line, $offset, $numc ) );
 
             if (DEVEL_MODE) {
                 if ( $numc <= 0 ) {
@@ -5900,7 +5904,7 @@ EOM
                 }
 
                 # Make sure we didn't gain or lose any characters
-                my $test_line = join EMPTY_STRING, @tokens;
+                my $test_line = join EMPTY_STRING, @output_tokens;
                 if ( $test_line ne $input_line ) {
                     my $len_input = length($input_line);
                     my $len_test  = length($test_line);
@@ -5916,11 +5920,11 @@ EOM
         }
 
         # Wrap up this line of tokens for shipping to the Formatter
-        $line_of_tokens->{_rtoken_type}    = \@token_type;
-        $line_of_tokens->{_rtokens}        = \@tokens;
-        $line_of_tokens->{_rblock_type}    = \@block_type;
-        $line_of_tokens->{_rtype_sequence} = \@type_sequence;
-        $line_of_tokens->{_rlevels}        = \@levels;
+        $line_of_tokens->{_rtoken_type}    = \@output_token_type;
+        $line_of_tokens->{_rtokens}        = \@output_tokens;
+        $line_of_tokens->{_rblock_type}    = \@output_block_type;
+        $line_of_tokens->{_rtype_sequence} = \@output_type_sequence;
+        $line_of_tokens->{_rlevels}        = \@output_levels;
 
         return;
     } ## end sub tokenizer_wrapup_line
index 382f657c88908d4e055bfedb57628dd7981809ba..ded10d1864dd4692cb4f520ef2630ff697c294be 100644 (file)
@@ -332,7 +332,8 @@ EOM
 
 sub new {
 
-    my ( $class, @args ) = @_;
+    my ( $class, @arglist ) = @_;
+    if ( @arglist % 2 ) { croak "Odd number of items in arg hash list\n" }
 
     my %defaults = (
         rOpts              => undef,
@@ -340,7 +341,7 @@ sub new {
         logger_object      => undef,
         diagnostics_object => undef,
     );
-    my %args = ( %defaults, @args );
+    my %args = ( %defaults, @arglist );
 
     # Initialize other caches and buffers
     initialize_step_B_cache();
@@ -3397,12 +3398,12 @@ sub match_line_pairs {
     # so that lines can just look back one line for their pair info.
     if ( @{$rlines} > @{$rnew_lines} ) {
         my $last_pair_info = -1;
-        foreach my $line ( @{$rlines} ) {
-            if ( $line->{'is_hanging_side_comment'} ) {
-                $line->{'imax_pair'} = $last_pair_info;
+        foreach my $line_t ( @{$rlines} ) {
+            if ( $line_t->{'is_hanging_side_comment'} ) {
+                $line_t->{'imax_pair'} = $last_pair_info;
             }
             else {
-                $last_pair_info = $line->{'imax_pair'};
+                $last_pair_info = $line_t->{'imax_pair'};
             }
         }
     }
@@ -3913,21 +3914,21 @@ sub prune_alignment_tree {
 
         # Otherwise see if anything changed and update the tree if so
         else {
-            foreach my $depth ( 0 .. $MAX_DEPTH ) {
+            foreach my $dep ( 0 .. $MAX_DEPTH ) {
 
-                my $def_current = defined( $token_patterns_current[$depth] );
-                my $def_next    = defined( $token_patterns_next[$depth] );
+                my $def_current = defined( $token_patterns_current[$dep] );
+                my $def_next    = defined( $token_patterns_next[$dep] );
                 last if ( !$def_current && !$def_next );
                 if (   !$def_current
                     || !$def_next
-                    || $token_patterns_current[$depth] ne
-                    $token_patterns_next[$depth] )
+                    || $token_patterns_current[$dep] ne
+                    $token_patterns_next[$dep] )
                 {
                     my $n_parent;
-                    if ( $depth > 0 && defined( $match_tree[ $depth - 1 ] ) ) {
-                        $n_parent = @{ $match_tree[ $depth - 1 ] } - 1;
+                    if ( $dep > 0 && defined( $match_tree[ $dep - 1 ] ) ) {
+                        $n_parent = @{ $match_tree[ $dep - 1 ] } - 1;
                     }
-                    $end_node->( $depth, $jm, $n_parent );
+                    $end_node->( $dep, $jm, $n_parent );
                     last;
                 }
             }
@@ -4690,8 +4691,8 @@ sub align_side_comments {
 
         # Loop over the groups with side comments
         my $column_limit;
-        foreach my $ng (@todo) {
-            my ( $jbeg, $jend ) = @{ $rgroups->[$ng] };
+        foreach my $ngr (@todo) {
+            my ( $jbeg, $jend ) = @{ $rgroups->[$ngr] };
 
             # Note that since all lines in a group have common alignments, we
             # just have to work on one of the lines (the first line).