if ( $pre_type eq 'w' ) {
$expecting =
operator_expected( [ $prev_type, $tok, $next_type ] );
+
+ # Patch for c043, part 3: A bareword after '->' expects a TERM
+ # FIXME: It would be cleaner to give method calls a new type 'M'
+ # and update sub operator_expected to handle this.
+ if ( $last_nonblank_type eq '->' ) {
+ $expecting = TERM;
+ }
+
my ( $next_nonblank_token, $i_next ) =
find_next_nonblank_token( $i, $rtokens, $max_token_index );
# have a long package name. Fixes c037, c041.
if ( $last_nonblank_token eq '->' ) {
scan_bare_identifier();
+
+ # Patch for c043, part 4; use type 'w' after a '->'
+ # This is just a safety check on sub scan_bare_identifier, which
+ # should get this case correct.
+ $type = 'w';
next;
}
else {
$package = $current_package;
- if ( $is_keyword{$tok} ) {
+ # patched for c043, part 1: keyword does not follow '->'
+ if ( $is_keyword{$tok} && $last_nonblank_type ne '->' ) {
$type = 'k';
}
}
- # if it is a bareword..
- if ( $type eq 'w' ) {
+ # if it is a bareword.. patched for c043, part 2: not following '->'
+ if ( $type eq 'w' && $last_nonblank_type ne '->' ) {
# check for v-string with leading 'v' type character
# (This seems to have precedence over filehandle, type 'Y')
=over 4
+=item B<Fix problem with side comment after pointer, part 3>
+
+This update fixes some incorrect tokenization produced by a side comment
+placed between a pointer and a bareword as in this snippet:
+
+ sub tzoffset {};
+
+ ...
+
+ my $J
+ +=
+ (
+ $self
+ ->#sc
+ tzoffset
+ / (
+ 24
+ *
+ 3600
+ )
+ );
+
+If a sub declaration for the bareword has been seen, the following '/' was
+being rejected as an operator. This update fixes this case, which is issue
+c043.
+
+13 Jul 2021.
+
=item B<Avoid line breaks before a slash in certain cases>
This is a modification to the previous update for case c039 which prevents a line break before a '/' character which follows a bareword or possible indirect object. This rule