Hello community, here is the log from the commit of package perl-Perl-Tidy for openSUSE:Factory checked in at 2020-12-11 20:16:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Perl-Tidy (Old) and /work/SRC/openSUSE:Factory/.perl-Perl-Tidy.new.2328 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Perl-Tidy" Fri Dec 11 20:16:45 2020 rev:32 rq:854825 version:20201207 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Perl-Tidy/perl-Perl-Tidy.changes 2020-12-03 18:44:05.330265486 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Perl-Tidy.new.2328/perl-Perl-Tidy.changes 2020-12-11 20:16:45.836660839 +0100 @@ -1,0 +2,6 @@ +Mon Dec 7 03:08:36 UTC 2020 - Tina Müller <timueller+p...@suse.de> + +- updated to 20201207 + see /usr/share/doc/packages/perl-Perl-Tidy/CHANGES.md + +------------------------------------------------------------------- Old: ---- Perl-Tidy-20201202.tar.gz New: ---- Perl-Tidy-20201207.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Perl-Tidy.spec ++++++ --- /var/tmp/diff_new_pack.m8mQld/_old 2020-12-11 20:16:46.624661166 +0100 +++ /var/tmp/diff_new_pack.m8mQld/_new 2020-12-11 20:16:46.628661168 +0100 @@ -17,7 +17,7 @@ Name: perl-Perl-Tidy -Version: 20201202 +Version: 20201207 Release: 0 #Upstream: GPL-1.0-or-later %define cpan_name Perl-Tidy ++++++ Perl-Tidy-20201202.tar.gz -> Perl-Tidy-20201207.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/CHANGES.md new/Perl-Tidy-20201207/CHANGES.md --- old/Perl-Tidy-20201202/CHANGES.md 2020-12-02 16:47:35.000000000 +0100 +++ new/Perl-Tidy-20201207/CHANGES.md 2020-12-06 17:29:58.000000000 +0100 @@ -1,6 +1,25 @@ # Perltidy Change Log -## 2020 12 02 +## 2020 12 07 + + - Fixed issue git #47, incorrect welding of anonymous subs. + An incorrect weld format was being made when the --weld-nested-containers option + (-wn) was used in to format a function which returns a list of anonymous subs. + For example, the following snippet was incorrectly being welded. + + $promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } + ); + + This was due to an error introduced in v20201201 related to parsing sub + signatures. Reformatting with the current version will fix the problem. + +## 2020 12 01 - This release is being made primarily to make available a several new formatting parameters, in particular -xci, -kbb=s, -kba=s, and -wnxl=s. No significant diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/META.json new/Perl-Tidy-20201207/META.json --- old/Perl-Tidy-20201202/META.json 2020-12-02 19:53:43.000000000 +0100 +++ new/Perl-Tidy-20201207/META.json 2020-12-06 17:30:47.000000000 +0100 @@ -39,6 +39,6 @@ "web" : "https://github.com/perltidy/perltidy" } }, - "version" : "20201202", + "version" : "20201207", "x_serialization_backend" : "JSON::PP version 4.04" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/META.yml new/Perl-Tidy-20201207/META.yml --- old/Perl-Tidy-20201202/META.yml 2020-12-02 19:53:43.000000000 +0100 +++ new/Perl-Tidy-20201207/META.yml 2020-12-06 17:30:47.000000000 +0100 @@ -19,5 +19,5 @@ - inc resources: repository: https://github.com/perltidy/perltidy.git -version: '20201202' +version: '20201207' x_serialization_backend: 'CPAN::Meta::YAML version 0.012' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/bin/perltidy new/Perl-Tidy-20201207/bin/perltidy --- old/Perl-Tidy-20201202/bin/perltidy 2020-12-02 16:47:35.000000000 +0100 +++ new/Perl-Tidy-20201207/bin/perltidy 2020-12-06 17:20:14.000000000 +0100 @@ -4560,7 +4560,7 @@ =head1 VERSION -This man page documents perltidy version 20201202 +This man page documents perltidy version 20201207 =head1 BUG REPORTS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/docs/BugLog.html new/Perl-Tidy-20201207/docs/BugLog.html --- old/Perl-Tidy-20201202/docs/BugLog.html 2020-12-02 16:48:06.000000000 +0100 +++ new/Perl-Tidy-20201207/docs/BugLog.html 2020-12-06 17:30:42.000000000 +0100 @@ -12,11 +12,44 @@ <ul id="index"> + <li><a href="#Issues-fixed-after-release-20201202">Issues fixed after release 20201202</a></li> <li><a href="#Issues-fixed-after-release-20201001">Issues fixed after release 20201001</a></li> <li><a href="#Issues-fixed-after-release-20200907">Issues fixed after release 20200907</a></li> <li><a href="#Open-Issues">Open Issues</a></li> </ul> +<h1 id="Issues-fixed-after-release-20201202">Issues fixed after release 20201202</h1> + +<dl> + +<dt id="Fix-for-issue-git-47"><b>Fix for issue git #47</b></dt> +<dd> + +<p>This issue has to do with the --weld-nested-containers option in the specific case of formatting a function which returns a list of anonymous subs. For example</p> + +<pre><code> $promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } + );</code></pre> + +<p>A bug introduced in v20201202 caused an incorrect welding to occur when the -wn flag was set</p> + +<pre><code> $promises[$i]->then( sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } );</code></pre> + +<p>This bug has been fixed, and code which has been incorrectly formatted will be correctly formatted with the next release. The bug was a result of a new coding introduced in v20201202 for fixing some issues with parsing sub signatures. Previously they were sometimes parsed the same as prototypes and sometimes as lists, now they are always parsed as lists.</p> + +</dd> +</dl> + <h1 id="Issues-fixed-after-release-20201001">Issues fixed after release 20201001</h1> <dl> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/docs/ChangeLog.html new/Perl-Tidy-20201207/docs/ChangeLog.html --- old/Perl-Tidy-20201202/docs/ChangeLog.html 2020-12-02 16:48:06.000000000 +0100 +++ new/Perl-Tidy-20201207/docs/ChangeLog.html 2020-12-06 17:30:42.000000000 +0100 @@ -1,6 +1,26 @@ <h1>Perltidy Change Log</h1> -<h2>2020 12 02</h2> +<h2>2020 12 07</h2> + +<pre><code>- Fixed issue git #47, incorrect welding of anonymous subs. + An incorrect weld format was being made when the --weld-nested-containers option + (-wn) was used in to format a function which returns a list of anonymous subs. + For example, the following snippet was incorrectly being welded. + +$promises[$i]->then( + sub { $all->resolve(@_); () }, + sub { + $results->[$i] = [@_]; + $all->reject(@$results) if --$remaining <= 0; + return (); + } +); + +This was due to an error introduced in v20201201 related to parsing sub +signatures. Reformatting with the current version will fix the problem. +</code></pre> + +<h2>2020 12 01</h2> <pre><code>- This release is being made primarily to make available a several new formatting parameters, in particular -xci, -kbb=s, -kba=s, and -wnxl=s. No significant diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/docs/Tidy.html new/Perl-Tidy-20201207/docs/Tidy.html --- old/Perl-Tidy-20201202/docs/Tidy.html 2020-12-02 16:48:07.000000000 +0100 +++ new/Perl-Tidy-20201207/docs/Tidy.html 2020-12-06 17:30:43.000000000 +0100 @@ -372,7 +372,7 @@ <h1 id="VERSION">VERSION</h1> -<p>This man page documents Perl::Tidy version 20201202</p> +<p>This man page documents Perl::Tidy version 20201207</p> <h1 id="LICENSE">LICENSE</h1> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/docs/perltidy.html new/Perl-Tidy-20201207/docs/perltidy.html --- old/Perl-Tidy-20201202/docs/perltidy.html 2020-12-02 16:48:07.000000000 +0100 +++ new/Perl-Tidy-20201207/docs/perltidy.html 2020-12-06 17:30:42.000000000 +0100 @@ -3522,7 +3522,7 @@ <h1 id="VERSION">VERSION</h1> -<p>This man page documents perltidy version 20201202</p> +<p>This man page documents perltidy version 20201207</p> <h1 id="BUG-REPORTS">BUG REPORTS</h1> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/Debugger.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/Debugger.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/Debugger.pm 2020-12-02 16:47:36.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/Debugger.pm 2020-12-06 17:20:16.000000000 +0100 @@ -7,7 +7,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub new { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/DevNull.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/DevNull.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/DevNull.pm 2020-12-02 16:47:37.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/DevNull.pm 2020-12-06 17:20:17.000000000 +0100 @@ -7,7 +7,7 @@ package Perl::Tidy::DevNull; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub new { my $self = shift; return bless {}, $self } sub print { return } sub close { return } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/Diagnostics.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/Diagnostics.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/Diagnostics.pm 2020-12-02 16:47:38.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/Diagnostics.pm 2020-12-06 17:20:18.000000000 +0100 @@ -20,7 +20,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub AUTOLOAD { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/FileWriter.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/FileWriter.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/FileWriter.pm 2020-12-02 16:47:38.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/FileWriter.pm 2020-12-06 17:20:18.000000000 +0100 @@ -7,7 +7,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; use constant DEVEL_MODE => 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/Formatter.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/Formatter.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/Formatter.pm 2020-12-02 16:47:39.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/Formatter.pm 2020-12-06 17:20:19.000000000 +0100 @@ -49,7 +49,7 @@ { #<<< A non-indenting brace to contain all lexical variables use Carp; -our $VERSION = '20201202'; +our $VERSION = '20201207'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() @@ -6330,11 +6330,68 @@ my $token_outer_closing = $rLL->[$K_outer_closing]->[_TOKEN_]; next unless ( $is_closing_token{$token_outer_closing} ); - # Yes .. this is a possible nesting pair. Now we have to check the - # opening tokens. The can be separated by a small amount. + # Now we have to check the opening tokens. my $K_outer_opening = $K_opening_container->{$outer_seqno}; my $K_inner_opening = $K_opening_container->{$inner_seqno}; next unless defined($K_outer_opening) && defined($K_inner_opening); + + # Verify that the inner opening token is the next container after the + # outer opening token. + my $K_io_check = $rLL->[$K_outer_opening]->[_KNEXT_SEQ_ITEM_]; + next unless defined($K_io_check); + if ( $K_io_check != $K_inner_opening ) { + + # The inner opening container does not immediately follow the outer + # opening container, but we may still allow a weld if they are + # separated by a sub signature. For example, we may have something + # like this, where $K_io_check may be at the first 'x' instead of + # 'io'. So we need to hop over the signature and see if we arrive + # at 'io'. + + # oo io + # | x x | + # $obj->then( sub ( $code ) { + # ... + # return $c->render(text => '', status => $code); + # } ); + # | | + # ic oc + + next if $rLL->[$K_inner_opening]->[_BLOCK_TYPE_] ne 'sub'; + next if $rLL->[$K_io_check]->[_TOKEN_] ne '('; + my $seqno_signature = $rLL->[$K_io_check]->[_TYPE_SEQUENCE_]; + next unless defined($seqno_signature); + my $K_signature_closing = $K_closing_container->{$seqno_signature}; + next unless defined($K_signature_closing); + my $K_test = $rLL->[$K_signature_closing]->[_KNEXT_SEQ_ITEM_]; + next + unless ( defined($K_test) && $K_test == $K_inner_opening ); + + # OK, we have arrived at 'io' in the above diagram. We should put + # a limit on the length or complexity of the signature here. There + # is no perfect way to do this, one way is to put a limit on token + # count. For consistency with older versions, we should allow a + # signature with a single variable to weld, but not with + # multiple variables. A single variable as in 'sub ($code) {' can + # have a $Kdiff of 2 to 4, depending on spacing. + + # But two variables like 'sub ($v1,$v2) {' can have a diff of 4 to + # 7, depending on spacing. So to keep formatting consistent with + # previous versions, we will also avoid welding if there is a comma + # in the signature. + + my $Kdiff = $K_signature_closing - $K_io_check; + next if ( $Kdiff > 4 ); + + my $saw_comma; + foreach my $KK ( $K_io_check + 1 .. $K_signature_closing - 1 ) { + if ( $rLL->[$KK]->[_TYPE_] eq ',' ) { $saw_comma = 1; last } + } + next if ($saw_comma); + } + + # Yes .. this is a possible nesting pair. + # They can be separated by a small amount. my $K_diff = $K_inner_opening - $K_outer_opening; # Count nonblank characters separating them. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/HtmlWriter.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/HtmlWriter.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/HtmlWriter.pm 2020-12-02 16:47:39.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/HtmlWriter.pm 2020-12-06 17:20:19.000000000 +0100 @@ -7,7 +7,7 @@ package Perl::Tidy::HtmlWriter; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; use File::Basename; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/IOScalar.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/IOScalar.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/IOScalar.pm 2020-12-02 16:47:40.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/IOScalar.pm 2020-12-06 17:20:20.000000000 +0100 @@ -10,7 +10,7 @@ use strict; use warnings; use Carp; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub AUTOLOAD { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/IOScalarArray.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/IOScalarArray.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/IOScalarArray.pm 2020-12-02 16:47:40.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/IOScalarArray.pm 2020-12-06 17:20:20.000000000 +0100 @@ -14,7 +14,7 @@ use strict; use warnings; use Carp; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub AUTOLOAD { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/IndentationItem.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/IndentationItem.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/IndentationItem.pm 2020-12-02 16:47:41.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/IndentationItem.pm 2020-12-06 17:20:21.000000000 +0100 @@ -8,7 +8,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; BEGIN { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/LineBuffer.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/LineBuffer.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/LineBuffer.pm 2020-12-02 16:47:41.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/LineBuffer.pm 2020-12-06 17:20:21.000000000 +0100 @@ -12,7 +12,7 @@ package Perl::Tidy::LineBuffer; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub AUTOLOAD { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/LineSink.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/LineSink.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/LineSink.pm 2020-12-02 16:47:42.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/LineSink.pm 2020-12-06 17:20:21.000000000 +0100 @@ -8,7 +8,7 @@ package Perl::Tidy::LineSink; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub AUTOLOAD { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/LineSource.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/LineSource.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/LineSource.pm 2020-12-02 16:47:42.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/LineSource.pm 2020-12-06 17:20:22.000000000 +0100 @@ -8,7 +8,7 @@ package Perl::Tidy::LineSource; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub AUTOLOAD { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/Logger.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/Logger.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/Logger.pm 2020-12-02 16:47:43.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/Logger.pm 2020-12-06 17:20:22.000000000 +0100 @@ -7,7 +7,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; sub AUTOLOAD { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/Tokenizer.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/Tokenizer.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/Tokenizer.pm 2020-12-02 16:47:43.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/Tokenizer.pm 2020-12-06 17:20:23.000000000 +0100 @@ -21,7 +21,7 @@ package Perl::Tidy::Tokenizer; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; use Perl::Tidy::LineBuffer; use Carp; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/VerticalAligner/Alignment.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/VerticalAligner/Alignment.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/VerticalAligner/Alignment.pm 2020-12-02 16:47:44.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/VerticalAligner/Alignment.pm 2020-12-06 17:20:24.000000000 +0100 @@ -10,7 +10,7 @@ { #<<< A non-indenting brace -our $VERSION = '20201202'; +our $VERSION = '20201207'; # _column_ # the current column number # _saved_column_ # a place for temporary storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/VerticalAligner/Line.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/VerticalAligner/Line.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/VerticalAligner/Line.pm 2020-12-02 16:47:45.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/VerticalAligner/Line.pm 2020-12-06 17:20:24.000000000 +0100 @@ -8,7 +8,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; BEGIN { my $i = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy/VerticalAligner.pm new/Perl-Tidy-20201207/lib/Perl/Tidy/VerticalAligner.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy/VerticalAligner.pm 2020-12-02 16:47:44.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy/VerticalAligner.pm 2020-12-06 17:20:23.000000000 +0100 @@ -1,7 +1,7 @@ package Perl::Tidy::VerticalAligner; use strict; use warnings; -our $VERSION = '20201202'; +our $VERSION = '20201207'; use Perl::Tidy::VerticalAligner::Alignment; use Perl::Tidy::VerticalAligner::Line; @@ -2593,7 +2593,12 @@ } } - # Loop to process each subgroup + # flag to allow skipping pass 2 + my $saw_large_group; + + ############################################################ + # PASS 1 over subgroups to remove unmatched alignment tokens + ############################################################ foreach my $item (@subgroups) { my ( $jbeg, $jend ) = @{$item}; @@ -2668,6 +2673,7 @@ my $deleted_assignment_token; my $saw_dividing_token = ""; + $saw_large_group ||= $nlines > 2 && $imax > 1; # Loop over all alignment tokens for ( my $i = 0 ; $i <= $imax ; $i++ ) { @@ -2807,10 +2813,204 @@ } } # End loopover lines } # End loop over subgroups + + ################################################# + # PASS 2 over subgroups to remove null alignments + ################################################# + + # This works but is currently deactivated pending more testing + if (0) { #<<< + delete_null_alignments( $rnew_lines, $rline_hashes, \@subgroups, + $saw_list_type ) + if ($saw_large_group); + } + return ( $max_lev_diff, $saw_side_comment ); } } +sub delete_null_alignments { + my ( $rnew_lines, $rline_hashes, $rsubgroups, $saw_list_type ) = @_; + + # This is an optional second pass for deleting alignment tokens which can + # occasionally improve alignment. We look for and remove 'null + # alignments', which are alignments that require no padding. So we can + # 'cheat' and delete them. For example, notice the '=~' alignment in the + # first two lines of the following code: + + # $sysname .= 'del' if $self->label =~ /deletion/; + # $sysname .= 'ins' if $self->label =~ /insertion/; + # $sysname .= uc $self->allele_ori->seq if $self->allele_ori->seq; + + # These '=~' tokens are already aligned because they are both the same + # distance from the previous alignment token, the 'if'. So we can + # eliminate them as alignments. The advantage is that in some cases, such + # as this one, this will allow other tokens to be aligned. In this case we + # then get the 'if' tokens to align: + + # $sysname .= 'del' if $self->label =~ /deletion/; + # $sysname .= 'ins' if $self->label =~ /insertion/; + # $sysname .= uc $self->allele_ori->seq if $self->allele_ori->seq; + + # The following rules for limiting this operation have been found to + # work well and avoid problems: + + # Rule 1. We only consider a sequence of lines which have the same + # sequence of alignment tokens. + + # Rule 2. We never eliminate the first alignment token. One reason is that + # lines may have different leading indentation spaces, so keeping the + # first alignment token insures that our length measurements start at + # a well-defined point. Another reason is that nothing is gained because + # the left-to-right sweep can always handle alignment of this token. + + # Rule 3. We require that the first alignment token exist in either + # a previous line or a subsequent line. The reason is that this avoids + # changing two-line matches which go through special logic. + + # Rule 4. Do not delete a token which occurs in a previous or subsequent + # line. For example, in the above example, it was ok to eliminate the '=~' + # token from two lines because it did not occur in a surrounding line. + # If it did occur in a surrounding line, the result could be confusing + # or even incorrectly aligned. + + # A consequence of these rules is that we only need to consider subgroups + # with at least 3 lines and 2 alignment tokens. + + # The subgroup line index range + my ( $jbeg, $jend ); + + # Vars to keep track of the start of a current sequence of matching + # lines. + my $rtokens_match; + my $rfield_lengths_match; + my $j_match_beg; + my $j_match_end; + my $imax_match; + my $rneed_pad; + + # Vars for a line being tested + my $rtokens; + my $rfield_lengths; + my $imax; + + my $start_match = sub { + my ($jj) = @_; + $rtokens_match = $rtokens; + $rfield_lengths_match = $rfield_lengths; + $j_match_beg = $jj; + $j_match_end = $jj; + $imax_match = $imax; + $rneed_pad = []; + return; + }; + + my $add_to_match = sub { + my ($jj) = @_; + $j_match_end = $jj; + + # Keep track of any padding that would be needed for each token + for ( my $i = 0 ; $i <= $imax ; $i++ ) { + next if ( $rneed_pad->[$i] ); + my $length = $rfield_lengths->[$i]; + my $length_match = $rfield_lengths_match->[$i]; + if ( $length ne $length_match ) { $rneed_pad->[$i] = 1 } + } + }; + + my $end_match = sub { + return unless ( $j_match_end > $j_match_beg ); + my $nlines = $j_match_end - $j_match_beg + 1; + my $rhash_beg = $rline_hashes->[$j_match_beg]; + my $rhash_end = $rline_hashes->[$j_match_end]; + my @idel; + + # Do not delete unless the first token also occurs in a surrounding line + my $tok0 = $rtokens_match->[0]; + return + unless ( + ( + $j_match_beg > $jbeg + && $rnew_lines->[ $j_match_beg - 1 ]->get_rtokens()->[0] eq + $tok0 + ) + || ( $j_match_end < $jend + && $rnew_lines->[ $j_match_end + 1 ]->get_rtokens()->[0] eq + $tok0 ) + ); + + # Note that we are skipping the token at i=0 + for ( my $i = 1 ; $i <= $imax_match ; $i++ ) { + + # do not delete a token which requires padding to align + next if ( $rneed_pad->[$i] ); + + my $tok = $rtokens_match->[$i]; + + # Do not delete a token which occurs in a surrounding line + next + if ( $j_match_beg > $jbeg + && defined( $rline_hashes->[ $j_match_beg - 1 ]->{$tok} ) ); + next + if ( $j_match_end < $jend + && defined( $rline_hashes->[ $j_match_end + 1 ]->{$tok} ) ); + + # ok to delete + push @idel, $i; + ##print "ok to delete tok=$tok\n"; + } + if (@idel) { + foreach my $j ( $j_match_beg .. $j_match_end ) { + delete_selected_tokens( $rnew_lines->[$j], \@idel, + $saw_list_type ); + } + } + }; + + foreach my $item ( @{$rsubgroups} ) { + ( $jbeg, $jend ) = @{$item}; + my $nlines = $jend - $jbeg + 1; + next unless ( $nlines > 2 ); + + for ( my $jj = $jbeg ; $jj <= $jend ; $jj++ ) { + my $line = $rnew_lines->[$jj]; + $rtokens = $line->get_rtokens(); + $rfield_lengths = $line->get_rfield_lengths(); + $imax = @{$rtokens} - 2; + + # start a new match group + if ( $jj == $jbeg ) { + $start_match->($jj); + next; + } + + # see if all tokens of this line match the current group + my $match; + if ( $imax == $imax_match ) { + for ( my $i = 0 ; $i <= $imax ; $i++ ) { + my $tok = $rtokens->[$i]; + my $tok_match = $rtokens_match->[$i]; + last if ( $tok ne $tok_match ); + } + $match = 1; + } + + # yes, they all match + if ($match) { + $add_to_match->($jj); + } + + # now, this line does not match + else { + $end_match->(); + $start_match->($jj); + } + } # End loopover lines + $end_match->(); + } # End loop over subgroups + return; +} ## end sub delete_null_alignments + sub fat_comma_to_comma { my ($str) = @_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy.pm new/Perl-Tidy-20201207/lib/Perl/Tidy.pm --- old/Perl-Tidy-20201202/lib/Perl/Tidy.pm 2020-12-02 16:47:31.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy.pm 2020-12-06 17:20:11.000000000 +0100 @@ -110,7 +110,7 @@ # Release version must be bumped, and it is probably past time for a # release anyway. - $VERSION = '20201202'; + $VERSION = '20201207'; } sub DESTROY { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20201202/lib/Perl/Tidy.pod new/Perl-Tidy-20201207/lib/Perl/Tidy.pod --- old/Perl-Tidy-20201202/lib/Perl/Tidy.pod 2020-12-02 16:47:33.000000000 +0100 +++ new/Perl-Tidy-20201207/lib/Perl/Tidy.pod 2020-12-06 17:20:13.000000000 +0100 @@ -432,7 +432,7 @@ =head1 VERSION -This man page documents Perl::Tidy version 20201202 +This man page documents Perl::Tidy version 20201207 =head1 LICENSE _______________________________________________ openSUSE Commits mailing list -- commit@lists.opensuse.org To unsubscribe, email commit-le...@lists.opensuse.org List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette List Archives: https://lists.opensuse.org/archives/list/commit@lists.opensuse.org