]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix error in parsing use statement curly brace
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 16 Mar 2021 15:07:13 +0000 (08:07 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 16 Mar 2021 15:07:13 +0000 (08:07 -0700)
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod

index df08f0d4e2c8570580911b0474e47083c2866040..05356a253e6fd465ba6dfbcaa2a894355fdde22c 100644 (file)
@@ -5194,6 +5194,11 @@ sub code_block_type {
 
     # check bareword
     elsif ( $last_nonblank_type eq 'w' ) {
+
+        # check for syntax 'use MODULE LIST'
+        # This fixes b1022 b1025 b1027 b1028 b1029 b1030 b1031
+        return "" if ( $statement_type eq 'use' );
+
         return decide_if_code_block( $i, $rtokens, $rtoken_type,
             $max_token_index );
     }
index 71723a099edbfed24c328464194363773f73e3af..7abb706b50f2fed8911778861234554dc0a6f60f 100644 (file)
@@ -2,6 +2,18 @@
 
 =over 4
 
+=item B<Fix error in parsing use statement curly brace>
+
+Testing with random parameters produced some cases where the -xci option was
+not producing stable results when the maximum line length was set to a very
+small value.  The problem was traced to the tokenizer misparsing a hash brace
+of a use statement as a code block type. This influences the value of
+continuation indentation within the braces. The problem was fixed.
+
+This fixes cases b1022 b1025 b1026 b1027 b1028 b1029 b1030
+
+16 Mar 2021.
+
 =item B<Fix problems with combinations of -iob -lp -wn -dws -naws>
 
 Testing with random parameters produced some situation where the parameter -iob