From: Steve Hancock Date: Sun, 4 Jul 2021 01:25:48 +0000 (-0700) Subject: Check for side comment within package statement X-Git-Tag: 20210625.02~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c00059afab9fd428ca63abdcabbc617faf56b4c3;p=perltidy.git Check for side comment within package statement --- diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index b0e3676d..1be21abe 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -6601,7 +6601,8 @@ sub do_scan_package { # knows that the number is in a package statement. # Examples of valid primitive tokens that might follow are: # 1235 . ; { } v3 v - if ( $next_nonblank_token =~ /^([v\.\d;\{\}])|v\d|\d+$/ ) { + # FIX: added a '#' since a side comment may also follow + if ( $next_nonblank_token =~ /^([v\.\d;\{\}\#])|v\d|\d+$/ ) { $statement_type = $tok; } else { diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 41041242..567286e9 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,6 +2,17 @@ =over 4 +=item B + +Testing with randomly placed side comments caused perltidy to produce an incorrect +warning when a side comment is placed before the end of a package statement: + + package double # side comment + ; + +This update fixes this. +3 Jul 2021. + =item B Testing revealed a formatting irregularity which was caused when the flag