]> git.donarmstrong.com Git - perltidy.git/commitdiff
Avoid certain line breaks before a /; final #>>V not required
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 10 Jul 2021 21:52:38 +0000 (14:52 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 10 Jul 2021 21:52:38 +0000 (14:52 -0700)
CHANGES.md
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod

index d5180cbede0cbd0beac403a8cdc4882d45831253..da6b8dc7dfdb07971c6887139fc82d14bd4222b3 100644 (file)
@@ -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' which is not terminated with a closing 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.
index 31841a42741275010b496cd5d883ddb88bd75cbb..ea9ea09c2f01b0f74f97621fd4a4eaf9e572a4d9 100644 (file)
@@ -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 ) {
index 6a5492064f4d72a107e1842de7460bf17f5ac6ea..d62bb6faa413c3442db1d7768205106e5b9d89ee 100644 (file)
@@ -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_] ) {
index 757e581588cf367ae9bbcd6170145a26fbdaa01a..e6f0ab9d8d4a60b7c5ec96ec9783cad587bd5b01 100644 (file)
@@ -2,6 +2,17 @@
 
 =over 4
 
+=item B<Removed warning message if ending in code skipping section>
+
+In the previous version, a warning was produced if a 'code-skipping' opening comment
+'#<<V' was not followed by a closing 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<Improve logic for distinguishing a pattern vs a division>
 
 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<Fix problem caused by side comment after ++>
 
@@ -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<Fix problem caused by side comment after pointer, part 2>
 
@@ -62,7 +73,7 @@ pointer.
 
 This is fixed in this update, case c041.
 
-7 Jul 2021.
+7 Jul 2021, 1806772.
 
 =item B<Fix problem caused by side comment after pointer>