'++' => sub {
if ( $expecting == TERM ) { $type = 'pp' }
elsif ( $expecting == UNKNOWN ) {
+
my ( $next_nonblank_token, $i_next ) =
find_next_nonblank_token( $i, $rtokens, $max_token_index );
+
+ # Fix for c042: look past a side comment
+ if ( $next_nonblank_token eq '#' ) {
+ ( $next_nonblank_token, $i_next ) =
+ find_next_nonblank_token( $max_token_index,
+ $rtokens, $max_token_index );
+ }
+
if ( $next_nonblank_token eq '$' ) { $type = 'pp' }
}
},
elsif ( $expecting == UNKNOWN ) {
my ( $next_nonblank_token, $i_next ) =
find_next_nonblank_token( $i, $rtokens, $max_token_index );
+
+ # Fix for c042: look past a side comment
+ if ( $next_nonblank_token eq '#' ) {
+ ( $next_nonblank_token, $i_next ) =
+ find_next_nonblank_token( $max_token_index,
+ $rtokens, $max_token_index );
+ }
+
if ( $next_nonblank_token eq '$' ) { $type = 'mm' }
}
},
}
last;
}
- return $rtokens;
+ return;
}
#########i#############################################################
sub find_next_nonblank_token {
my ( $i, $rtokens, $max_token_index ) = @_;
+ # Returns the next nonblank token after the token at index $i
+ # To skip past a side comment, and any subsequent block comments
+ # and blank lines, call with i=$max_token_index
+
if ( $i >= $max_token_index ) {
if ( !peeked_ahead() ) {
peeked_ahead(1);
- $rtokens =
- peek_ahead_for_nonblank_token( $rtokens, $max_token_index );
+ peek_ahead_for_nonblank_token( $rtokens, $max_token_index );
}
}
=over 4
+=item B<Fix problem caused by side comment after ++>
+
+Testing with side comments produced an incorrect error message for this
+snippet:
+
+ xxx
+ ++#
+ $test,
+ Internals::SvREADONLY( %$copy) ,
+ "cloned hash restricted?" ;
+
+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.
+
=item B<Fix problem caused by side comment after pointer, part 2>
This is related to the previous issue, c037. The following snippet was misparsed