# tokens. Initialized once and continually updated as
# lines are processed.
my (
- $last_nonblank_container_type, $last_nonblank_type_sequence,
- $last_last_nonblank_token, $last_last_nonblank_type,
- $last_last_nonblank_block_type, $last_last_nonblank_container_type,
- $last_last_nonblank_type_sequence, $last_nonblank_prototype,
+ $last_nonblank_container_type, $last_nonblank_type_sequence,
+ $last_last_nonblank_token, $last_last_nonblank_type,
+ $last_nonblank_prototype,
);
# ----------------------------------------------------------------
$level_in_tokenizer = 0;
# TV6:
- $last_nonblank_container_type = EMPTY_STRING;
- $last_nonblank_type_sequence = EMPTY_STRING;
- $last_last_nonblank_token = ';';
- $last_last_nonblank_type = ';';
- $last_last_nonblank_block_type = EMPTY_STRING;
- $last_last_nonblank_container_type = EMPTY_STRING;
- $last_last_nonblank_type_sequence = EMPTY_STRING;
- $last_nonblank_prototype = EMPTY_STRING;
+ $last_nonblank_container_type = EMPTY_STRING;
+ $last_nonblank_type_sequence = EMPTY_STRING;
+ $last_last_nonblank_token = ';';
+ $last_last_nonblank_type = ';';
+ $last_nonblank_prototype = EMPTY_STRING;
return;
} ## end sub initialize_tokenizer_state
];
my $rTV6 = [
- $last_nonblank_container_type,
- $last_nonblank_type_sequence,
- $last_last_nonblank_token,
- $last_last_nonblank_type,
- $last_last_nonblank_block_type,
- $last_last_nonblank_container_type,
- $last_last_nonblank_type_sequence,
+ $last_nonblank_container_type, $last_nonblank_type_sequence,
+ $last_last_nonblank_token, $last_last_nonblank_type,
$last_nonblank_prototype,
];
return [ $rGV1, $rTV1, $rTV2, $rTV3, $rTV4, $rTV5, $rTV6 ];
) = @{$rTV5};
(
- $last_nonblank_container_type,
- $last_nonblank_type_sequence,
- $last_last_nonblank_token,
- $last_last_nonblank_type,
- $last_last_nonblank_block_type,
- $last_last_nonblank_container_type,
- $last_last_nonblank_type_sequence,
+ $last_nonblank_container_type, $last_nonblank_type_sequence,
+ $last_last_nonblank_token, $last_last_nonblank_type,
$last_nonblank_prototype,
) = @{$rTV6};
return;
$last_last_nonblank_token,
$last_last_nonblank_type,
- $last_last_nonblank_block_type,
- $last_last_nonblank_container_type,
- $last_last_nonblank_type_sequence,
)
= (
$last_nonblank_token,
$last_nonblank_type,
- $last_nonblank_block_type,
- $last_nonblank_container_type,
- $last_nonblank_type_sequence,
);
# Fix part #3 for git82: propagate type 'Z' though L-R pair
$last_last_nonblank_token,
$last_last_nonblank_type,
- $last_last_nonblank_block_type,
- $last_last_nonblank_container_type,
- $last_last_nonblank_type_sequence,
)
= (
$last_nonblank_token,
$last_nonblank_type,
- $last_nonblank_block_type,
- $last_nonblank_container_type,
- $last_nonblank_type_sequence,
);
(
my $type_i = $routput_token_type->[$i];
- #--------------------------------
- # 1. Handle a non-sequenced token
- #--------------------------------
+ #----------------------------------------
+ # Section 1. Handle a non-sequenced token
+ #----------------------------------------
if ( !$routput_type_sequence->[$i] ) {
- # 1.1 types ';' and 't'
+ #-------------------------------
+ # Section 1.1. types ';' and 't'
+ #-------------------------------
# - output anonymous 'sub' as keyword (type 'k')
# - output __END__, __DATA__, and format as type 'k' instead
# of ';' to make html colors correct, etc.
}
}
- # 1.2 Check for an invalid token type..
+ #----------------------------------------------
+ # Section 1.2. Check for an invalid token type.
+ #----------------------------------------------
# This can happen by running perltidy on non-scripts although
# it could also be bug introduced by programming change. Perl
# silently accepts a 032 (^Z) and takes it as the end
$self->[_in_error_] = 1;
}
- # Store values for a non-sequenced token
+ #----------------------------------------------------
+ # Section 1.3. Store values for a non-sequenced token
+ #----------------------------------------------------
push( @levels, $level_in_tokenizer );
push( @block_type, EMPTY_STRING );
push( @type_sequence, EMPTY_STRING );
}
- #----------------------------
- # 2. Handle a sequenced token
+ #------------------------------------
+ # Section 2. Handle a sequenced token
# One of { [ ( ? ) ] } :
- #----------------------------
+ #------------------------------------
else {
# $level_i is the level we will store. Levels of braces are
# -1 => at a nested ternary :
# 0 => otherwise
- #------------------------------------
- # 2.1 handle a level-increasing token
- #------------------------------------
+ #--------------------------------------------
+ # Section 2.1 Handle a level-increasing token
+ #--------------------------------------------
if ( $is_opening_or_ternary_type{$type_i} ) {
if ( $type_i eq '?' ) {
}
}
- #------------------------------------
- # 2.2 handle a level-decreasing token
- #------------------------------------
+ #---------------------------------------------
+ # Section 2.2. Handle a level-decreasing token
+ #---------------------------------------------
elsif ( $is_closing_or_ternary_type{$type_i} ) {
if ( $type_i ne ':' ) {
}
}
- #-------------------------------------------------------
- # 2.3 Unexpected sequenced token type - shouldn't happen
- #-------------------------------------------------------
+ #-----------------------------------------------------
+ # Section 2.3. Unexpected sequenced token type - error
+ #-----------------------------------------------------
else {
# The tokenizer should only be assigning sequence numbers
EOM
}
+ #------------------------------------------------
+ # Section 2.4. Store values for a sequenced token
+ #------------------------------------------------
+
# The starting nesting block string, which is used in any .LOG
# output, should include the first token of the line
if ( !@levels ) {
}
- }
+ } ## End loop to over tokens
- # End loop to over tokens
+ #---------------------
+ # Post-loop operations
+ #---------------------
$line_of_tokens->{_nesting_blocks_0} = $nesting_block_string_0;
- #--------------------------
# Form and store the tokens
- #--------------------------
if (@levels) {
my $im = shift @{$routput_token_list};
}
}
- # Note: this is the new version of this routine. It does not compute
- # continuation indentation; it returns values ci=0. The ci values
- # are computed later by sub Formatter::set_ci.
-
+ # This routine no longer computes continuation indentation. It returns
+ # ci=0. The ci values are computed later by sub Formatter::set_ci.
my @ci_levels = (0) x scalar(@levels);
- #----------------------------------------------------------
# Wrap up this line of tokens for shipping to the Formatter
- #----------------------------------------------------------
$line_of_tokens->{_rtoken_type} = \@token_type;
$line_of_tokens->{_rtokens} = \@tokens;
$line_of_tokens->{_rblock_type} = \@block_type;