]> git.donarmstrong.com Git - perltidy.git/commitdiff
Fix issue git#63
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 18 Apr 2021 19:08:06 +0000 (12:08 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 18 Apr 2021 19:08:06 +0000 (12:08 -0700)
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod
t/snippets/expect/git63.def [new file with mode: 0644]
t/snippets/git63.in [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets24.t

index da1d463f52f11b6d392079547164dd9c38a2e468..9586cd68b0f6645a5a6e2c5fbf2ba302d08562f5 100644 (file)
@@ -3950,6 +3950,14 @@ EOM
 
                             }
 
+                            # Fix part 1 for git #63 in which a comment falls
+                            # between an -> and the following word.  An
+                            # alternate fix would be to change operator_expected
+                            # to return an UNKNOWN for this type.
+                            elsif ( $last_nonblank_type eq '->' ) {
+
+                            }
+
                             # don't complain about possible indirect object
                             # notation.
                             # For example:
@@ -3977,7 +3985,10 @@ EOM
                         # functions
                         $next_tok = $rtokens->[ $i + 1 ];
                         if ( $next_tok eq '(' ) {
-                            $type = 'U';
+
+                            # Fix part 2 for git #63.  Leave type as 'w' to keep
+                            # the type the same as if the -> were not separated
+                            $type = 'U' unless ( $last_nonblank_type eq '->' );
                         }
 
                         # underscore after file test operator is file handle
@@ -9063,4 +9074,3 @@ BEGIN {
     @is_keyword{@Keywords} = (1) x scalar(@Keywords);
 }
 1;
-
index e0dc76b2a0cd219fe5d5c445c54b80004bd761d4..e34785be38d2e5d1f95f4ee479ff7069120e2d19 100644 (file)
@@ -2,6 +2,16 @@
 
 =over 4
 
+=item B<Fix issue git#63>
+
+The following lines produced an error message due to the side comment
+
+    my $fragment = $parser->    #parse_html_string
+      parse_balanced_chunk($I);
+
+This has been fixed.
+18 Apr 2021.
+
 =item B<Avoid welding at sort/map/grep paren calls>
 
 Random testing produced several cases of unstable welds in which the inner
@@ -11,12 +21,12 @@ preventing welds at these locations.
 
 This update fixes cases b1077 b1092 b1093 b1094 b1104 b1105 b1108.
 
-17 Apr 2021.
+17 Apr 2021, d679b48.
 
 =item B<Fix issue git#62>
 
 This fixes issue git #62.  A similar issue for the % operator was fixed.
-17 Apr 2021.
+17 Apr 2021, f80d677.
 
 =item B<Fix problem involving -bbx=2 -xci -osbr and similar -otr flags>
 
@@ -25,7 +35,7 @@ by the --opening-token-right flags interfered with counting line-ending
 commas, and this in turn caused the -bbx flag to turn off the -xci flag.
 This problem was fixed.
 
-15 Apr 2021.
+15 Apr 2021, 21ef53b.
 
 =item B<Fix rare line break problem>
 
@@ -51,7 +61,7 @@ The different results were caused by the unusual combination of parameters.
 The problem was fixed by not allowing the formatter to consider existing breaks
 at highly stressed locations such as these.
 
-15 Apr 2021.
+15 Apr 2021, 9f15b9d.
 
 =item B<Fix problem parsing anonymous subs with attribute lists>
 
diff --git a/t/snippets/expect/git63.def b/t/snippets/expect/git63.def
new file mode 100644 (file)
index 0000000..0be80fc
--- /dev/null
@@ -0,0 +1,2 @@
+my $fragment = $parser->    #parse_html_string
+  parse_balanced_chunk($I);
diff --git a/t/snippets/git63.in b/t/snippets/git63.in
new file mode 100644 (file)
index 0000000..e139746
--- /dev/null
@@ -0,0 +1,2 @@
+my $fragment = $parser-> #parse_html_string
+  parse_balanced_chunk($I);
index 8eabb077381e4afe854788bb6782a5d701a08fb7..03dd273f4e458b69bfe1c0827ec6a07846d0623b 100644 (file)
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
+../snippets24.t        git63.def
index c6ab7e245bc3a2fa1ec28e405f75225a73ab279e..540d6ffb25518d77afc8d5b9205c39118cd80336 100644 (file)
@@ -11,6 +11,7 @@
 #8 lpxl.lpxl3
 #9 lpxl.lpxl4
 #10 lpxl.lpxl5
+#11 git63.def
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -113,6 +114,11 @@ my $list =
     ) ;
 ----------
 
+        'git63' => <<'----------',
+my $fragment = $parser-> #parse_html_string
+  parse_balanced_chunk($I);
+----------
+
         'lpxl' => <<'----------',
 # simple function call
 my $loanlength = getLoanLength(
@@ -669,6 +675,15 @@ $behaviour = {
 };
 #10...........
         },
+
+        'git63.def' => {
+            source => "git63",
+            params => "def",
+            expect => <<'#11...........',
+my $fragment = $parser->    #parse_html_string
+  parse_balanced_chunk($I);
+#11...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};