======================================================================
EOM
exit 1;
-}
+} ## end sub AUTOLOAD
sub streamhandle {
}
return $fh, ( $ref or $filename );
-}
+} ## end sub streamhandle
sub find_input_line_ending {
else { }
return $ending;
-}
+} ## end sub find_input_line_ending
{ ## begin closure for sub catfile
( $test_name, $test_path ) = fileparse($test_file);
return $test_file if ( $test_name eq $name );
return;
- }
+ } ## end sub catfile
} ## end closure for sub catfile
# Here is a map of the flow of data from the input source to the output
return 1 if ( utf8::is_utf8($string) );
return;
-}
+} ## end sub is_char_mode
sub perltidy {
ERROR_EXIT:
return wantarray ? ( 1, $rstatus ) : 1;
-} ## end of main program perltidy
+} ## end sub perltidy
} ## end of closure for sub perltidy
sub line_diff {
}
}
return wantarray ? ( $diff_marker, $pos1 ) : $diff_marker;
-}
+} ## end sub line_diff
sub compare_string_buffers {
EOM
}
return $msg;
-}
+} ## end sub compare_string_buffers
sub get_stream_as_named_file {
}
}
return ( $fname, $is_tmpfile );
-}
+} ## end sub get_stream_as_named_file
sub fileglob_to_re {
$extension = $dot . $extension;
}
return $extension;
-}
+} ## end sub make_extension
sub write_logfile_header {
my (
$logger_object->write_logfile_entry(
"To find error messages search for 'WARNING' with your editor\n");
return;
-}
+} ## end sub write_logfile_header
sub generate_options {
$add_option->( 'brace-left-exclusion-list', 'blxl', '=s' );
$add_option->( 'break-after-labels', 'bal', '=i' );
- ## This was an experiment mentioned in git #78. It works, but it does not
- ## look very useful. Instead, I expanded the functionality of the
- ## --keep-old-breakpoint-xxx flags.
- ##$add_option->( 'break-open-paren-list', 'bopl', '=s' );
+ # This was an experiment mentioned in git #78, originally named -bopl. I
+ # expanded it to also open logical blocks, based on git discussion #100,
+ # and renamed it -bocp. It works, but will remain commented out due to
+ # apparent of interest.
+ # $add_option->( 'break-open-compact-parens', 'bocp', '=s' );
########################################
$category = 6; # Controlling list formatting
\%option_category, \%option_range
);
-} ## end of generate_options
+} ## end sub generate_options
# Memoize process_command_line. Given same @ARGV passed in, return same
# values and same @ARGV back.
else {
return _process_command_line(@q);
}
-}
+} ## end sub process_command_line
# (note the underscore here)
sub _process_command_line {
return ( \%Opts, $config_file, \@raw_options, $roption_string,
$rexpansion, $roption_category, $roption_range );
-} ## end of _process_command_line
+} ## end sub _process_command_line
sub make_grep_alias_string {
my ($rOpts) = @_;
my $joined_words = join SPACE, @filtered_word_list;
$rOpts->{'grep-alias-list'} = $joined_words;
return;
-}
+} ## end sub make_grep_alias_string
sub check_options {
: $rOpts->{'tabs'} ? $rOpts->{'indent-columns'}
: $rOpts->{'default-tabsize'};
return $tabsize;
-}
+} ## end sub check_options
sub find_file_upwards {
my ( $search_dir, $search_file ) = @_;
# This return is for Perl-Critic.
# We shouldn't get out of the while loop without a return
return;
-}
+} ## end sub find_file_upwards
sub expand_command_abbreviations {
} ## end of check for circular references
} ## end of loop over all passes
return;
-}
+} ## end sub expand_command_abbreviations
# Debug routine -- this will dump the expansion hash
sub dump_short_names {
print STDOUT "$abbrev --> @list\n";
}
return;
-}
+} ## end sub dump_short_names
sub check_vms_filename {
# if we don't already have an extension then we just append the extension
my $separator = ( $base =~ /\.$/ ) ? EMPTY_STRING : "_";
return ( $path . $base, $separator );
-}
+} ## end sub check_vms_filename
sub Win_OS_Type {
# Unfortunately the logic used for the various versions isn't so clever..
# so we have to handle an outside case.
return ( $os eq "2000" && $major != 5 ) ? "NT4" : $os;
-}
+} ## end sub Win_OS_Type
sub is_unix {
return
my $Windows_type;
$Windows_type = Win_OS_Type($rpending_complaint) if $is_Windows;
return ( $is_Windows, $Windows_type );
-}
+} ## end sub look_for_Windows
sub find_config_file {
# Couldn't find a config file
return;
-}
+} ## end sub find_config_file
sub Win_Config_Locs {
return;
}
return wantarray ? ( $os, $system, $allusers ) : $os;
-}
+} ## end sub Win_Config_Locs
sub dump_config_file {
my ( $fh, $config_file, $rconfig_file_chatter ) = @_;
print STDOUT "# ...no config file found\n";
}
return;
-}
+} ## end sub dump_config_file
sub read_config_file {
}
eval { $fh->close() };
return ( \@config_list, $death_message );
-}
+} ## end sub read_config_file
sub strip_comment {
}
}
return ( $outstr, $msg );
-}
+} ## end sub strip_comment
sub parse_args {
}
}
return ( \@body_parts, $msg );
-}
+} ## end sub parse_args
sub dump_long_names {
foreach my $name ( sort @names ) { print STDOUT "$name\n" }
return;
-}
+} ## end sub dump_long_names
sub dump_defaults {
my @defaults = @_;
$readable_options .= $prefix . $key . $suffix . "\n";
}
return $readable_options;
-}
+} ## end sub readable_options
sub show_version {
print STDOUT <<"EOM";
or on the internet at http://perltidy.sourceforge.net.
EOM
return;
-}
+} ## end sub show_version
sub usage {
EOF
return;
-}
+} ## end sub usage
sub process_this_file {
if $formatter->can('finish_formatting');
return;
-}
+} ## end sub process_this_file
1;
======================================================================
EOM
exit 1;
-}
+} ## end sub AUTOLOAD
sub DESTROY {
my $self = shift;
# We shouldn't get here, but this return is to keep Perl-Critic from
# complaining.
return;
-}
+} ## end sub Fault
sub Exit {
my ($msg) = @_;
$rOpts_break_at_old_logical_breakpoints,
$rOpts_break_at_old_semicolon_breakpoints,
$rOpts_break_at_old_ternary_breakpoints,
- $rOpts_break_open_paren_list,
+ $rOpts_break_open_compact_parens,
$rOpts_closing_side_comments,
$rOpts_closing_side_comment_else_flag,
$rOpts_closing_side_comment_maximum_text,
"Attempt to create more than 1 object in $class, which is not a true class yet\n";
}
return $self;
-}
+} ## end sub new
######################################
# CODE SECTION 2: Some Basic Utilities
Fault("$msg ERROR: rLL has num=$num but Klimit='$Klimit'\n");
}
return;
-}
+} ## end sub check_rLL
sub check_keys {
my ( $rtest, $rvalid, $msg, $exact_match ) = @_;
EOM
}
return;
-}
+} ## end sub check_keys
sub check_token_array {
my $self = shift;
}
}
return;
-}
+} ## end sub check_token_array
{ ## begin closure check_line_hashes
"Checkpoint: line number =$iline, line_type=$line_type", 1 );
}
return;
- }
+ } ## end sub check_line_hashes
} ## end closure check_line_hashes
{ ## begin closure for logger routines
$str =~ s/\s+$//;
$str =~ s/^\s+//;
return split( /\s+/, $str );
-}
+} ## end sub split_words
###########################################
# CODE SECTION 3: Check and process options
$rOpts->{'break-at-old-semicolon-breakpoints'};
$rOpts_break_at_old_ternary_breakpoints =
$rOpts->{'break-at-old-ternary-breakpoints'};
- $rOpts_break_open_paren_list = $rOpts->{'break-open-paren-list'};
- $rOpts_closing_side_comments = $rOpts->{'closing-side-comments'};
+ $rOpts_break_open_compact_parens = $rOpts->{'break-open-compact-parens'};
+ $rOpts_closing_side_comments = $rOpts->{'closing-side-comments'};
$rOpts_closing_side_comment_else_flag =
$rOpts->{'closing-side-comment-else-flag'};
$rOpts_closing_side_comment_maximum_text =
}
return;
-}
+} ## end sub check_options
use constant ALIGN_GREP_ALIASES => 0;
}
}
return;
-}
+} ## end sub initialize_grep_and_friends
sub initialize_weld_nested_exclusion_rules {
%weld_nested_exclusion_rules = ();
EOM
}
return;
-}
+} ## end sub initialize_weld_nested_exclusion_rules
sub initialize_line_up_parentheses_control_hash {
my ( $str, $opt_name ) = @_;
}
return;
-}
+} ## end sub initialize_line_up_parentheses_control_hash
use constant DEBUG_KB => 0;
return;
-}
+} ## end sub initialize_keep_old_breakpoints
sub initialize_whitespace_hashes {
$binary_ws_rules{'w'}{'{'} = WS_YES;
return;
-} ## end initialize_whitespace_hashes
+} ## end sub initialize_whitespace_hashes
my %is_special_ws_type;
my %is_wCUG;
$fh->print("$key\t$want_left_space{$key}\n");
}
return;
-}
+} ## end sub dump_want_left_space
sub dump_want_right_space {
my $fh = shift;
$fh->print("$key\t$want_right_space{$key}\n");
}
return;
-}
+} ## end sub dump_want_right_space
{ ## begin closure is_essential_whitespace
; # the value of this long logic sequence is the result we want
return $result;
- }
+ } ## end sub is_essential_whitespace
} ## end closure is_essential_whitespace
{ ## begin closure new_secret_operator_whitespace
}
}
return;
- }
-} ## begin closure prepare_cuddled_block_types
+ } ## end sub prepare_cuddled_block_types
+} ## end closure prepare_cuddled_block_types
sub dump_cuddled_block_list {
my ($fh) = @_;
------------------------------------------------------------------------
EOM
return;
-}
+} ## end sub dump_cuddled_block_list
sub make_static_block_comment_pattern {
$static_block_comment_pattern = $pattern;
}
return;
-}
+} ## end sub make_static_block_comment_pattern
sub make_format_skipping_pattern {
my ( $opt_name, $default ) = @_;
);
}
return $pattern;
-}
+} ## end sub make_format_skipping_pattern
sub make_non_indenting_brace_pattern {
$non_indenting_brace_pattern = $pattern;
}
return;
-}
+} ## end sub make_non_indenting_brace_pattern
sub make_closing_side_comment_list_pattern {
make_block_pattern( '-cscl', $rOpts->{'closing-side-comment-list'} );
}
return;
-}
+} ## end sub make_closing_side_comment_list_pattern
sub make_sub_matching_pattern {
$ASUB_PATTERN =~ s/sub/\($sub_alias_list\)/;
}
return;
-}
+} ## end sub make_sub_matching_pattern
sub make_bl_pattern {
$bl_exclusion_pattern =
make_block_pattern( '-blxl', $bl_exclusion_list_string );
return;
-}
+} ## end sub make_bl_pattern
sub make_bli_pattern {
$bli_exclusion_pattern =
make_block_pattern( '-blixl', $bli_exclusion_list_string );
return;
-}
+} ## end sub make_bli_pattern
sub make_keyword_group_list_pattern {
make_block_pattern( '-kgbl', join( SPACE, @comment_list ) );
}
return;
-}
+} ## end sub make_keyword_group_list_pattern
sub make_block_brace_vertical_tightness_pattern {
$rOpts->{'block-brace-vertical-tightness-list'} );
}
return;
-}
+} ## end sub make_block_brace_vertical_tightness_pattern
sub make_blank_line_pattern {
make_block_pattern( '-blaol', $rOpts->{$key} );
}
return;
-}
+} ## end sub make_blank_line_pattern
sub make_block_pattern {
}
$pattern = '^' . $pattern;
return $pattern;
-}
+} ## end sub make_block_pattern
sub make_static_side_comment_pattern {
$static_side_comment_pattern = $pattern;
}
return;
-}
+} ## end sub make_static_side_comment_pattern
sub make_closing_side_comment_prefix {
$rOpts->{'closing-side-comment-prefix'} = $csc_prefix;
$closing_side_comment_prefix_pattern = $csc_prefix_pattern;
return;
-}
+} ## end sub make_closing_side_comment_prefix
##################################################
# CODE SECTION 4: receive lines from the tokenizer
%saw_closing_seqno = ();
return;
- }
+ } ## end sub initialize_write_line
sub check_sequence_numbers {
}
}
return;
- }
+ } ## end sub check_sequence_numbers
sub write_line {
push @{$rlines_new}, $line_of_tokens;
return;
- }
+ } ## end sub write_line
} ## end closure write_line
#############################################
# A final routine to tie up any loose ends
$self->wrapup();
return;
-}
+} ## end sub finish_formatting
sub set_CODE_type {
my ($self) = @_;
}
return \@ix_side_comments;
-}
+} ## end sub set_CODE_type
sub find_non_indenting_braces {
}
}
return;
-}
+} ## end sub find_non_indenting_braces
sub delete_side_comments {
my ( $self, $rix_side_comments ) = @_;
}
}
return;
-}
+} ## end sub delete_side_comments
sub dump_verbatim {
my $self = shift;
$self->resync_lines_and_tokens();
return;
-}
+} ## end sub respace_tokens
sub copy_token_as_type {
$rnew_token[_TOKEN_] = $token;
$rnew_token[_TYPE_SEQUENCE_] = EMPTY_STRING;
return \@rnew_token;
-}
+} ## end sub copy_token_as_type
sub Debug_dump_tokens {
$K++;
}
return;
-}
+} ## end sub Debug_dump_tokens
sub K_next_code {
my ( $self, $KK, $rLL ) = @_;
$Knnb++;
}
return;
-}
+} ## end sub K_next_code
sub K_next_nonblank {
my ( $self, $KK, $rLL ) = @_;
$Knnb++;
}
return;
-}
+} ## end sub K_next_nonblank
sub K_previous_code {
$Kpnb--;
}
return;
-}
+} ## end sub K_previous_code
sub K_previous_nonblank {
$Kpnb--;
}
return;
-}
+} ## end sub K_previous_nonblank
sub parent_seqno_by_K {
}
$parent_seqno = SEQ_ROOT unless ( defined($parent_seqno) );
return $parent_seqno;
-}
+} ## end sub parent_seqno_by_K
sub is_in_block_by_i {
my ( $self, $i ) = @_;
return 1 if ( !$seqno || $seqno eq SEQ_ROOT );
return 1 if ( $self->[_rblock_type_of_seqno_]->{$seqno} );
return;
-}
+} ## end sub is_in_block_by_i
sub is_in_list_by_i {
my ( $self, $i ) = @_;
return 1;
}
return;
-}
+} ## end sub is_in_list_by_i
sub is_list_by_K {
}
}
return;
-}
+} ## end sub resync_lines_and_tokens
sub keep_old_line_breaks {
);
}
return;
-}
+} ## end sub keep_old_line_breaks
sub weld_containers {
}
return;
-}
+} ## end sub weld_containers
sub cumulative_length_before_K {
my ( $self, $KK ) = @_;
}
}
return;
-}
+} ## end sub weld_cuddled_blocks
sub find_nested_pairs {
my $self = shift;
sort { $a->[2] <=> $b->[2] } @nested_pairs;
return \@nested_pairs;
-}
+} ## end sub find_nested_pairs
sub match_paren_flag {
elsif ( $flag eq 'w' ) { $match = $is_w }
elsif ( $flag eq 'W' ) { $match = !$is_w }
return $match;
-}
+} ## end sub match_paren_flag
sub is_excluded_weld {
return 0 unless ( defined($flag) );
return 1 if $flag eq '*';
return $self->match_paren_flag( $KK, $flag );
-}
+} ## end sub is_excluded_weld
# hashes to simplify welding logic
my %type_ok_after_bareword;
}
}
return ( $new_weld_ok, $maximum_text_length, $starting_lentot, $msg );
-}
+} ## end sub setup_new_weld_measurements
sub excess_line_length_for_Krange {
my ( $self, $Kfirst, $Klast ) = @_;
&& print
"Kfirst=$Kfirst, Klast=$Klast, Kend=$Kend, level=$level, ci=$ci_level, max_text_length=$max_text_length, length=$length\n";
return ($excess_length);
-}
+} ## end sub excess_line_length_for_Krange
sub weld_nested_containers {
my ($self) = @_;
}
return;
-}
+} ## end sub weld_nested_containers
sub weld_nested_quotes {
}
}
return;
-}
+} ## end sub weld_nested_quotes
sub is_welded_at_seqno {
return unless defined($KK_o);
return defined( $self->[_rK_weld_left_]->{$KK_o} )
|| defined( $self->[_rK_weld_right_]->{$KK_o} );
-}
+} ## end sub is_welded_at_seqno
sub mark_short_nested_blocks {
}
return;
-}
+} ## end sub mark_short_nested_blocks
sub adjust_indentation_levels {
$self->clip_adjusted_levels();
return;
-}
+} ## end sub adjust_indentation_levels
sub clip_adjusted_levels {
return unless defined($radjusted_levels) && @{$radjusted_levels};
foreach ( @{$radjusted_levels} ) { $_ = 0 if ( $_ < 0 ) }
return;
-}
+} ## end sub clip_adjusted_levels
sub do_non_indenting_braces {
$KK_last = $KK;
}
return;
-}
+} ## end sub do_non_indenting_braces
sub whitespace_cycle_adjustment {
}
}
return;
-}
+} ## end sub whitespace_cycle_adjustment
use constant DEBUG_BBX => 0;
$rbreak_before_container_by_seqno;
$self->[_rwant_reduced_ci_] = $rwant_reduced_ci;
return;
-}
+} ## end sub break_before_list_opening_containers
use constant DEBUG_XCI => 0;
$seqno_top = $seqno;
}
return;
-}
+} ## end sub extended_ci
sub braces_left_setup {
}
}
return;
-}
+} ## end sub braces_left_setup
sub bli_adjustment {
}
}
return;
-}
+} ## end sub bli_adjustment
sub find_multiline_qw {
$self->[_rmultiline_qw_has_extra_level_] = $rmultiline_qw_has_extra_level;
return;
-}
+} ## end sub find_multiline_qw
use constant DEBUG_COLLAPSED_LENGTHS => 0;
}
return;
-}
+} ## end sub collapsed_lengths
sub is_excluded_lp {
}
}
return $match_flag2;
-}
+} ## end sub is_excluded_lp
sub set_excluded_lp_containers {
}
}
return;
-}
+} ## end sub set_excluded_lp_containers
######################################
# CODE SECTION 6: Process line-by-line
$forced_breakpoint_undo_count = 0;
return;
- }
+ } ## end sub initialize_batch_variables
sub leading_spaces_to_go {
return 0 if ( $ii < 0 );
my $indentation = $leading_spaces_to_go[$ii];
return ref($indentation) ? $indentation->get_spaces() : $indentation;
- }
+ } ## end sub leading_spaces_to_go
sub create_one_line_block {
( $index_start_one_line_block, $semicolons_before_block_self_destruct )
"STORE: from $a $c: storing token $token type $type lev=$level at $max_index_to_go\n";
};
return;
- }
+ } ## end sub store_token_to_go
sub flush_batch_of_CODE {
}
return;
- }
+ } ## end sub flush_batch_of_CODE
sub end_batch {
$self->flush_batch_of_CODE();
return;
- }
+ } ## end sub end_batch
sub flush_vertical_aligner {
my ($self) = @_;
$self->flush_vertical_aligner();
return;
- }
+ } ## end sub flush
sub process_line_of_CODE {
# OK to keep the paren tight
return 1;
-}
+} ## end sub tight_paren_follows
my %is_brace_semicolon_colon;
create_one_line_block( $i_start, 1 );
}
return 0;
-}
+} ## end sub starting_one_line_block
sub unstore_token_to_go {
$max_index_to_go = UNDEFINED_INDEX;
}
return;
-}
+} ## end sub unstore_token_to_go
sub compare_indentation_levels {
}
}
return;
-}
+} ## end sub compare_indentation_levels
###################################################
# CODE SECTION 8: Utilities for setting breakpoints
};
return $i_nonblank;
- }
+ } ## end sub set_forced_breakpoint
sub set_forced_breakpoint_AFTER {
my ( $self, $i ) = @_;
}
}
return;
- }
+ } ## end sub set_forced_breakpoint_AFTER
sub clear_breakpoint_undo_stack {
my ($self) = @_;
}
}
return;
- }
+ } ## end sub undo_forced_breakpoint_stack
} ## end closure set_forced_breakpoint
{ ## begin closure set_closing_breakpoint
}
}
return;
- }
+ } ## end sub set_closing_breakpoint
} ## end closure set_closing_breakpoint
#########################################
}
}
return;
- }
+ } ## end sub check_grind_input
sub grind_batch_of_CODE {
}
return;
- }
+ } ## end sub grind_batch_of_CODE
sub save_opening_indentation {
];
}
return;
- }
+ } ## end sub save_opening_indentation
sub get_saved_opening_indentation {
my ($seqno) = @_;
# (example is badfile.t)
return ( $indent, $offset, $is_leading, $exists );
- }
+ } ## end sub get_saved_opening_indentation
} ## end closure grind_batch_of_CODE
sub lookup_opening_indentation {
my $offset = token_sequence_length( $ibeg, $i_opening ) - 1;
my $is_leading = ( $ibeg == $i_opening );
return ( $rindentation_list->[ $nline + 1 ], $offset, $is_leading );
-}
+} ## end sub lookup_opening_indentation
sub terminal_type_i {
$type_i = 'b';
}
return wantarray ? ( $type_i, $i ) : $type_i;
-}
+} ## end sub terminal_type_i
sub pad_array_to_go {
$nesting_depth_to_go[ $max_index_to_go + 1 ] += 1;
}
return;
-}
+} ## end sub pad_array_to_go
sub break_all_chain_tokens {
$self->insert_additional_breaks( \@insert_list, $ri_left, $ri_right );
}
return;
-}
+} ## end sub break_all_chain_tokens
sub insert_additional_breaks {
}
}
return;
-}
+} ## end sub insert_additional_breaks
{ ## begin closure in_same_container_i
my $ris_break_token;
return if ( $rbreak->{$tok_i} );
}
return 1;
- }
+ } ## end sub in_same_container_i
} ## end closure in_same_container_i
sub break_equals {
$self->insert_additional_breaks( \@insert_list, $ri_left, $ri_right );
}
return;
-}
+} ## end sub break_equals
{ ## begin closure recombine_breakpoints
}
print STDERR "----\n";
return;
- }
+ } ## end sub Debug_dump_breakpoints
sub delete_one_line_semicolons {
}
}
return;
- }
+ } ## end sub delete_one_line_semicolons
use constant DEBUG_RECOMBINE => 0;
"exiting recombine with $nmax_last lines, starting lines=$nmax_start, iterations=$it_count, max_it=$it_count_max numsec=$num_sections\n";
}
return;
- }
+ } ## end sub recombine_breakpoints
} ## end closure recombine_breakpoints
sub insert_final_ternary_breaks {
}
}
return;
-}
+} ## end sub insert_final_ternary_breaks
sub insert_breaks_before_list_opening_containers {
$self->insert_additional_breaks( \@insert_list, $ri_left, $ri_right );
}
return;
-}
+} ## end sub insert_breaks_before_list_opening_containers
sub note_added_semicolon {
my ( $self, $line_number ) = @_;
$self->[_added_semicolon_count_]++;
write_logfile_entry("Added ';' here\n");
return;
-}
+} ## end sub note_added_semicolon
sub note_deleted_semicolon {
my ( $self, $line_number ) = @_;
$self->[_deleted_semicolon_count_]++;
write_logfile_entry("Deleted unnecessary ';' at line $line_number\n");
return;
-}
+} ## end sub note_deleted_semicolon
sub note_embedded_tab {
my ( $self, $line_number ) = @_;
write_logfile_entry("Embedded tabs in quote or pattern\n");
}
return;
-}
+} ## end sub note_embedded_tab
use constant DEBUG_CORRECT_LP => 0;
} ## end loop over tokens in a line
} ## end loop over lines
return $do_not_pad;
-}
+} ## end sub correct_lp_indentation
sub undo_lp_ci {
@leading_spaces_to_go[ @{$ri_first}[ $line_1 .. $n ] ] =
@reduced_spaces_to_go[ @{$ri_first}[ $line_1 .. $n ] ];
return;
-}
+} ## end sub undo_lp_ci
###############################################
# CODE SECTION 10: Code to break long statments
}
}
return ( \@i_first, \@i_last, $rbond_strength_to_go );
-}
+} ## end sub break_long_lines
###########################################
# CODE SECTION 11: Code to break long lists
$list_stress_level = min( $stress_level_alpha, $stress_level_beta + 2 );
return;
- }
+ } ## end sub initialize_break_lists
# routine to define essential variables when we go 'up' to
# a new depth
}
}
return;
- }
+ } ## end sub check_for_new_minimum_depth
# routine to decide which commas to break at within a container;
# returns:
}
}
return ( $bp_count, $do_not_break_apart );
- }
+ } ## end sub set_comma_breakpoints
# These types are excluded at breakpoints to prevent blinking
# Switched from excluded to included as part of fix for b1214
}
}
return;
- }
+ } ## end sub do_uncontained_comma_breaks
my %is_logical_container;
my %quick_filter;
}
}
return;
- }
+ } ## end sub set_logical_breakpoints
sub is_unbreakable_container {
# broken open to avoid too much density. Also, since it contains no 'or's, there
# will be a forced break at its 'and'.
+ # Open-up if parens if requested. We do this by pretending we
+ # did not see the opening structure, since in that case parens
+ # always get opened up.
+ if ( $saw_opening_structure
+ && $rOpts_break_open_compact_parens )
+ {
+
+ # This parameter is a one-character flag, as follows:
+ # '0' matches no parens -> break open NOT OK
+ # '1' matches all parens -> break open OK
+ # Other values are same as used by the weld-exclusion-list
+ my $flag = $rOpts_break_open_compact_parens;
+ if ( $flag eq '*'
+ || $flag eq '1' )
+ {
+ $saw_opening_structure = 0;
+ }
+ else {
+ my $KK = $K_to_go[$i_opening];
+ $saw_opening_structure =
+ !$self->match_paren_flag( $KK, $flag );
+ }
+ }
+
# set some flags telling something about this container..
my $is_simple_logical_expression = 0;
if ( $item_count_stack[$current_depth] == 0
EOM
return $i_opening_minus;
-}
+} ## end sub find_token_starting_list
{ ## begin closure set_comma_breakpoints_do
$two_line_word_wrap_ok = 1;
# but turn off word wrap where requested
- if ($rOpts_break_open_paren_list) {
+ if ($rOpts_break_open_compact_parens) {
# This parameter is a one-character flag, as follows:
# '0' matches no parens -> break open NOT OK -> word wrap OK
# '1' matches all parens -> break open OK -> word wrap NOT OK
# Other values are the same as used by the weld-exclusion-list
- my $flag = $rOpts_break_open_paren_list;
+ my $flag = $rOpts_break_open_compact_parens;
if ( $flag eq '*'
|| $flag eq '1' )
{
$j += $number_of_fields;
}
return;
- }
+ } ## end sub set_comma_breakpoints_do
} ## end closure set_comma_breakpoints_do
sub study_list_complexity {
}
return ( $number_of_fields_best, \@i_ragged_break_list, $identifier_count );
-}
+} ## end sub study_list_complexity
sub get_maximum_fields_wanted {
}
}
return ($number_of_fields_best);
-}
+} ## end sub get_maximum_fields_wanted
sub table_columns_available {
my $i_first_comma = shift;
# available columns is reduced by 1 character.
$columns -= 1;
return $columns;
-}
+} ## end sub table_columns_available
sub maximum_number_of_fields {
$number_of_fields++;
}
return $number_of_fields;
-}
+} ## end sub maximum_number_of_fields
sub compactify_table {
}
}
return $number_of_fields;
-}
+} ## end sub compactify_table
sub set_ragged_breakpoints {
}
}
return $break_count;
-}
+} ## end sub set_ragged_breakpoints
sub copy_old_breakpoints {
my ( $self, $i_first_comma, $i_last_comma ) = @_;
};
}
return;
-}
+} ## end sub set_nobreaks
###############################################
# CODE SECTION 12: Code for setting indentation
}
return $summed_lengths_to_go[ $iend + 1 ] - $summed_lengths_to_go[$ibeg];
-}
+} ## end sub token_sequence_length
sub total_line_length {
$summed_lengths_to_go[ $iend + 1 ] - $summed_lengths_to_go[$ibeg];
return $length;
-}
+} ## end sub total_line_length
sub excess_line_length {
}
return $excess;
-}
+} ## end sub excess_line_length
sub get_spaces {
# indentation variable. $indentation is either a constant number of
# spaces or an object with a get_available_spaces method.
return ref($item) ? $item->get_available_spaces() : 0;
-}
+} ## end sub get_available_spaces_to_go
{ ## begin closure set_lp_indentation
$rLP->[$max_lp_stack]->[_lp_space_count_] = 0;
return;
- }
+ } ## end sub initialize_lp_vars
# hashes for efficient testing
my %hash_test1;
if ( !$rOpts_extended_line_up_parentheses );
return;
- }
+ } ## end sub set_lp_indentation
sub check_for_long_gnu_style_lines {
last unless ( $spaces_needed > 0 );
}
return;
- }
+ } ## end sub check_for_long_gnu_style_lines
sub undo_incomplete_lp_indentation {
}
}
return;
- }
+ } ## end sub undo_incomplete_lp_indentation
} ## end closure set_lp_indentation
#----------------------------------------------------------------------
}
}
return;
-}
+} ## end sub set_forced_lp_break
sub reduce_lp_indentation {
}
return $deleted_spaces;
-}
+} ## end sub reduce_lp_indentation
###########################################################
# CODE SECTION 13: Preparing batches for vertical alignment
}
}
return;
-}
+} ## end sub check_convey_batch_input
sub convey_batch_to_vertical_aligner {
$file_writer_object->write_code_line( $cscw_block_comment . "\n" );
}
return;
-}
+} ## end sub convey_batch_to_vertical_aligner
sub check_batch_summed_lengths {
}
}
return;
-}
+} ## end sub check_batch_summed_lengths
{ ## begin closure set_vertical_alignment_markers
my %is_vertical_alignment_type;
}
}
return ($seqno);
-}
+} ## end sub get_seqno
{
my %undo_extended_ci;
}
return;
- }
+ } ## end sub undo_ci
}
{ ## begin closure set_logical_padding
$has_leading_op = $has_leading_op_next;
} ## end of loop over lines
return;
- }
+ } ## end sub set_logical_padding
} ## end closure set_logical_padding
sub pad_token {
$summed_lengths_to_go[ $i + 1 ] += $pad_spaces;
}
return;
-}
+} ## end sub pad_token
{ ## begin closure make_alignment_patterns
$name = substr( $name, 2 );
}
return $name;
-}
+} ## end sub make_paren_name
{ ## begin closure final_indentation_adjustment
return ( $indentation, $lev, $level_end, $terminal_type,
$terminal_block_type, $is_semicolon_terminated,
$is_outdented_line );
- }
+ } ## end sub final_indentation_adjustment
} ## end closure final_indentation_adjustment
sub get_opening_indentation {
get_saved_opening_indentation($seqno);
}
return ( $indent, $offset, $is_leading, $exists );
-}
+} ## end sub get_opening_indentation
sub set_vertical_tightness_flags {
};
return ($rvertical_tightness_flags);
-}
+} ## end sub set_vertical_tightness_flags
##########################################################
# CODE SECTION 14: Code for creating closing side comments
$accumulating_text_for_block = EMPTY_STRING;
reset_block_text_accumulator();
return;
- }
+ } ## end sub initialize_csc_vars
sub reset_block_text_accumulator {
$leading_block_text_line_number = 0;
$leading_block_text_line_length = 0;
return;
- }
+ } ## end sub reset_block_text_accumulator
sub set_block_text_accumulator {
my ( $self, $i ) = @_;
length( $rOpts->{'closing-side-comment-prefix'} ) +
$leading_block_text_level * $rOpts_indent_columns + 3;
return;
- }
+ } ## end sub set_block_text_accumulator
sub accumulate_block_text {
my ( $self, $i ) = @_;
}
}
return;
- }
+ } ## end sub accumulate_block_text
sub accumulate_csc_text {
return ( $terminal_type, $i_terminal, $i_block_leading_text,
$block_leading_text, $block_line_count, $block_label );
- }
+ } ## end sub accumulate_csc_text
sub make_else_csc_text {
$csc_text = $saved_text;
}
return $csc_text;
- }
+ } ## end sub make_else_csc_text
} ## end closure accumulate_csc_text
{ ## begin closure balance_csc_text
# return the balanced string
return $csc;
- }
+ } ## end sub balance_csc_text
} ## end closure balance_csc_text
sub add_closing_side_comment {
}
}
return ( $closing_side_comment, $cscw_block_comment );
-}
+} ## end sub add_closing_side_comment
############################
# CODE SECTION 15: Summarize
|| $rOpts->{'indent-only'};
return;
-}
+} ## end sub wrapup
} ## end package Perl::Tidy::Formatter
1;