elsif ( $rOpts->{'use-feature'} =~ /\bclass\b/ ) {
$guess_if_method = 0;
}
+ else {
+ ## neither 'class' nor 'noclass' seen so use default
+ }
}
# These are the main updates for this option. There are additional
"Already in code-skipping section which started at line $lno\n"
);
}
+ else {
+ ## ok - not a code-skipping control line
+ }
return $line_of_tokens;
}
return $line_of_tokens;
}
}
+ else {
+ ## ok
+ }
# check for a hash-bang line if we haven't seen one
if ( !$self->[_saw_hash_bang_]
}
return $line_of_tokens;
}
+ else {
+ ## ok: not in __END__ or __DATA__
+ }
# now, finally, we know that this line is type 'CODE'
$line_of_tokens->{_line_type} = 'CODE';
$self->[_line_start_quote_] = -1;
$self->log_numbered_msg("End of multi-line quote or pattern\n");
}
+ else {
+ ## ok
+ }
# we are returning a line of CODE
return $line_of_tokens;
$type = 't';
$fast_scan_type = $type;
}
+ else {
+ ## out of tricks
+ }
}
#---------------------------
$identifier = $tok;
$context = UNKNOWN_CONTEXT;
}
+ else {
+ ## out of tricks
+ }
#--------------------------------------
# Verify correctness during development
"Do you mean '$last_nonblank_token->(' ?\n";
}
}
+ else {
+ ## no hint
+ }
if ($hint) {
$self->interrupt_logfile();
$self->warning($hint);
elsif ( $last_nonblank_token eq '(' && $last_nonblank_type eq '{' ) {
$self->warning("Unexpected leading ',' after a '('\n");
}
+ else {
+ ## ok: no complaints needed
+ }
# patch for operator_expected: note if we are in the list (use.t)
if ( $statement_type eq 'use' ) { $statement_type = '_use' }
}
$want_paren = EMPTY_STRING;
}
+ else {
+ ## ok: not special
+ }
# now identify which of the three possible types of
# curly braces we have: hash index container, anonymous
$i++;
}
}
+ else {
+ ## not multiple characters
+ }
}
return;
} ## end sub do_STAR
$self->complain(
"Unconventional here-target: '$here_doc_target'\n");
}
+ else {
+ ## ok: nothing to complain about
+ }
}
elsif ( $expecting == TERM ) {
unless ($saw_error) {
$self->report_definite_bug();
}
}
+
+ # target not found, expecting == UNKNOWN
+ else {
+ # assume it is a shift
+ }
}
else {
}
$self->complain(
"Unconventional here-target: '$here_doc_target'\n");
}
+ else {
+ ## ok: nothing to complain about
+ }
# Note that we put a leading space on the here quote
# character indicate that it may be preceded by spaces
[ $here_doc_target, $here_quote_character ];
$type = 'h';
}
+
+ # target not found ..
elsif ( $expecting == TERM ) {
unless ($saw_error) {
$self->report_definite_bug();
}
}
+
+ # Target not found, expecting==UNKNOWN
+ else {
+ ## syntax error? FIXME: probably should write error msg
+ }
}
else {
$self->error_if_expecting_OPERATOR();
# '++'
# type = 'pp' for pre-increment, '++' for post-increment
- if ( $expecting == TERM ) { $type = 'pp' }
- elsif ( $expecting == UNKNOWN ) {
+ if ( $expecting == OPERATOR ) { $type = '++' }
+ elsif ( $expecting == TERM ) { $type = 'pp' }
+ # handle ( $expecting == UNKNOWN )
+ else {
+
+ # look ahead ..
my ( $next_nonblank_token, $i_next ) =
$self->find_next_nonblank_token( $i, $rtokens, $max_token_index );
# '--'
# type = 'mm' for pre-decrement, '--' for post-decrement
- if ( $expecting == TERM ) { $type = 'mm' }
- elsif ( $expecting == UNKNOWN ) {
+ if ( $expecting == OPERATOR ) { $type = '--' }
+ elsif ( $expecting == TERM ) { $type = 'mm' }
+
+ # handle ( $expecting == UNKNOWN )
+ else {
+
+ # look ahead ..
my ( $next_nonblank_token, $i_next ) =
$self->find_next_nonblank_token( $i, $rtokens, $max_token_index );
if ( $next_nonblank_token eq '$' ) { $type = 'mm' }
}
+
return;
} ## end sub do_MINUS_MINUS
elsif ( $tok eq 'err' ) {
if ( $expecting != OPERATOR ) { $type = 'w' }
}
+ else {
+ ## no special treatment needed
+ }
return;
} ## end sub do_KEYWORD
# the type the same as if the -> were not separated
elsif ( $last_nonblank_type ne '->' ) { $type = 'U' }
+ # not a special case
+ else { }
+
}
# underscore after file test operator is file handle
elsif ( $tok eq 'x' && $last_nonblank_type eq 'w' ) {
$type = 'x';
}
+ else {
+ ## not a special case
+ }
}
}
return;
elsif ( $last_nonblank_token eq 'ne' ) {
$self->complain("Should 'ne' be '!=' here ?\n");
}
+ else {
+ # that's all
+ }
}
# fix c090, only rotate vars if a new token will be stored
}
# The only current tetragraph is the double diamond operator
- # and its first three characters are not a trigraph, so
+ # and its first three characters are NOT a trigraph, so
# we do can do a special test for it
- elsif ( $test_tok eq '<<>' ) {
- $test_tok .= $rtokens->[ $i + 2 ];
- if ( $is_tetragraph{$test_tok} ) {
- $tok = $test_tok;
- $i += 2;
+ else {
+ if ( $test_tok eq '<<>' ) {
+ $test_tok .= $rtokens->[ $i + 2 ];
+ if ( $is_tetragraph{$test_tok} ) {
+ $tok = $test_tok;
+ $i += 2;
+ }
}
}
}
);
$self->[_in_error_] = 1;
}
+ else {
+ ## ok - valid token type other than ; and t
+ }
#----------------------------------------------------
# Section 1.3. Store values for a non-sequenced token
# keyword...
if ( $last_nonblank_type eq 'k' ) {
- $op_expected = TERM;
+
+ # keywords expecting OPERATOR:
if ( $expecting_operator_token{$last_nonblank_token} ) {
$op_expected = OPERATOR;
}
+
+ # keywords expecting TERM:
elsif ( $expecting_term_token{$last_nonblank_token} ) {
# Exceptions from TERM:
{
$op_expected = UNKNOWN;
}
+ else {
+ $op_expected = TERM;
+ }
+ }
+ else {
+ $op_expected = TERM;
}
} ## end type 'k'
# TODO: labeled prototype words would better be given type 'A' or maybe
# 'J'; not 'q'; or maybe mark as type 'Y'?
elsif ( $last_nonblank_type eq 'q' ) {
- $op_expected = OPERATOR;
if ( $last_nonblank_token eq 'prototype' ) {
$op_expected = TERM;
}
elsif ( $statement_type =~ /^package\b/ ) {
$op_expected = TERM;
}
+
+ # everything else
+ else {
+ $op_expected = OPERATOR;
+ }
}
# file handle or similar
elsif ( $last_nonblank_type eq 'Z' ) {
- $op_expected = UNKNOWN;
-
# angle.t
if ( $last_nonblank_token =~ /^\w/ ) {
$op_expected = UNKNOWN;
}
$op_expected = OPERATOR;
}
+
+ # all other cases
+ else {
+ $op_expected = UNKNOWN;
+ }
}
# anything else...
elsif ( $pre_types[$j] eq '-' && $pre_types[ ++$j ] eq 'w' ) {
$j++;
}
+ else {
+ # none of the above
+ }
if ( $j > $jbeg ) {
$j++ if $pre_types[$j] eq 'b';
$type = 'Z';
}
}
+
+ # none of the above special types
+ else {
+ }
}
# Now we must convert back from character position
# right curly braces of prototypes NOT ending in
# '&' may NOT be followed by an operator
- elsif ( $proto !~ /\&$/ ) {
+ else {
$ris_block_list_function->{$package}{$subname} = 1;
}
}
elsif ( $call_type == PAREN_CALL ) {
$tok = $last_nonblank_token;
}
+ else {
+ }
$match ||= 1;
substr( $tok, 0, 3 ) eq 'sub' ? $tok : 'sub';
}
}
- elsif ($next_nonblank_token) { # EOF technically ok
+
+ # something else..
+ elsif ($next_nonblank_token) {
if ( $rinput_hash->{tok} eq 'method' && $call_type == SUB_CALL )
{
);
}
}
+
+ # EOF technically ok
+ else {
+ }
+
check_prototype( $proto, $package, $subname );
}
$next_nonblank_token = $rtokens->[ ++$i ];
return ( SPACE, $i ) unless defined($next_nonblank_token);
}
+ else {
+ ## at nonblank
+ }
# We should be at a nonblank now
return ( $next_nonblank_token, $i );
$self->warning(
"looks like a markup language, continuing error checks\n");
}
+ else {
+ ## doesn't look like a markup tag
+ }
if ($is_html_tag) {
$self->[_html_tag_count_]++;
$quoted_string .= '\\'
unless ( $tok eq $end_tok || $tok eq $beginning_tok );
}
+ else {
+ ## nothing special
+ }
$quoted_string .= $tok;
}
}