## 2023 03 09.02
+ - Issue git #118. A warning will be issued if a duplicate format-skipping
+ starting marker is seen within a format-skipping section. The same
+ applies to duplicate code-skipping starting markers within code-skipping
+ sections.
+
- Issue git #116. A new flag --valign-if-unless, -viu, was added to
allow postfix 'unless' terms to align with postfix 'if' terms. The
default remains not to do this.
write_logfile_entry(
"Line $input_line_no: Exiting format-skipping section\n");
}
+ elsif (
+ $is_block_comment
+
+ # optional fast pre-check
+ && ( substr( $rLL->[$Kfirst]->[_TOKEN_], 0, 4 ) eq '#<<<'
+ || $rOpts_format_skipping_begin )
+
+ && $rOpts_format_skipping
+ && ( $rLL->[$Kfirst]->[_TOKEN_] . SPACE ) =~
+ /$format_skipping_pattern_begin/
+ )
+ {
+ # warn of duplicate starting comment lines, git #118
+ my $input_line_no = $line_of_tokens->{_line_number};
+ warning(
+"Already in format-skipping section which started at line $In_format_skipping_section\n",
+ $input_line_no
+ );
+ }
$CODE_type = 'FS';
next;
}
/$format_skipping_pattern_begin/
)
{
- $In_format_skipping_section = 1;
my $input_line_no = $line_of_tokens->{_line_number};
+ $In_format_skipping_section = $input_line_no;
write_logfile_entry(
"Line $input_line_no: Entering format-skipping section\n");
$CODE_type = 'FS';
foreach my $KK ( $Kfirst .. $Klast ) {
# TODO: consider eliminating this closure var by passing directly to
- # store_token following pattern of store_tokens_to_go.
+ # store_token following pattern of store_token_to_go.
$Ktoken_vars = $KK;
my $rtoken_vars = $rLL->[$KK];
$self->log_numbered_msg("Exiting code-skipping section\n");
$self->[_in_skipped_] = 0;
}
+ elsif ( $input_line =~ /$code_skipping_pattern_begin/ ) {
+
+ # warn of duplicate starting comment lines, git #118
+ my $lno = $self->[_in_skipped_];
+ $self->warning(
+ "Already in code-skipping section which started at line $lno\n"
+ );
+ }
return $line_of_tokens;
}
sub initialize_tokenizer_state {
- # TV0: initialized once
+ # GV1: initialized once
# TV1: initialized on each call
# TV2: initialized on each call
# TV3:
sub save_tokenizer_state {
- # Save package variables:
- my $rTV0 = [
-
+ # Global variables:
+ my $rGV1 = [
$brace_depth,
$context,
$current_package,
$square_bracket_depth,
$statement_type,
$total_depth,
+
];
+ # Tokenizer closure variables:
my $rTV1 = [
$block_type, $container_type, $expecting,
$i, $i_tok, $input_line,
$last_last_nonblank_type_sequence,
$last_nonblank_prototype,
];
- return [ $rTV0, $rTV1, $rTV2, $rTV3, $rTV4, $rTV5, $rTV6 ];
+ return [ $rGV1, $rTV1, $rTV2, $rTV3, $rTV4, $rTV5, $rTV6 ];
} ## end sub save_tokenizer_state
sub restore_tokenizer_state {
my ($rstate) = @_;
- my ( $rTV0, $rTV1, $rTV2, $rTV3, $rTV4, $rTV5, $rTV6 ) = @{$rstate};
+ my ( $rGV1, $rTV1, $rTV2, $rTV3, $rTV4, $rTV5, $rTV6 ) = @{$rstate};
(
-
$brace_depth,
$context,
$current_package,
$square_bracket_depth,
$statement_type,
$total_depth,
- ) = @{$rTV0};
+
+ ) = @{$rGV1};
(
$block_type, $container_type, $expecting,
if ( $rOpts_code_skipping
&& $input_line =~ /$code_skipping_pattern_begin/ )
{
- $self->[_in_skipped_] = 1;
+ $self->[_in_skipped_] = $self->[_last_line_number_];
return;
}