]> git.donarmstrong.com Git - perltidy.git/commitdiff
complete coding for -bos option
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 7 Apr 2020 14:39:07 +0000 (07:39 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 7 Apr 2020 14:39:07 +0000 (07:39 -0700)
lib/Perl/Tidy/Formatter.pm
t/snippets/bos.in [new file with mode: 0644]
t/snippets/bos.par [new file with mode: 0644]
t/snippets/expect/bos.bos [new file with mode: 0644]
t/snippets/expect/bos.def [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets17.t

index 54f03e53e14ddf9f1b51ca664b3f055cf9bd8d01..663514fe2476210fbedf2ce0244930eb2a504833 100644 (file)
@@ -5977,14 +5977,16 @@ EOM
             Warn("Conflicting parameters: -iob and -boc; -boc will be ignored\n"
             );
         }
+        if ( $rOpts->{'break-at-old-semicolon-breakpoints'} ) {
+            Warn("Conflicting parameters: -iob and -bos; -bos will be ignored\n"
+            );
+        }
 
         # Note: there are additional parameters that can be made inactive by
         # -iob, but they are on by default so we would generate excessive
         # warnings if we noted them. They are:
         # $rOpts->{'break-at-old-keyword-breakpoints'}
         # $rOpts->{'break-at-old-logical-breakpoints'}
-        # $rOpts->{'break-at-old-method-breakpoints'}
-        # $rOpts->{'break-at-old-semicolon-breakpoints'}
         # $rOpts->{'break-at-old-ternary-breakpoints'}
         # $rOpts->{'break-at-old-attribute-breakpoints'}
     }
@@ -15769,6 +15771,8 @@ sub sync_token_K {
 
         my $rOpts_short_concatenation_item_length =
           $rOpts->{'short-concatenation-item-length'};
+        my $rOpts_break_at_old_semicolon_breakpoints =
+          $rOpts->{'break-at-old-semicolon-breakpoints'};
 
         # Make a list of all good joining tokens between the lines
         # n-1 and n.
@@ -15888,6 +15892,10 @@ sub sync_token_K {
                 # do any special checks for it
                 if ( $n == $nmax ) {
 
+                    next
+                      if ( $type_ibeg_2 eq ';'
+                        && $rOpts_break_at_old_semicolon_breakpoints );
+
                     # a terminal '{' should stay where it is
                     # unless preceded by a fat comma
                     next if ( $type_ibeg_2 eq '{' && $type_iend_1 ne '=>' );
diff --git a/t/snippets/bos.in b/t/snippets/bos.in
new file mode 100644 (file)
index 0000000..3f5bae1
--- /dev/null
@@ -0,0 +1,2 @@
+        $top_label->set_text( gettext("check permissions.") )
+          ;
diff --git a/t/snippets/bos.par b/t/snippets/bos.par
new file mode 100644 (file)
index 0000000..da24ab3
--- /dev/null
@@ -0,0 +1 @@
+-bos
diff --git a/t/snippets/expect/bos.bos b/t/snippets/expect/bos.bos
new file mode 100644 (file)
index 0000000..3f5bae1
--- /dev/null
@@ -0,0 +1,2 @@
+        $top_label->set_text( gettext("check permissions.") )
+          ;
diff --git a/t/snippets/expect/bos.def b/t/snippets/expect/bos.def
new file mode 100644 (file)
index 0000000..c62a5c5
--- /dev/null
@@ -0,0 +1 @@
+        $top_label->set_text( gettext("check permissions.") );
index 2fef0807eb5509c15e6c25f44b949dae3f82f7b8..e0bc4d482baf1f51b178c676f8848c82ab9a1e5a 100644 (file)
 ../snippets17.t        wn7.wn
 ../snippets17.t        wn8.def
 ../snippets17.t        wn8.wn
+../snippets17.t        pbp6.def
+../snippets17.t        pbp6.pbp
 ../snippets2.t angle.def
 ../snippets2.t arrows1.def
 ../snippets2.t arrows2.def
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
-../snippets17.t        pbp6.def
-../snippets17.t        pbp6.pbp
+../snippets17.t        bos.bos
+../snippets17.t        bos.def
index c164d5088769c2db961bcb12b36b79268450c62a..3daa35ccc55b2956f30a6d70ff78a336d8910a89 100644 (file)
@@ -12,6 +12,8 @@
 #9 wn8.wn
 #10 pbp6.def
 #11 pbp6.pbp
+#12 bos.bos
+#13 bos.def
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -29,6 +31,7 @@ BEGIN {
     # BEGIN SECTION 1: Parameter combinations #
     ###########################################
     $rparams = {
+        'bos'      => "-bos",
         'def'      => "",
         'pbp'      => "-pbp -nst -nse",
         'rperl'    => "-l=0",
@@ -41,6 +44,11 @@ BEGIN {
     ############################
     $rsources = {
 
+        'bos' => <<'----------',
+        $top_label->set_text( gettext("check permissions.") )
+          ;
+----------
+
         'pbp6' => <<'----------',
        # These formerly blinked with -pbp
         return $width1*$common_length*(
@@ -390,6 +398,23 @@ sub foo_subroutine_in_main {
 
 #11...........
         },
+
+        'bos.bos' => {
+            source => "bos",
+            params => "bos",
+            expect => <<'#12...........',
+        $top_label->set_text( gettext("check permissions.") )
+          ;
+#12...........
+        },
+
+        'bos.def' => {
+            source => "bos",
+            params => "def",
+            expect => <<'#13...........',
+        $top_label->set_text( gettext("check permissions.") );
+#13...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};