From: Steve Hancock Date: Tue, 10 Sep 2024 14:08:37 +0000 (-0700) Subject: bump version to 20240903.01 X-Git-Tag: 20240903.01^0 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b817fb95176a964f34feea2dd2d1b9df1de74e5f;p=perltidy.git bump version to 20240903.01 --- diff --git a/CHANGES.md b/CHANGES.md index cd427c22..331fa474 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Perltidy Change Log -## 2024 09 03 xx +## 2024 09 03.01 - Added parameter --qw-as-function, or -qwaf, discussed in git #164. When this parameter is set, a qw list which begins with 'qw(' is diff --git a/bin/perltidy b/bin/perltidy index c288b6e6..ab1ed241 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -3802,8 +3802,6 @@ Here is an example. "09" => 30, "10" => 31, "11" => 30, "12" => 31 ); -=back - =item B<-qwaf>, B<--qw-as-function> This option tells perltidy to format a B list which is delimited with @@ -3845,12 +3843,20 @@ before the paren. If the option B<--space-function-paren> is employed, it is ignored for these special function calls because it would deactivate them. +=item * +Otherwise the various formatting control flags operate on these lists the same +as for other comma-separated lists. In particular, note that if +B<--break-at-old-comma-breakpoints>, or B<-boc>, is set, then the old line +break locations will be retained. + =item * Before using this option for the first time, it is a good idea to scan the code and decide if any lists have a special order which should be retained. This -can be accomplished for example by changing the quote delimiter characters to -something other than parens, or by inserting a blank line as discussed -at the start of this section. +can be accomplished for example by changing the quote delimiters to something +other than parens, or by inserting a blank line as discussed at the start of +this section. + +=back =back @@ -7005,7 +7011,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20240903 +This man page documents perltidy version 20240903.01 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index b82d9131..87ffcf9c 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,5 +1,25 @@

Perltidy Change Log

+

2024 09 03.01

+ +
- Added parameter --qw-as-function, or -qwaf, discussed in git #164.
+When this parameter is set, a qw list which begins with 'qw(' is
+formatted as if it were a function call with call args being a list
+of comma-separated quoted items. For example, given this input:
+
+@fields = qw( $st_dev      $st_ino    $st_mode $st_nlink   $st_uid
+  $st_gid $st_rdev    $st_size $st_atime   $st_mtime  $st_ctime
+  $st_blksize $st_blocks);
+
+# perltidy -qwaf
+@fields = qw(
+    $st_dev   $st_ino   $st_mode  $st_nlink
+    $st_uid   $st_gid   $st_rdev  $st_size
+    $st_atime $st_mtime $st_ctime $st_blksize
+    $st_blocks
+);
+
+

2024 09 03

- Add partial support for Syntax::Operator::In and Syntax::Keyword::Match
diff --git a/docs/Tidy.html b/docs/Tidy.html
index f2e4b572..5da3a956 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20240903

+

This man page documents Perl::Tidy version 20240903.01

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index 59587263..149ef4f1 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -1177,7 +1177,7 @@

If formatted in this way, the program will not run (at least with recent versions of perl) because the $x is taken to be a filehandle and / is assumed to start a quote. In a complex program, there might happen to be a / which terminates the multiline quote without a syntax error, allowing the program to run, but not as intended.

-

Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators. So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged. Likewise, whitespace around barewords is left unchanged. The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously.

+

Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators. So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged. Likewise, whitespace around unknown barewords is left unchanged. The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously.

In perltidy this is implemented in the tokenizer by marking token following a print keyword as a special type Z. When formatting is being done, whitespace following this token type is generally left unchanged as a precaution against changing program behavior. This is excessively conservative but simple and easy to implement. Keywords which are treated similarly to print include printf, sort, exec, system. Changes in spacing around parameters following these keywords may have to be made manually. For example, the space, or lack of space, after the parameter $foo in the following line will be unchanged in formatting.

@@ -3013,6 +3013,47 @@ "09" => 30, "10" => 31, "11" => 30, "12" => 31 );
+ +
-qwaf, --qw-as-function
+
+ +

This option tells perltidy to format a qw list which is delimited with parentheses as if it were a function call whose call args are a list of quoted items. Normally, a qw list is output verbatim except for an adjustment of leading whitespace to indicate the indentation level. For example, here is an example of the default formatting of a poorly formatted qw list:

+ +
    # perltidy
+    @fields = qw( $st_dev          $st_ino    $st_mode $st_nlink   $st_uid
+      $st_gid $st_rdev    $st_size $st_atime   $st_mtime  $st_ctime
+      $st_blksize $st_blocks);
+ +

