# method paint => sub {
# ...
# }
+ my $next_char = EMPTY_STRING;
+ if ( $input_line =~ m/\s*(\S)/gcx ) { $next_char = $1 }
+ if ( !$next_char || $next_char eq '#' ) {
+ ( $next_char, my $i_next ) =
+ find_next_nonblank_token( $max_token_index,
+ $rtokens, $max_token_index );
+ }
- if ( $input_line =~ m/\s*(\S)/gcx ) {
- my $char = $1;
+ if ( !$next_char ) {
- # Possibly valid next token types:
- # '(' could start prototype or signature
- # ':' could start ATTRIBUTE
- # '{' cold start BLOCK
- # ';' or '}' could end a statement
- if ( $char =~ /^[\(\:\{\;\}]/ ) { return 1 }
+ # out of characters - give up
+ return;
+ }
- # stop at a side comment - assume ok for now
- if ( $char eq '#' ) { return 1 }
+ # Possibly valid next token types:
+ # '(' could start prototype or signature
+ # ':' could start ATTRIBUTE
+ # '{' cold start BLOCK
+ # ';' or '}' could end a statement
+ if ( $next_char !~ /^[\(\:\{\;\}]/ ) {
- # nothing else is valid (in particular '#' and '"')
+ # This does not match use feature 'class' syntax
return;
}
- # TBD: Still uncertain; may be at end of line
- # We could continue will stop here and assume ok.
+ # We will stop here and assume that this is valid syntax for
+ # use feature 'class'.
return 1;
}
find_next_nonblank_token( $max_token_index,
$rtokens, $max_token_index );
}
- return unless ($next_char);
+ if ( !$next_char ) {
+
+ # out of characters - give up
+ return;
+ }
# Must see one of: ATTRIBUTE, VERSION, BLOCK, or end stmt