]> git.donarmstrong.com Git - perltidy.git/commitdiff
changed parameter name -ihb to -bbhbi, etc, for clarity
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 19 Sep 2020 14:55:19 +0000 (07:55 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 19 Sep 2020 14:55:19 +0000 (07:55 -0700)
CHANGES.md
bin/perltidy
docs/ChangeLog.html
docs/perltidy.html
lib/Perl/Tidy.pm
lib/Perl/Tidy/Formatter.pm
t/snippets/bbhb4.par
t/snippets/bbhb5.par
t/snippets22.t

index 88ee52efb3db8351a2a6223b075f21c78d2aa758..857482997af6d29a13344091eb13d8d06784306b 100644 (file)
@@ -7,7 +7,7 @@
 
     - Added parameters -bbhb=n (--break-before-hash-brace=n), -bbsb=n (--break-before-square-bracket=n),
       and -bbp=n (--break-before-paren=n) suggested in git #38.  These provide control over the
-      opening container token of a multiple-line list.  Related new parameters -ihb=n, -isb=n, -ip=n
+      opening container token of a multiple-line list.  Related new parameters -bbhbi=n, -bbsbi=n, -bbpi=n
       control indentation of these tokens.
 
     - Numerous issues have been found during automated testing and fixed. Many involve references to
index 8ce05e3a3a93835aaeea91fca17f21d4f96730cf..35cecf7fbba6bf5ebe7741836b5dab9f45aeb94a 100755 (executable)
@@ -2163,8 +2163,8 @@ There are several points to note about this flag:
 
 =item *
 
-This parameter only applies to opening hash braces which are preceded by an '='
-or '=>'.
+This parameter only applies if the opening brace is preceded by an '='
+or '=>' or ','.
 
 =item *
 
@@ -2186,7 +2186,7 @@ this parameter has no effect.
 
 The indentation of the braces will normally be one level of continuation
 indentation by default.  This can be changed with the parameter
-B<--indent-hash-brace=n> in the next section.
+B<-bbhbi=n> in the next section.
 
 =item *
 
@@ -2194,18 +2194,18 @@ Similar flags for controlling parens and square brackets are given in the subseq
 
 =back   
 
-=item B<-ihb=n>,  B<--indent-hash-brace=n>
+=item B<-bbhbi=n>,  B<--break-before-hash-brace-and-indent=n>
 
 This flag is a companion to B<-bbhb=n> for controlling the indentation of an opening hash brace
 which is placed on a new line by that parameter.  The indentation is as follows:
 
-  -ihb=0 one continuation level [default]
-  -ihb=1 outdent by one continuation level
-  -ihb=2 indent one full indentation level
+  -bbhbi=0 one continuation level [default]
+  -bbhbi=1 outdent by one continuation level
+  -bbhbi=2 indent one full indentation level
 
 For example:
 
-    # perltidy -bbhb=3 -ihb=1
+    # perltidy -bbhb=3 -bbhbi=1
     $romanNumerals =
     {
         one   => 'I',
@@ -2214,7 +2214,7 @@ For example:
         four  => 'IV',
     };
 
-    # perltidy -bbhb=3 -ihb=2
+    # perltidy -bbhb=3 -bbhbi=2
     $romanNumerals =
         {
         one   => 'I',
@@ -2223,42 +2223,43 @@ For example:
         four  => 'IV',
         };
 
+Note that this parameter has no effect unless B<-bbhb=n> is also set.
+
 =item B<-bbsb=n>,  B<--break-before-square-bracket=n>
 
-This flag is similar to the flag described above, except it applies to square brackets.
+This flag is similar to the flag described above, except it applies to lists contained within square brackets.
 
   -bbsb=0 never break [default]
   -bbsb=1 stable: break if the input script had a break
   -bbsb=2 break if list is 'complex' (part of nested list structure)
   -bbsb=3 always break
 
-=item B<-isb=n>,  B<--indent-square-bracket=n>
+=item B<-bbsbi=n>,  B<--break-before-square-bracket-and-indent=n>
 
 This flag is a companion to B<-bbsb=n> for controlling the indentation of an opening square bracket
 which is placed on a new line by that parameter.  The indentation is as follows:
 
-  -isb=0 one continuation level [default]
-  -isb=1 outdent by one continuation level
-  -isb=2 indent one full indentation level
+  -bbsbi=0 one continuation level [default]
+  -bbsbi=1 outdent by one continuation level
+  -bbsbi=2 indent one full indentation level
 
 =item B<-bbp=n>,  B<--break-before-paren=n>
 
-This flag is similar to B<-bbhb=n>, described above, except it applies to parens.
+This flag is similar to B<-bbhb=n>, described above, except it applies to lists contained within parens.
 
   -bbp=0 never break [default]
   -bbp=1 stable: break if the input script had a break
   -bpb=2 break if list is 'complex' (part of nested list structure)
   -bbp=3 always break
 
-=item B<-ip=n>,  B<--indent-paren=n>
+=item B<-bbpi=n>,  B<--break-before-paren-and-indent=n>
 
 This flag is a companion to B<-bbp=n> for controlling the indentation of an opening paren
 which is placed on a new line by that parameter.  The indentation is as follows:
 
-  -ip=0 one continuation level [default]
-  -ip=1 outdent by one continuation level
-  -ip=2 indent one full indentation level
-
+  -bbpi=0 one continuation level [default]
+  -bbpi=1 outdent by one continuation level
+  -bbpi=2 indent one full indentation level
 
 =item B<-wn>,  B<--weld-nested-containers> 
 
index 04ab4789120d69c57210cc4b1d7092a4efc8f487..ebd4ac6dceb59edab334de7c12f48a3acbb78611 100644 (file)
@@ -7,7 +7,7 @@
 
 - Added parameters -bbhb=n (--break-before-hash-brace=n), -bbsb=n (--break-before-square-bracket=n),
   and -bbp=n (--break-before-paren=n) suggested in git #38.  These provide control over the
-  opening container token of a multiple-line list.  Related new parameters -ihb=n, -isb=n, -ip=n
+  opening container token of a multiple-line list.  Related new parameters -bbhbi=n, -bbsbi=n, -bbpi=n
   control indentation of these tokens.
 
 - Numerous issues have been found during automated testing and fixed. Many involve references to
index 63e003696b71acf0b6093861703e6f605670ffc5..510d07d29381c3f7213bebf9e58cd47b23d444b1 100644 (file)
 
 <ul>
 
-<li><p>This parameter only applies to opening hash braces which are preceded by an &#39;=&#39; or &#39;=&gt;&#39;.</p>
+<li><p>This parameter only applies if the opening brace is preceded by an &#39;=&#39; or &#39;=&gt;&#39; or &#39;,&#39;.</p>
 
 </li>
 <li><p>This parameter only applies if the contents of the container looks like a list. The contents need to contain some commas or &#39;=&gt;&#39;s at the next interior level to be considered a list.</p>
 <li><p>If multiple opening tokens have been &#39;welded&#39; together with the <b>-wn</b> parameter, then this parameter has no effect.</p>
 
 </li>
-<li><p>The indentation of the braces will normally be one level of continuation indentation by default. This can be changed with the parameter <b>--indent-hash-brace=n</b> in the next section.</p>
+<li><p>The indentation of the braces will normally be one level of continuation indentation by default. This can be changed with the parameter <b>-bbhbi=n</b> in the next section.</p>
 
 </li>
 <li><p>Similar flags for controlling parens and square brackets are given in the subsequent section.</p>
 </ul>
 
 </dd>
-<dt id="ihb-n---indent-hash-brace-n"><b>-ihb=n</b>, <b>--indent-hash-brace=n</b></dt>
+<dt id="bbhbi-n---break-before-hash-brace-and-indent-n"><b>-bbhbi=n</b>, <b>--break-before-hash-brace-and-indent=n</b></dt>
 <dd>
 
 <p>This flag is a companion to <b>-bbhb=n</b> for controlling the indentation of an opening hash brace which is placed on a new line by that parameter. The indentation is as follows:</p>
 
-<pre><code>  -ihb=0 one continuation level [default]
-  -ihb=1 outdent by one continuation level
-  -ihb=2 indent one full indentation level</code></pre>
+<pre><code>  -bbhbi=0 one continuation level [default]
+  -bbhbi=1 outdent by one continuation level
+  -bbhbi=2 indent one full indentation level</code></pre>
 
 <p>For example:</p>
 
-<pre><code>    # perltidy -bbhb=3 -ihb=1
+<pre><code>    # perltidy -bbhb=3 -bbhbi=1
     $romanNumerals =
     {
         one   =&gt; &#39;I&#39;,
         four  =&gt; &#39;IV&#39;,
     };
 
-    # perltidy -bbhb=3 -ihb=2
+    # perltidy -bbhb=3 -bbhbi=2
     $romanNumerals =
         {
         one   =&gt; &#39;I&#39;,
         four  =&gt; &#39;IV&#39;,
         };</code></pre>
 
+<p>Note that this parameter has no effect unless <b>-bbhb=n</b> is also set.</p>
+
 </dd>
 <dt id="bbsb-n---break-before-square-bracket-n"><b>-bbsb=n</b>, <b>--break-before-square-bracket=n</b></dt>
 <dd>
 
-<p>This flag is similar to the flag described above, except it applies to square brackets.</p>
+<p>This flag is similar to the flag described above, except it applies to lists contained within square brackets.</p>
 
 <pre><code>  -bbsb=0 never break [default]
   -bbsb=1 stable: break if the input script had a break
   -bbsb=3 always break</code></pre>
 
 </dd>
-<dt id="isb-n---indent-square-bracket-n"><b>-isb=n</b>, <b>--indent-square-bracket=n</b></dt>
+<dt id="bbsbi-n---break-before-square-bracket-and-indent-n"><b>-bbsbi=n</b>, <b>--break-before-square-bracket-and-indent=n</b></dt>
 <dd>
 
 <p>This flag is a companion to <b>-bbsb=n</b> for controlling the indentation of an opening square bracket which is placed on a new line by that parameter. The indentation is as follows:</p>
 
-<pre><code>  -isb=0 one continuation level [default]
-  -isb=1 outdent by one continuation level
-  -isb=2 indent one full indentation level</code></pre>
+<pre><code>  -bbsbi=0 one continuation level [default]
+  -bbsbi=1 outdent by one continuation level
+  -bbsbi=2 indent one full indentation level</code></pre>
 
 </dd>
 <dt id="bbp-n---break-before-paren-n"><b>-bbp=n</b>, <b>--break-before-paren=n</b></dt>
 <dd>
 
-<p>This flag is similar to <b>-bbhb=n</b>, described above, except it applies to parens.</p>
+<p>This flag is similar to <b>-bbhb=n</b>, described above, except it applies to lists contained within parens.</p>
 
 <pre><code>  -bbp=0 never break [default]
   -bbp=1 stable: break if the input script had a break
   -bbp=3 always break</code></pre>
 
 </dd>
-<dt id="ip-n---indent-paren-n"><b>-ip=n</b>, <b>--indent-paren=n</b></dt>
+<dt id="bbpi-n---break-before-paren-and-indent-n"><b>-bbpi=n</b>, <b>--break-before-paren-and-indent=n</b></dt>
 <dd>
 
 <p>This flag is a companion to <b>-bbp=n</b> for controlling the indentation of an opening paren which is placed on a new line by that parameter. The indentation is as follows:</p>
 
-<pre><code>  -ip=0 one continuation level [default]
-  -ip=1 outdent by one continuation level
-  -ip=2 indent one full indentation level</code></pre>
+<pre><code>  -bbpi=0 one continuation level [default]
+  -bbpi=1 outdent by one continuation level
+  -bbpi=2 indent one full indentation level</code></pre>
 
 </dd>
 <dt id="wn---weld-nested-containers"><b>-wn</b>, <b>--weld-nested-containers</b></dt>
index 24896094c62261a5e137fd639c89d1719d224997..560da15c0ade494babf5a7e4eba665873d01e184 100644 (file)
@@ -2284,11 +2284,11 @@ sub generate_options {
     $add_option->( 'one-line-block-semicolons',               'olbs',  '=i' );
     $add_option->( 'one-line-block-nesting',                  'olbn',  '=i' );
     $add_option->( 'break-before-hash-brace',                 'bbhb',  '=i' );
+    $add_option->( 'break-before-hash-brace-and-indent',      'bbhbi', '=i' );
     $add_option->( 'break-before-square-bracket',             'bbsb',  '=i' );
+    $add_option->( 'break-before-square-bracket-and-indent',  'bbsbi', '=i' );
     $add_option->( 'break-before-paren',                      'bbp',   '=i' );
-    $add_option->( 'indent-hash-brace',                       'ihb',   '=i' );
-    $add_option->( 'indent-square-bracket',                   'isb',   '=i' );
-    $add_option->( 'indent-paren',                            'ip',    '=i' );
+    $add_option->( 'break-before-paren-and-indent',           'bbpi',  '=i' );
 
     ########################################
     $category = 6;    # Controlling list formatting
@@ -2476,11 +2476,11 @@ sub generate_options {
       break-at-old-attribute-breakpoints
       break-at-old-keyword-breakpoints
       break-before-hash-brace=0
+      break-before-hash-brace-and-indent=0
       break-before-square-bracket=0
+      break-before-square-bracket-and-indent=0
       break-before-paren=0
-      indent-hash-brace=0
-      indent-square-bracket=0
-      indent-paren=0
+      break-before-paren-and-indent=0
       comma-arrow-breakpoints=5
       nocheck-syntax
       character-encoding=guess
index f7789610c70a6ad51d1004cbeaca6b046fe59c9f..cc1399053f8368122986364c6c9a80c4bc79761d 100644 (file)
@@ -404,6 +404,7 @@ BEGIN {
     @is_closing_token{@q} = (1) x scalar(@q);
 
     @q = qw( = => );
+    push @q, ',';   # include ordinary comma too
     @is_equal_or_fat_comma{@q} = (1) x scalar(@q);
 
 }
@@ -4772,10 +4773,11 @@ sub whitespace_cycle_adjustment {
 sub adjust_container_indentation {
 
     # adjust continuation indentation for certain tokens if requested
+    # by these flags:
 
-    # -ihb=n , --indent-for-hash-brace=n
-    # -isb=n , --indent-for-square-bracket=n
-    # -ip=n , --indent-for-paren=n
+    # -bbhbi=n
+    # -bbsbi=n
+    # -bbpi=n
 
     # n=0  default indentation (usually one ci)
     # n=1  outdent one ci
@@ -6284,19 +6286,19 @@ EOM
     }
 
     %container_indentation_options = ();
-    for ( $rOpts->{'indent-hash-brace'} ) {
+    for ( $rOpts->{'break-before-hash-brace-and-indent'} ) {
         my $tok = '{';
         if ( defined($_) && $_ > 0 && $break_before_container_types{$tok} ) {
             $container_indentation_options{$tok} = $_;
         }
     }
-    for ( $rOpts->{'indent-square-bracket'} ) {
+    for ( $rOpts->{'break-before-square-bracket-and-indent'} ) {
         my $tok = '[';
         if ( defined($_) && $_ > 0 && $break_before_container_types{$tok} ) {
             $container_indentation_options{$tok} = $_;
         }
     }
-    for ( $rOpts->{'indent-paren'} ) {
+    for ( $rOpts->{'break-before-paren-and-indent'} ) {
         my $tok = '(';
         if ( defined($_) && $_ > 0 && $break_before_container_types{$tok} ) {
             $container_indentation_options{$tok} = $_;
@@ -18018,7 +18020,7 @@ sub insert_breaks_before_list_opening_containers {
         my $seqno = $rLL->[$Kend]->[_TYPE_SEQUENCE_];
         next unless ( defined($seqno) );
 
-       # Only for types of container tokens with a non-default break option
+        # Only for types of container tokens with a non-default break option
         my $token_end    = $rLL->[$Kend]->[_TOKEN_];
         my $break_option = $break_before_container_types{$token_end};
         next unless ($break_option);
index 6fd2493d3262cc9bc4263fe324e0876ec41c5ee8..c4d74afdecbddc7eab9c2407d8c36d24459649a0 100644 (file)
@@ -1 +1 @@
--bbhb=3 -bbp=3 -ihb=2 -ip=2
+-bbhb=3 -bbp=3 -bbhbi=2 -bbpi=2
index 881982613dd9f18675c89d14eb007f4cb999ba96..9ada77dc109af1cb8e38b3eddc2ae205e0ba303d 100644 (file)
@@ -1 +1 @@
--bbhb=3 -bbp=3 -ihb=1 -ip=1
+-bbhb=3 -bbp=3 -bbhbi=1 -bbpi=1
index 104fe8465aa0ccf79e86caccdb8bf180b56b3f38..942240fb6a4c22d6f078c15a4e8282747ababee6 100644 (file)
@@ -26,8 +26,8 @@ BEGIN {
     $rparams = {
         'bbhb2'     => "-bbhb=2 -bbp=2",
         'bbhb3'     => "-bbhb=3 -bbp=3",
-        'bbhb4'     => "-bbhb=3 -bbp=3 -ihb=2 -ip=2",
-        'bbhb5'     => "-bbhb=3 -bbp=3 -ihb=1 -ip=1",
+        'bbhb4'     => "-bbhb=3 -bbp=3 -bbhbi=2 -bbpi=2",
+        'bbhb5'     => "-bbhb=3 -bbp=3 -bbhbi=1 -bbpi=1",
         'def'       => "",
         'here_long' => "-l=33",
     };