From 94ac533976aa6384f8bba37156f137ced532c89b Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Thu, 18 Jun 2020 17:54:37 -0700 Subject: [PATCH] eliminate need for -xs flag for Switch::Plain --- lib/Perl/Tidy/Tokenizer.pm | 44 ++++++++++----------------------- local-docs/Release-Checklist.md | 2 +- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 697913d5..beeadbf0 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -1546,31 +1546,6 @@ sub prepare_for_a_new_file { @_ = qw(case default); @is_case_default{@_} = (1) x scalar(@_); - my $extended_syntax_type = sub { - - # check for certain extended syntax variations, and - # - if found, set $type and return the $type - # - if not found, return undef if not found - return unless ( $tokenizer_self->{'_extended_syntax'} ); - - if ( $type eq ':' ) { - - # Look for Switch::Plain syntax; some examples - # case 1: { - # default: { - # default: - # Note that the line 'default:' will be parsed as a label elsewhere. - - if ( $is_case_default{$statement_type} ) { - - # The type will be the same as a label - $type = 'J'; - return $type; - } - } - return; - }; - # ------------------------------------------------------------ # begin hash of code for handling most token types # ------------------------------------------------------------ @@ -2187,13 +2162,20 @@ sub prepare_for_a_new_file { $in_attribute_list = 1; } - # if an error would otherwise occur, check for extended syntax - elsif ( !is_balanced_closing_container(QUESTION_COLON) - && $extended_syntax_type->() ) + # Look for Switch::Plain syntax if an error would otherwise occur + # here. Note that we do not need to check if the extended syntax + # flag is set because otherwise an error would occur, and we would + # then have to output a message telling the user to set the + # extended syntax flag to avoid the error. + # case 1: { + # default: { + # default: + # Note that the line 'default:' will be parsed as a label elsewhere. + elsif ($is_case_default{$statement_type} + && !is_balanced_closing_container(QUESTION_COLON) ) { - - # it is a recognized extended syntax - # $type was set by $extended_syntax_type + # mark it as a perltidy label type + $type = 'J'; } # otherwise, it should be part of a ?/: operator diff --git a/local-docs/Release-Checklist.md b/local-docs/Release-Checklist.md index 78fac503..bb4794d9 100644 --- a/local-docs/Release-Checklist.md +++ b/local-docs/Release-Checklist.md @@ -7,7 +7,7 @@ files. - compare results of the current version with previous version - review tickets at sourceforge (hardly used now, but possible) -- review/update the ChangeLog.pod file +- review/update the CHANGES.md file - be sure RPerl still works: - build and install the latest Perl::Tidy on development machine - install the latest RPerl [currently RPerl-5.002000] -- 2.39.5