commit perl-Perl-Tidy for openSUSE:Factory

Hello community, here is the log from the commit of package perl-Perl-Tidy for openSUSE:Factory checked in at 2015-08-29 20:04:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Perl-Tidy (Old) and /work/SRC/openSUSE:Factory/.perl-Perl-Tidy.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Perl-Tidy" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Perl-Tidy/perl-Perl-Tidy.changes 2014-09-17 17:26:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Perl-Tidy.new/perl-Perl-Tidy.changes 2015-08-29 20:04:40.000000000 +0200 @@ -1,0 +2,41 @@ +Sun Aug 23 09:13:37 UTC 2015 - coolo@suse.com + +- updated to 20150815 + see /usr/share/doc/packages/perl-Perl-Tidy/CHANGES + + 2015 08 15 + - Fixed RT# 105484, Invalid warning about 'else' in 'switch' statement. The + warning happened if a 'case' statement did not use parens. + + - Fixed RT# 101547, misparse of // caused error message. Also.. + + - Fixed RT# 102371, misparse of // caused unwated space in //= + + - Fixed RT# 100871, "silent failure of HTML Output on Windows". + Changed calls to tempfile() from: + my ( $fh_tmp, $tmpfile ) = tempfile(); + to have the full path name: + my ( $fh_tmp, $tmpfile ) = File::Temp::tempfile() + because of problems in the Windows version reported by Dean Pearce. + + - Fixed RT# 99514, calling the perltidy module multiple times with + a .perltidyrc file containing the parameter --output-line-ending + caused a crash. This was a glitch in the memoization logic. + + - Fixed RT#99961, multiple lines inside a cast block caused unwanted + continuation indentation. + + - RT# 32905, broken handling of UTF-8 strings. + A new flag -utf8 causes perltidy assume UTF-8 encoding for input and + output of an io stream. Thanks to Sebastian Podjasek for a patch. + This feature may not work correctly in older versions of Perl. + It worked in a linux version 5.10.1 but not in a Windows version 5.8.3 (but + otherwise perltidy ran correctly). + + - Warning files now report perltidy VERSION. Suggested by John Karr. + + - Fixed long flag --nostack-closing-tokens (-nsct has always worked though). + This was due to a typo. This also fixed --nostack-opening-tokens to + behave correctly. Thanks to Rob Dixon. + +------------------------------------------------------------------- Old: ---- Perl-Tidy-20140711.tar.gz New: ---- Perl-Tidy-20150815.tar.gz cpanspec.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Perl-Tidy.spec ++++++ --- /var/tmp/diff_new_pack.PZelJb/_old 2015-08-29 20:04:40.000000000 +0200 +++ /var/tmp/diff_new_pack.PZelJb/_new 2015-08-29 20:04:40.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Perl-Tidy # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,16 @@ Name: perl-Perl-Tidy -Version: 20140711 +Version: 20150815 Release: 0 +#Upstream: This package is free software; you can redistribute it and/or modify it under the terms of the "GNU General Public License". Please refer to the file "COPYING" for details. %define cpan_name Perl-Tidy Summary: Parses and beautifies perl source License: GPL-2.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Perl-Tidy/ -Source: http://www.cpan.org/authors/id/S/SH/SHANCOCK/%{cpan_name}-%{version}.tar.gz +Source0: http://www.cpan.org/authors/id/S/SH/SHANCOCK/%{cpan_name}-%{version}.tar.gz +Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl @@ -64,6 +66,6 @@ %files -f %{name}.files %defattr(-,root,root,755) -%doc BUGS CHANGES COPYING examples Makefile.npm pm2pl README TODO +%doc BUGS CHANGES COPYING docs examples Makefile.npm pm2pl README TODO %changelog ++++++ Perl-Tidy-20140711.tar.gz -> Perl-Tidy-20150815.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/BUGS new/Perl-Tidy-20150815/BUGS --- old/Perl-Tidy-20140711/BUGS 2014-03-28 02:03:28.000000000 +0100 +++ new/Perl-Tidy-20150815/BUGS 2015-08-14 17:01:42.000000000 +0200 @@ -29,10 +29,6 @@ which uses double brackets to contain single brackets does not render correctly. - Perltidy does not handle UTF-8 encoded files - This has long been requested but unfortunately I don't have time, so - it won't happen unless someone wants to work on it. - Two iterations are sometimes needed Usually the code produced by perltidy on the first pass does not change if it is run again, but sometimes a second pass will produce some small diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/CHANGES new/Perl-Tidy-20150815/CHANGES --- old/Perl-Tidy-20140711/CHANGES 2014-07-11 13:16:51.000000000 +0200 +++ new/Perl-Tidy-20150815/CHANGES 2015-08-15 02:05:30.000000000 +0200 @@ -1,4 +1,39 @@ Perltidy Change Log + 2015 08 15 + - Fixed RT# 105484, Invalid warning about 'else' in 'switch' statement. The + warning happened if a 'case' statement did not use parens. + + - Fixed RT# 101547, misparse of // caused error message. Also.. + + - Fixed RT# 102371, misparse of // caused unwated space in //= + + - Fixed RT# 100871, "silent failure of HTML Output on Windows". + Changed calls to tempfile() from: + my ( $fh_tmp, $tmpfile ) = tempfile(); + to have the full path name: + my ( $fh_tmp, $tmpfile ) = File::Temp::tempfile() + because of problems in the Windows version reported by Dean Pearce. + + - Fixed RT# 99514, calling the perltidy module multiple times with + a .perltidyrc file containing the parameter --output-line-ending + caused a crash. This was a glitch in the memoization logic. + + - Fixed RT#99961, multiple lines inside a cast block caused unwanted + continuation indentation. + + - RT# 32905, broken handling of UTF-8 strings. + A new flag -utf8 causes perltidy assume UTF-8 encoding for input and + output of an io stream. Thanks to Sebastian Podjasek for a patch. + This feature may not work correctly in older versions of Perl. + It worked in a linux version 5.10.1 but not in a Windows version 5.8.3 (but + otherwise perltidy ran correctly). + + - Warning files now report perltidy VERSION. Suggested by John Karr. + + - Fixed long flag --nostack-closing-tokens (-nsct has always worked though). + This was due to a typo. This also fixed --nostack-opening-tokens to + behave correctly. Thanks to Rob Dixon. + 2014 07 11 - Fixed RT #94902: abbreviation parsing in .perltidyrc files was not working for multi-line abbreviations. Thanks to Eric Fung for diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/MANIFEST new/Perl-Tidy-20150815/MANIFEST --- old/Perl-Tidy-20140711/MANIFEST 2014-03-28 01:54:27.000000000 +0100 +++ new/Perl-Tidy-20150815/MANIFEST 2015-08-14 05:09:26.000000000 +0200 @@ -35,4 +35,6 @@ t/test.t t/testsa.t t/testss.t +t/testwide.t +t/testwide.pl.src META.yml Module meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/META.yml new/Perl-Tidy-20150815/META.yml --- old/Perl-Tidy-20140711/META.yml 2014-07-11 13:21:00.000000000 +0200 +++ new/Perl-Tidy-20150815/META.yml 2015-08-15 03:06:20.000000000 +0200 @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Perl-Tidy -version: 20140711 +version: 20150815 abstract: indent and reformat perl scripts author: - Steve Hancock <perltidy@perltidy.sourceforge.net> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/TODO new/Perl-Tidy-20150815/TODO --- old/Perl-Tidy-20140711/TODO 2014-03-28 01:59:50.000000000 +0100 +++ new/Perl-Tidy-20150815/TODO 2015-08-15 01:53:40.000000000 +0200 @@ -1,6 +1,7 @@ Perltidy TODO List - This is a partial "wish-list" of features to add and things to do. + This is a partial "wish-list" of features to add and things to do. + Automatically Detect UTF-8 Character Streams Improved Vertical Alignment There are still many opportunities for improving vertical alignment. @@ -22,7 +23,9 @@ A -r flag might be nice, but this is best handled by an exterior shell script. - Make perltidy support the syntax of some module XXX. + Make perltidy support the syntax of module XXX This generally won't be done unless the module is part of the core perl - distribution. But in some cases it might be possible to use the prefilter - and postfilter capabilities of the Tidy.pm module to help. + distribution because it is such an open-ended problem. But in some cases + it might be possible to use the prefilter and postfilter capabilities of + the Tidy.pm module may help. + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/bin/perltidy new/Perl-Tidy-20150815/bin/perltidy --- old/Perl-Tidy-20140711/bin/perltidy 2014-07-11 13:20:58.000000000 +0200 +++ new/Perl-Tidy-20150815/bin/perltidy 2015-08-15 03:06:18.000000000 +0200 @@ -525,6 +525,24 @@ prevent long comment lines from being outdented, you can add either B<-noll> or B<-l=0>. +=item B<-enc=s>, B<--character-encoding=s> + +where B<s>=B<none> or B<utf8>. This flag tells perltidy the character encoding +of both the input and output character streams. The value B<utf8> causes the +stream to be read and written as UTF-8. The value B<none> causes the stream to +be processed without special encoding assumptions. At present there is no +automatic detection of character encoding (even if there is a C<'use utf8'> +statement in your code) so this flag must be set for streams encoded in UTF-8. +Incorrectly setting this parameter can cause data corruption, so please +carefully check the output. + +The default is B<none>. + +The abbreviations B<-utf8> or B<-UTF8> are equivalent to B<-enc=utf8>. +So to process a file named B<file.pl> which is encoded in UTF-8 you can use: + + perltidy -utf8 file.pl + =item B<-ole=s>, B<--output-line-ending=s> where s=C<win>, C<dos>, C<unix>, or C<mac>. This flag tells perltidy @@ -3098,7 +3116,7 @@ =head1 VERSION -This man page documents perltidy version 20140711. +This man page documents perltidy version 20150815. =head1 CREDITS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/docs/perltidy.1 new/Perl-Tidy-20150815/docs/perltidy.1 --- old/Perl-Tidy-20140711/docs/perltidy.1 2014-07-11 13:16:50.000000000 +0200 +++ new/Perl-Tidy-20150815/docs/perltidy.1 2015-08-15 02:45:41.000000000 +0200 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "PERLTIDY 1" -.TH PERLTIDY 1 "2014-07-11" "perl v5.14.2" "User Contributed Perl Documentation" +.TH PERLTIDY 1 "2015-08-14" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -638,6 +638,25 @@ outdenting) of code and comments as it normally would. If you also want to prevent long comment lines from being outdented, you can add either \fB\-noll\fR or \&\fB\-l=0\fR. +.IP "\fB\-enc=s\fR, \fB\-\-character\-encoding=s\fR" 4 +.IX Item "-enc=s, --character-encoding=s" +where \fBs\fR=\fBnone\fR or \fButf8\fR. This flag tells perltidy the character encoding +of both the input and output character streams. The value \fButf8\fR causes the +stream to be read and written as \s-1UTF\-8\s0. The value \fBnone\fR causes the stream to +be processed without special encoding assumptions. At present there is no +automatic detection of character encoding (even if there is a \f(CW\*(Aquse utf8\*(Aq\fR +statement in your code) so this flag must be set for streams encoded in \s-1UTF\-8\s0. +Incorrectly setting this parameter can cause data corruption, so please +carefully check the output. +.Sp +The default is \fBnone\fR. +.Sp +The abbreviations \fB\-utf8\fR or \fB\-UTF8\fR are equivalent to \fB\-enc=utf8\fR. +So to process a file named \fBfile.pl\fR which is encoded in \s-1UTF\-8\s0 you can use: +.Sp +.Vb 1 +\& perltidy \-utf8 file.pl +.Ve .IP "\fB\-ole=s\fR, \fB\-\-output\-line\-ending=s\fR" 4 .IX Item "-ole=s, --output-line-ending=s" where s=\f(CW\*(C`win\*(C'\fR, \f(CW\*(C`dos\*(C'\fR, \f(CW\*(C`unix\*(C'\fR, or \f(CW\*(C`mac\*(C'\fR. This flag tells perltidy @@ -3188,7 +3207,7 @@ \&\fIperlstyle\fR\|(1), \fIPerl::Tidy\fR\|(3) .SH "VERSION" .IX Header "VERSION" -This man page documents perltidy version 20140711. +This man page documents perltidy version 20150815. .SH "CREDITS" .IX Header "CREDITS" Michael Cartmell supplied code for adaptation to \s-1VMS\s0 and helped with diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/lib/Perl/Tidy.pm new/Perl-Tidy-20150815/lib/Perl/Tidy.pm --- old/Perl-Tidy-20140711/lib/Perl/Tidy.pm 2014-07-11 13:15:31.000000000 +0200 +++ new/Perl-Tidy-20150815/lib/Perl/Tidy.pm 2015-08-15 02:18:51.000000000 +0200 @@ -3,7 +3,7 @@ # # perltidy - a perl script indenter and formatter # -# Copyright (c) 2000-2014 by Steve Hancock +# Copyright (c) 2000-2015 by Steve Hancock # Distributed under the GPL license agreement; see file COPYING # # This program is free software; you can redistribute it and/or modify @@ -67,6 +67,7 @@ @EXPORT $missing_file_spec $fh_stderr + $rOpts_character_encoding }; @ISA = qw( Exporter ); @@ -79,7 +80,7 @@ use File::Temp qw(tempfile); BEGIN { - ( $VERSION = q($Id: Tidy.pm,v 1.74 2014/07/11 13:56:49 perltidy Exp $) ) =~ s/^.*\s+(\d+)\/(\d+)\/(\d+).*$/$1$2$3/; # all one line for MakeMaker + ( $VERSION = q($Id: Tidy.pm,v 1.74 2015/08/15 13:56:49 perltidy Exp $) ) =~ s/^.*\s+(\d+)\/(\d+)\/(\d+).*$/$1$2$3/; # all one line for MakeMaker } sub streamhandle { @@ -121,7 +122,10 @@ # skipped and we can just let it crash if there is no # getline. if ( $mode =~ /[rR]/ ) { - if ( $ref eq 'IO::File' || defined &{ $ref . "::getline" } ) { + + # RT#97159; part 1 of 2: updated to use 'can' + ##if ( $ref eq 'IO::File' || defined &{ $ref . "::getline" } ) { + if ( $ref->can('getline') ) { $New = sub { $filename }; } else { @@ -138,7 +142,10 @@ # Accept an object with a print method for writing. # See note above about IO::File if ( $mode =~ /[wW]/ ) { - if ( $ref eq 'IO::File' || defined &{ $ref . "::print" } ) { + + # RT#97159; part 2 of 2: updated to use 'can' + ##if ( $ref eq 'IO::File' || defined &{ $ref . "::print" } ) { + if ( $ref->can('print') ) { $New = sub { $filename }; } else { @@ -165,6 +172,13 @@ } $fh = $New->( $filename, $mode ) or Warn("Couldn't open file:$filename in mode:$mode : $!\n"); + + # The first call here will be to read the config file, which is before + # the --encoding has been set, so the config file cannot be read as utf8 + $fh->binmode(':encoding(utf8)') + if ( $rOpts_character_encoding + && $rOpts_character_encoding eq 'utf8' + && $fh->can('binmode') ); return $fh, ( $ref or $filename ); } @@ -545,6 +559,8 @@ user => '', ); + $rOpts_character_encoding = $rOpts->{'character-encoding'}; + # be sure we have a valid output format unless ( exists $default_file_extension{ $rOpts->{'format'} } ) { my $formats = join ' ', @@ -1305,7 +1321,7 @@ my ( $fh_stream, $fh_name ) = Perl::Tidy::streamhandle( $stream, 'r' ); if ($fh_stream) { - my ( $fout, $tmpnam ) = tempfile(); + my ( $fout, $tmpnam ) = File::Temp::tempfile(); if ($fout) { $fname = $tmpnam; $is_tmpfile = 1; @@ -1529,6 +1545,7 @@ $add_option->( 'standard-error-output', 'se', '!' ); $add_option->( 'standard-output', 'st', '!' ); $add_option->( 'warning-output', 'w', '!' ); + $add_option->( 'character-encoding', 'enc', '=s' ); # options which are both toggle switches and values moved here # to hide from tidyview (which does not show category 0 flags): @@ -1760,6 +1777,7 @@ %option_range = ( 'format' => [ 'tidy', 'html', 'user' ], 'output-line-ending' => [ 'dos', 'win', 'mac', 'unix' ], + 'character-encoding' => [ 'none', 'utf8' ], 'block-brace-tightness' => [ 0, 2 ], 'brace-tightness' => [ 0, 2 ], @@ -1846,6 +1864,7 @@ nostatic-side-comments notabs nowarning-output + character-encoding=none outdent-labels outdent-long-quotes outdent-long-comments @@ -1911,6 +1930,9 @@ 'nhtml' => [qw(format=tidy)], 'tidy' => [qw(format=tidy)], + 'utf8' => [qw(character-encoding=utf8)], + 'UTF8' => [qw(character-encoding=utf8)], + 'swallow-optional-blank-lines' => [qw(kbl=0)], 'noswallow-optional-blank-lines' => [qw(kbl=1)], 'sob' => [qw(kbl=0)], @@ -1969,7 +1991,7 @@ 'sct' => [qw(scp schb scsb)], 'stack-closing-tokens' => => [qw(scp schb scsb)], 'nsct' => [qw(nscp nschb nscsb)], - 'nostack-opening-tokens' => [qw(nscp nschb nscsb)], + 'nostack-closing-tokens' => [qw(nscp nschb nscsb)], 'sac' => [qw(sot sct)], 'nsac' => [qw(nsot nsct)], @@ -3306,7 +3328,7 @@ print STDOUT <<"EOM"; This is perltidy, v$VERSION -Copyright 2000-2014, Steve Hancock +Copyright 2000-2015, Steve Hancock Perltidy is free software and may be copied under the terms of the GNU General Public License, which is included in the distribution files. @@ -4357,6 +4379,7 @@ Perl::Tidy::Warn "## Please see file $filename\n" unless ref($warning_file); $self->{_fh_warnings} = $fh_warnings; + $fh_warnings->print("Perltidy version is $Perl::Tidy::VERSION\n"); } if ( $warning_count < WARNING_LIMIT ) { @@ -5134,7 +5157,7 @@ } # Pod::Html requires a real temporary filename - my ( $fh_tmp, $tmpfile ) = tempfile(); + my ( $fh_tmp, $tmpfile ) = File::Temp::tempfile(); unless ($fh_tmp) { Perl::Tidy::Warn "unable to open temporary file $tmpfile; cannot use pod2html\n"; @@ -7793,6 +7816,13 @@ $rOpts->{'long-block-line-count'} = 1000000; } + my $enc = $rOpts->{'character-encoding'}; + if ( $enc && $enc !~ /^(none|utf8)$/i ) { + Perl::Tidy::Die <<EOM; +Unrecognized character-encoding '$enc'; expecting one of: (none, utf8) +EOM + } + my $ole = $rOpts->{'output-line-ending'}; if ($ole) { my %endings = ( @@ -7801,16 +7831,38 @@ mac => "\015", unix => "\012", ); - $ole = lc $ole; - unless ( $rOpts->{'output-line-ending'} = $endings{$ole} ) { - my $str = join " ", keys %endings; - Perl::Tidy::Die <<EOM; + + # Patch for RT #99514, a memoization issue. + # Normally, the user enters one of 'dos', 'win', etc, and we change the + # value in the options parameter to be the corresponding line ending + # character. But, if we are using memoization, on later passes through + # here the option parameter will already have the desired ending + # character rather than the keyword 'dos', 'win', etc. So + # we must check to see if conversion has already been done and, if so, + # bypass the conversion step. + my %endings_inverted = ( + "\015\012" => 'dos', + "\015\012" => 'win', + "\015" => 'mac', + "\012" => 'unix', + ); + + if ( defined( $endings_inverted{$ole} ) ) { + + # we already have valid line ending, nothing more to do + } + else { + $ole = lc $ole; + unless ( $rOpts->{'output-line-ending'} = $endings{$ole} ) { + my $str = join " ", keys %endings; + Perl::Tidy::Die <<EOM; Unrecognized line ending '$ole'; expecting one of: $str EOM - } - if ( $rOpts->{'preserve-line-endings'} ) { - Perl::Tidy::Warn "Ignoring -ple; conflicts with -ole\n"; - $rOpts->{'preserve-line-endings'} = undef; + } + if ( $rOpts->{'preserve-line-endings'} ) { + Perl::Tidy::Warn "Ignoring -ple; conflicts with -ole\n"; + $rOpts->{'preserve-line-endings'} = undef; + } } } @@ -9502,10 +9554,19 @@ } # This is a good place to kill incomplete one-line blocks - if ( ( $semicolons_before_block_self_destruct == 0 ) - && ( $max_index_to_go >= 0 ) - && ( $types_to_go[$max_index_to_go] eq ';' ) - && ( $$rtokens[0] ne '}' ) ) + if ( + ( + ( $semicolons_before_block_self_destruct == 0 ) + && ( $max_index_to_go >= 0 ) + && ( $types_to_go[$max_index_to_go] eq ';' ) + && ( $$rtokens[0] ne '}' ) + ) + + # Patch for RT #98902. Honor request to break at old commas. + || ( $rOpts_break_at_old_comma_breakpoints + && $max_index_to_go >= 0 + && $types_to_go[$max_index_to_go] eq ',' ) + ) { destroy_one_line_block(); output_line_to_go(); @@ -10644,7 +10705,7 @@ sub want_blank_line { flush(); - $file_writer_object->want_blank_line(); + $file_writer_object->want_blank_line() unless $in_format_skipping_section; } sub write_unindented_line { @@ -25352,11 +25413,20 @@ # '//' must be defined_or operator if an operator is expected. # TODO: Code for other ambiguous digraphs (/=, x=, **, *=) # could be migrated here for clarity - if ( $test_tok eq '//' ) { + + # Patch for RT#102371, misparsing a // in the following snippet: + # state $b //= ccc(); + # The solution is to always accept the digraph (or trigraph) after + # token type 'Z' (possible file handle). The reason is that + # sub operator_expected gives TERM expected here, which is + # wrong in this case. + if ( $test_tok eq '//' && $last_nonblank_type ne 'Z' ) { my $next_type = $$rtokens[ $i + 1 ]; my $expecting = operator_expected( $prev_type, $tok, $next_type ); - $combine_ok = 0 unless ( $expecting == OPERATOR ); + + # Patched for RT#101547, was 'unless ($expecting==OPERATOR)' + $combine_ok = 0 if ( $expecting == TERM ); } } @@ -25711,9 +25781,17 @@ elsif ( $tok eq 'else' ) { # patched for SWITCH/CASE - if ( $last_nonblank_token ne ';' + if ( + $last_nonblank_token ne ';' && $last_nonblank_block_type !~ - /^(if|elsif|unless|case|when)$/ ) + /^(if|elsif|unless|case|when)$/ + + # patch to avoid an unwanted error message for + # the case of a parenless 'case' (RT 105484): + # switch ( 1 ) { case x { 2 } else { } } + && $statement_type !~ + /^(if|elsif|unless|case|when)$/ + ) { warning( "expecting '$tok' to follow one of 'if|elsif|unless|case|when'\n" @@ -26452,8 +26530,15 @@ $in_statement_continuation = 0; } - # otherwise, the next token after a ',' starts a new term - elsif ( $type eq ',' ) { + # otherwise, the token after a ',' starts a new term + + # Patch FOR RT#99961; no continuation after a ';' + # This is needed because perltidy currently marks + # a block preceded by a type character like % or @ + # as a non block, to simplify formatting. But these + # are actually blocks and can have semicolons. + # See code_block_type() and is_non_structural_brace(). + elsif ( $type eq ',' || $type eq ';' ) { $in_statement_continuation = 0; } @@ -26871,9 +26956,11 @@ } } + ################################################################ # NOTE: braces after type characters start code blocks, but for # simplicity these are not identified as such. See also # sub is_non_structural_brace. + ################################################################ ## elsif ( $last_nonblank_type eq 't' ) { ## return $last_nonblank_token; @@ -27127,9 +27214,11 @@ # return 0; # } + ################################################################ # NOTE: braces after type characters start code blocks, but for # simplicity these are not identified as such. See also # sub code_block_type + ################################################################ ##if ($last_nonblank_type eq 't') {return 0} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/lib/Perl/Tidy.pod new/Perl-Tidy-20150815/lib/Perl/Tidy.pod --- old/Perl-Tidy-20140711/lib/Perl/Tidy.pod 2014-07-11 13:12:22.000000000 +0200 +++ new/Perl-Tidy-20150815/lib/Perl/Tidy.pod 2015-08-15 02:14:25.000000000 +0200 @@ -415,7 +415,7 @@ =head1 VERSION -This man page documents Perl::Tidy version 20140711. +This man page documents Perl::Tidy version 20150815. =head1 LICENSE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/t/testsa.t new/Perl-Tidy-20150815/t/testsa.t --- old/Perl-Tidy-20140711/t/testsa.t 2012-08-15 00:06:03.000000000 +0200 +++ new/Perl-Tidy-20150815/t/testsa.t 2015-08-15 01:53:02.000000000 +0200 @@ -36,7 +36,9 @@ my $ok=1; if (@expected_output == @tidy_output) { while ( $_ = pop @tidy_output ) { + s/\s+$//; my $expect = pop @expected_output; + $expect=~s/\s+$//; if ( $expect ne $_ ) { print STDERR "got:$_"; print STDERR "---\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/t/testwide.pl.src new/Perl-Tidy-20150815/t/testwide.pl.src --- old/Perl-Tidy-20140711/t/testwide.pl.src 1970-01-01 01:00:00.000000000 +0100 +++ new/Perl-Tidy-20150815/t/testwide.pl.src 2015-08-14 05:08:29.000000000 +0200 @@ -0,0 +1,4 @@ +%pangrams=("Plain","ASCII", +"Zwölf große Boxkämpfer jagen Vik quer über den Sylter.","DE", +"Jeż wlókł gęś. Uf! Bądź choć przy nim, stań!","PL", +"Любя, съешь щипцы, — вздохнёт мэр, — кайф жгуч.","RU"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Perl-Tidy-20140711/t/testwide.t new/Perl-Tidy-20150815/t/testwide.t --- old/Perl-Tidy-20140711/t/testwide.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Perl-Tidy-20150815/t/testwide.t 2015-08-14 16:46:18.000000000 +0200 @@ -0,0 +1,50 @@ +use strict; +use utf8; +use Test; +use Carp; +use FindBin; +BEGIN {unshift @INC, "./"} +BEGIN {plan tests => 2} +use Perl::Tidy; + + +my $source = <<'EOM'; +%pangrams=("Plain","ASCII", +"Zwölf große Boxkämpfer jagen Vik quer über den Sylter.","DE", +"Jeż wlókł gęś. Uf! Bądź choć przy nim, stań!","PL", +"Любя, съешь щипцы, — вздохнёт мэр, — кайф жгуч.","RU"); +EOM + +my $expected_output=<<'EOM'; +%pangrams = ( + "Plain", "ASCII", + "Zwölf große Boxkämpfer jagen Vik quer über den Sylter.", "DE", + "Jeż wlókł gęś. Uf! Bądź choć przy nim, stań!", "PL", + "Любя, съешь щипцы, — вздохнёт мэр, — кайф жгуч.", "RU" + ); +EOM + +my $perltidyrc = <<'EOM'; +-gnu -enc=utf8 +EOM + +my $output; + +Perl::Tidy::perltidy( + source => \$source, + destination => \$output, + perltidyrc => \$perltidyrc, + argv => '-nsyn', +); + +ok($output, $expected_output); + +Perl::Tidy::perltidy( + source => $FindBin::Bin . '/testwide.pl.src', + destination => \$output, + perltidyrc => \$perltidyrc, + argv => '-nsyn', +); + +ok($output, $expected_output); + ++++++ cpanspec.yml ++++++ --- description_paragraphs: 4 #no_testing: broken upstream #sources: # - source1 # - source2 #patches: # foo.patch: -p1 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ #post_prep: |- # hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'` # sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL #post_install: |- # sed on %{name}.files license: GPL-2.0+ #skip_noarch: 1 #custom_build: |- #./Build build flags=%{?_smp_mflags} --myflag #custom_test: |- #startserver && make test #ignore_requires: Bizarre::Module
participants (1)
-
root@hilbert.suse.de