# INITIALIZER: initialize_container_indentation_options
%container_indentation_options,
- # INITIALIZER: sub initialize_lp_part1
+ # INITIALIZER: sub initialize_line_up_parentheses
%line_up_parentheses_control_hash,
$line_up_parentheses_control_is_lxpl,
Exit(0);
}
- initialize_lp_part1();
+ initialize_line_up_parentheses();
check_tabs();
initialize_token_break_preferences();
initialize_old_breakpoint_controls();
- initialize_lp_part2();
-
initialize_container_indentation_options();
# make -l=0 equal to -l=infinite
for ( $rOpts->{'break-before-paren'} ) {
$break_before_container_types{'('} = $_ if $_ && $_ > 0;
}
+
+ #--------------------------------------------------------------
+ # The combination -lp -iob -vmll -bbx=2 can be unstable (b1266)
+ #--------------------------------------------------------------
+ # The -vmll and -lp parameters do not really work well together.
+ # To avoid instabilities, we will change any -bbx=2 to -bbx=1 (stable).
+ # NOTE: we could make this more precise by looking at any exclusion
+ # flags for -lp, and allowing -bbx=2 for excluded types.
+ if ( $rOpts->{'variable-maximum-line-length'}
+ && $rOpts->{'ignore-old-breakpoints'}
+ && $rOpts->{'line-up-parentheses'} )
+ {
+ my @changed;
+ foreach my $key ( keys %break_before_container_types ) {
+ if ( $break_before_container_types{$key} == 2 ) {
+ $break_before_container_types{$key} = 1;
+ push @changed, $key;
+ }
+ }
+ if (@changed) {
+
+ # we could write a warning here
+ }
+ }
return;
} ## end sub initialize_token_break_preferences
-sub initialize_lp_part1 {
+sub initialize_line_up_parentheses {
# -xlp implies -lp
if ( $rOpts->{'extended-line-up-parentheses'} ) {
}
}
+ #-----------------------------------------------------------
+ # The combination -lp -vmll can be unstable if -ci<2 (b1267)
+ #-----------------------------------------------------------
+ # The -vmll and -lp parameters do not really work well together.
+ # This is a very crude fix for an unusual parameter combination.
+ if ( $rOpts->{'variable-maximum-line-length'}
+ && $rOpts->{'line-up-parentheses'}
+ && $rOpts->{'continuation-indentation'} < 2 )
+ {
+ $rOpts->{'continuation-indentation'} = 2;
+ ##Warn("Increased -ci=n to n=2 for stability with -lp and -vmll\n");
+ }
+
+ #-----------------------------------------------------------
+ # The combination -lp -vmll -atc -dtc can be unstable
+ #-----------------------------------------------------------
+ # This fixes b1386 b1387 b1388 which had -wtc='b'
+ # Updated to to include any -wtc to fix b1426
+ if ( $rOpts->{'variable-maximum-line-length'}
+ && $rOpts->{'line-up-parentheses'}
+ && $rOpts->{'add-trailing-commas'}
+ && $rOpts->{'delete-trailing-commas'}
+ && $rOpts->{'want-trailing-commas'} )
+ {
+ $rOpts->{'delete-trailing-commas'} = 0;
+## Issuing a warning message causes trouble with test cases, and this combo is
+## so rare that it is unlikely to not occur in practice. So skip warning.
+## Warn(
+##"The combination -vmll -lp -atc -dtc can be unstable; turning off -dtc\n"
+## );
+ }
+
%line_up_parentheses_control_hash = ();
$line_up_parentheses_control_is_lxpl = 1;
my $lpxl = $rOpts->{'line-up-parentheses-exclusion-list'};
}
return;
-} ## end sub initialize_lp_part1
+} ## end sub initialize_line_up_parentheses
sub check_tabs {
return;
} ## end sub check_tabs
-sub initialize_lp_part2 {
-
- # TODO: try to merge with sub initialize_lp_part1
-
- #--------------------------------------------------------------
- # The combination -lp -iob -vmll -bbx=2 can be unstable (b1266)
- #--------------------------------------------------------------
- # The -vmll and -lp parameters do not really work well together.
- # To avoid instabilities, we will change any -bbx=2 to -bbx=1 (stable).
- # NOTE: we could make this more precise by looking at any exclusion
- # flags for -lp, and allowing -bbx=2 for excluded types.
- if ( $rOpts->{'variable-maximum-line-length'}
- && $rOpts->{'ignore-old-breakpoints'}
- && $rOpts->{'line-up-parentheses'} )
- {
- my @changed;
- foreach my $key ( keys %break_before_container_types ) {
- if ( $break_before_container_types{$key} == 2 ) {
- $break_before_container_types{$key} = 1;
- push @changed, $key;
- }
- }
- if (@changed) {
-
- # we could write a warning here
- }
- }
-
- #-----------------------------------------------------------
- # The combination -lp -vmll can be unstable if -ci<2 (b1267)
- #-----------------------------------------------------------
- # The -vmll and -lp parameters do not really work well together.
- # This is a very crude fix for an unusual parameter combination.
- if ( $rOpts->{'variable-maximum-line-length'}
- && $rOpts->{'line-up-parentheses'}
- && $rOpts->{'continuation-indentation'} < 2 )
- {
- $rOpts->{'continuation-indentation'} = 2;
- ##Warn("Increased -ci=n to n=2 for stability with -lp and -vmll\n");
- }
-
- #-----------------------------------------------------------
- # The combination -lp -vmll -atc -dtc can be unstable
- #-----------------------------------------------------------
- # This fixes b1386 b1387 b1388 which had -wtc='b'
- # Updated to to include any -wtc to fix b1426
- if ( $rOpts->{'variable-maximum-line-length'}
- && $rOpts->{'line-up-parentheses'}
- && $rOpts->{'add-trailing-commas'}
- && $rOpts->{'delete-trailing-commas'}
- && $rOpts->{'want-trailing-commas'} )
- {
- $rOpts->{'delete-trailing-commas'} = 0;
-## Issuing a warning message causes trouble with test cases, and this combo is
-## so rare that it is unlikely to not occur in practice. So skip warning.
-## Warn(
-##"The combination -vmll -lp -atc -dtc can be unstable; turning off -dtc\n"
-## );
- }
-
- return;
-} ## end sub initialize_lp_part2
-
sub initialize_container_indentation_options {
%container_indentation_options = ();