$last_unadjusted_indentation
$last_leading_token
$last_output_short_opening_token
- $peak_batch_size
$saw_VERSION_in_this_file
$saw_END_or_DATA_
# initialize the leading whitespace stack to negative levels
# so that we can never run off the end of the stack
- $peak_batch_size = 0; # flag to determine if we have output code
$gnu_position_predictor = 0; # where the current token is predicted to be
$max_gnu_stack_index = 0;
$max_gnu_item_index = -1;
$self->[_length_function_] = $length_function;
# Objects...
- $self->[_fh_tee_] = $fh_tee;
- $self->[_sink_object_] = $sink_object;
- $self->[_logger_object_] = $logger_object;
- $self->[_file_writer_object_] = $file_writer_object;
- $self->[_vertical_aligner_object_] = $vertical_aligner_object;
+ $self->[_fh_tee_] = $fh_tee;
+ $self->[_sink_object_] = $sink_object;
+ $self->[_logger_object_] = $logger_object;
+ $self->[_file_writer_object_] = $file_writer_object;
+ $self->[_vertical_aligner_object_] = $vertical_aligner_object;
- $self->[_radjusted_levels_] = [];
+ $self->[_radjusted_levels_] = [];
# Memory of processed text
$self->[_last_last_line_leading_level_] = 0;
sub prepare_for_new_input_lines {
- # Remember the largest batch size processed. This is needed
- # by the pad routine to avoid padding the first nonblank token
- if ( $max_index_to_go && $max_index_to_go > $peak_batch_size ) {
- $peak_batch_size = $max_index_to_go;
- }
-
$gnu_sequence_number++; # increment output batch counter
%last_gnu_equals = ();
%gnu_comma_count = ();
initialize_whitespace_hashes();
initialize_bond_strength_hashes();
- make_sub_matching_pattern(); # must be first pattern, see RT #133130
+ make_sub_matching_pattern(); # must be first pattern, see RT #133130
make_static_block_comment_pattern();
make_static_side_comment_pattern();
make_closing_side_comment_prefix();
$ASUB_PATTERN = '^sub$'; # match anonymous sub
$ANYSUB_PATTERN = '^sub\b'; # match either type of sub
- # Note (see also RT #133130): These patterns are used by
- # sub make_block_pattern, which is used for making most patterns.
- # So this sub needs to be called before other pattern-making routines.
+ # Note (see also RT #133130): These patterns are used by
+ # sub make_block_pattern, which is used for making most patterns.
+ # So this sub needs to be called before other pattern-making routines.
if ( $rOpts->{'sub-alias-list'} ) {
# blanks
my @nonblank_lines_at_depth;
+ # remember maximum size of previous batches; this is needed by the logical
+ # padding routine
+ my $peak_batch_size;
+
sub initialize_grind_batch_of_CODE {
@nonblank_lines_at_depth = ();
+ $peak_batch_size = 0;
}
# sub grind_batch_of_CODE sends one batch of code on down the pipeline to
}
my $rbatch_hash = {
- rlines_K => $rlines_K,
- do_not_pad => $do_not_pad,
- ibeg0 => $ri_first->[0],
+ rlines_K => $rlines_K,
+ do_not_pad => $do_not_pad,
+ ibeg0 => $ri_first->[0],
+ peak_batch_size => $peak_batch_size,
};
$self->send_lines_to_vertical_aligner($rbatch_hash);
}
}
+ # Remember the largest batch size processed. This is needed by the
+ # logical padding routine to avoid padding the first nonblank token
+ if ( $max_index_to_go && $max_index_to_go > $peak_batch_size ) {
+ $peak_batch_size = $max_index_to_go;
+ }
+
prepare_for_new_input_lines();
return;
# &Error_OutOfRange;
# }
#
- my ( $self, $ri_first, $ri_last ) = @_;
+ my ( $self, $ri_first, $ri_last, $peak_batch_size ) = @_;
my $max_line = @{$ri_first} - 1;
# FIXME: move these declarations below
Fault("Unexpected call with no lines");
return;
}
- my $n_last_line = @{$rlines_K} - 1;
- my $do_not_pad = $rbatch_hash->{do_not_pad};
+ my $n_last_line = @{$rlines_K} - 1;
+ my $do_not_pad = $rbatch_hash->{do_not_pad};
+ my $peak_batch_size = $rbatch_hash->{peak_batch_size};
my $rLL = $self->[_rLL_];
my $Klimit = $self->[_Klimit_];
$self->undo_ci( $ri_first, $ri_last );
- $self->set_logical_padding( $ri_first, $ri_last )
+ $self->set_logical_padding( $ri_first, $ri_last, $peak_batch_size )
if ( $rOpts->{'logical-padding'} );
# loop to prepare each line for shipment
if ( $saved_opening_indentation{$seqno} ) {
( $indent, $offset, $is_leading ) =
@{ $saved_opening_indentation{$seqno} };
- $exists=1;
+ $exists = 1;
}
}