From: Steve Hancock Date: Sun, 18 Apr 2021 19:08:06 +0000 (-0700) Subject: Fix issue git#63 X-Git-Tag: 20210402.01~67 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c2030cf113e2bfc436336228a17fa7aa6ff5ccc9;p=perltidy.git Fix issue git#63 --- diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index da1d463f..9586cd68 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -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; - diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index e0dc76b2..e34785be 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,16 @@ =over 4 +=item B + +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 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 This fixes issue git #62. A similar issue for the % operator was fixed. -17 Apr 2021. +17 Apr 2021, f80d677. =item B @@ -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 @@ -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 diff --git a/t/snippets/expect/git63.def b/t/snippets/expect/git63.def new file mode 100644 index 00000000..0be80fc5 --- /dev/null +++ b/t/snippets/expect/git63.def @@ -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 index 00000000..e1397463 --- /dev/null +++ b/t/snippets/git63.in @@ -0,0 +1,2 @@ +my $fragment = $parser-> #parse_html_string + parse_balanced_chunk($I); diff --git a/t/snippets/packing_list.txt b/t/snippets/packing_list.txt index 8eabb077..03dd273f 100644 --- a/t/snippets/packing_list.txt +++ b/t/snippets/packing_list.txt @@ -458,3 +458,4 @@ ../snippets9.t rt98902.def ../snippets9.t rt98902.rt98902 ../snippets9.t rt99961.def +../snippets24.t git63.def diff --git a/t/snippets24.t b/t/snippets24.t index c6ab7e24..540d6ffb 100644 --- a/t/snippets24.t +++ b/t/snippets24.t @@ -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};