If we format with -qwaf then the result will be:

+ +
    # perltidy -qwaf
+    @fields = qw(
+        $st_dev   $st_ino   $st_mode  $st_nlink
+        $st_uid   $st_gid   $st_rdev  $st_size
+        $st_atime $st_mtime $st_ctime $st_blksize
+        $st_blocks
+    );
+ +

The way this works is that just before formatting begins, the tokens of the qw text are replaced with the tokens of an equivalent function call with a comma-separated list of quoted items as call args. Then it is formatted like any other list. Special comma tokens are employed which have no display text, so when the code is eventually displayed it remains a valid qw quote.

+ +

Some things to note are:

+ +
    + +
  • This only works for qw quotes which begin with qw(, with no space before the paren.

    + +
  • +
  • If the option --space-function-paren is employed, it is ignored for these special function calls because it would deactivate them.

    + +
  • +
  • Otherwise the various formatting control flags operate on these lists the same as for other comma-separated lists. In particular, note that if --break-at-old-comma-breakpoints, or -boc, is set, then the old line break locations will be retained.

    + +
  • +
  • Before using this option for the first time, it is a good idea to scan the code and decide if any lists have a special order which should be retained. This can be accomplished for example by changing the quote delimiters to something other than parens, or by inserting a blank line as discussed at the start of this section.

    + +
  • +
+
@@ -5423,7 +5464,7 @@

VERSION

-

This man page documents perltidy version 20240903

+

This man page documents perltidy version 20240903.01

BUG REPORTS

diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index 1412f282..624ab397 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -135,7 +135,7 @@ BEGIN { # then the Release version must be bumped, and it is probably past time for # a release anyway. - $VERSION = '20240903'; + $VERSION = '20240903.01'; } ## end BEGIN sub DESTROY { diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 2a8de7b8..85fe35c6 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -469,7 +469,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t =head1 VERSION -This man page documents Perl::Tidy version 20240903 +This man page documents Perl::Tidy version 20240903.01 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 18dc0d2f..d0436d37 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index 5b125297..d6a6ffee 100644 --- a/lib/Perl/Tidy/Diagnostics.pm +++ b/lib/Perl/Tidy/Diagnostics.pm @@ -18,7 +18,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index 499608cb..5cddbfca 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -16,7 +16,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index f7b56462..b54db333 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -76,7 +76,7 @@ use constant BACKSLASH => q{\\}; use Carp; use English qw( -no_match_vars ); use List::Util qw( min max first ); # min, max first are in Perl 5.8 -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index 0b1b5726..8ce6682b 100644 --- a/lib/Perl/Tidy/HtmlWriter.pm +++ b/lib/Perl/Tidy/HtmlWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::HtmlWriter; use strict; use warnings; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index d3aefd47..172a88e6 100644 --- a/lib/Perl/Tidy/IOScalar.pm +++ b/lib/Perl/Tidy/IOScalar.pm @@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar; use strict; use warnings; use Carp; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/IOScalarArray.pm b/lib/Perl/Tidy/IOScalarArray.pm index 89a4ec3b..f92a69d7 100644 --- a/lib/Perl/Tidy/IOScalarArray.pm +++ b/lib/Perl/Tidy/IOScalarArray.pm @@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray; use strict; use warnings; use Carp; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index 0a9a6531..2a71a65a 100644 --- a/lib/Perl/Tidy/IndentationItem.pm +++ b/lib/Perl/Tidy/IndentationItem.pm @@ -9,7 +9,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index 0db8e8d6..fed6aaa1 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 24a8fb5d..f1e738df 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -33,7 +33,7 @@ use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 93febef0..b22ba5e7 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -5,7 +5,7 @@ use Carp; { #<<< A non-indenting brace to contain all lexical variables -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use English qw( -no_match_vars ); use Scalar::Util 'refaddr'; # perl 5.8.1 and later use Perl::Tidy::VerticalAligner::Alignment; diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 92a4528d..0a99b053 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -9,7 +9,7 @@ package Perl::Tidy::VerticalAligner::Alignment; use strict; use warnings; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; sub new { my ( $class, $rarg ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index 6923520b..f03ad657 100644 --- a/lib/Perl/Tidy/VerticalAligner/Line.pm +++ b/lib/Perl/Tidy/VerticalAligner/Line.pm @@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; -our $VERSION = '20240903'; +our $VERSION = '20240903.01'; use English qw( -no_match_vars ); sub AUTOLOAD {