From: Steve Hancock Date: Sat, 10 Jul 2021 21:52:38 +0000 (-0700) Subject: Avoid certain line breaks before a /; final #>>V not required X-Git-Tag: 20210717~10 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=461199ceceed3c9367bc31553bb9d46de03e5243;p=perltidy.git Avoid certain line breaks before a /; final #>>V not required --- diff --git a/CHANGES.md b/CHANGES.md index d5180cbe..da6b8dc7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,15 @@ ## 2021 06 25.02 + - Fixed an undefined variable message, see git #67. When a format skipping + comment '#<<' is placed before the first line of code in a script, a + message 'Use of uninitialized value $Ktoken_vars in numeric ...' can + occur. + + - A warning will no longer be given if a script has a code-skipping begin + comment '#<>V'. This + makes it behave like the related format-skipping option. + - Removed the limit on -ci=n when -xci is set, reference: rt #136415. This update removes a limit in the previous two versions in which the value of -ci=n was limited to the value of -i=n when -xci was set. diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 31841a42..ea9ea09c 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -3727,8 +3727,10 @@ EOM && $want_left_space{$next_type} == WS_NO ) - # or we might be followed by the start of a quote - || $next_nonblank_type =~ /^[\/\?]$/ + # or we might be followed by the start of a quote, + # fixes c039. + || substr( $next_nonblank_token, 0, 1 ) eq '/' + ) { $bond_str = NO_BREAK; @@ -3755,6 +3757,12 @@ EOM if ( $types_to_go[ $i_next_nonblank + 1 ] eq 'n' ); } + # Fix for c039 + elsif ( $type eq 'w' ) { + $bond_str = NO_BREAK + if ( substr( $next_nonblank_token, 0, 1 ) eq '/' ); + } + my $bond_str_2 = $bond_str; #--------------------------------------------------------------- @@ -5138,9 +5146,9 @@ sub respace_tokens { my $seqno_parent = $seqno_stack{ $depth_next - 1 }; $seqno_parent = SEQ_ROOT unless defined($seqno_parent); push @{ $rchildren_of_seqno->{$seqno_parent} }, $type_sequence; - $rparent_of_seqno->{$type_sequence} = $seqno_parent; - $seqno_stack{$depth_next} = $type_sequence; - $K_old_opening_by_seqno{$type_sequence} = $Ktoken_vars; + $rparent_of_seqno->{$type_sequence} = $seqno_parent; + $seqno_stack{$depth_next} = $type_sequence; + $K_old_opening_by_seqno{$type_sequence} = $Ktoken_vars; $depth_next++; if ( $depth_next > $depth_next_max ) { diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 6a549206..d62bb6fa 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -567,7 +567,8 @@ EOM } if ( $tokenizer_self->[_in_skipped_] ) { - warning("hit EOF while in lines skipped with --code-skipping\n"); + write_logfile_entry( + "hit EOF while in lines skipped with --code-skipping\n"); } if ( $tokenizer_self->[_in_pod_] ) { diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 757e5815..e6f0ab9d 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,17 @@ =over 4 +=item B + +In the previous version, a warning was produced if a 'code-skipping' opening comment +'#<>V'. But the related 'format-skipping' +commands do not give a warning if a '#<<<' comment is not ended with a '#>>>' closing +comment. In order to be able to smoothly change between these options, it seems best +to remove the warning about a missing '#>>V'. There is still a message in the log file +about this, so if there is any uncertainty about it, a log file can be saved and consulted. + +10 Jul 2021. + =item B Testing with side comments produced the following snippet which caused a error @@ -25,7 +36,7 @@ For example This update fixes these problems, case c040. -9 Jul 2021. +9 Jul 2021, ffe4351. =item B @@ -42,7 +53,7 @@ The problem was caused by the side comment between the '++' and '$test'. The same problem occurs for '--' instead of '++'. This is fixed with this update, case c042. -8 Jul 2021. +8 Jul 2021, 20cc9a0. =item B @@ -62,7 +73,7 @@ pointer. This is fixed in this update, case c041. -7 Jul 2021. +7 Jul 2021, 1806772. =item B