From: Steve Hancock Date: Sat, 16 Jan 2021 17:59:27 +0000 (-0800) Subject: updated tokenizer to prevent a blinking state X-Git-Tag: 20210402~82 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d40cca938249ab2b71b5742ad03966cd1afeb58e;p=perltidy.git updated tokenizer to prevent a blinking state --- diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 63ca4710..d45cc405 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -6165,8 +6165,11 @@ sub scan_bare_identifier_do { ) { - # may not be indirect object unless followed by a space - if ( $input_line =~ m/\G\s+/gc ) { + # may not be indirect object unless followed by a space; + # updated 2021-01-16 to consider newline to be a space. + if ( pos($input_line) == length($input_line) + || $input_line =~ m/\G\s+/gc ) + { $type = 'Y'; # Abandon Hope ... diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 5e281d49..71bccffd 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -2,10 +2,39 @@ =over 4 +=item B + +In random testing a blinker was reduced to the following snippet + + { + print FILE + GD::Barcode + ->new(); + } + +which switched to the following state on each iteration + + { + print FILE GD::Barcode + ->new(); + } + +with the following parameters + + --maximum-line-length=20 + --indent-columns=9 + --continuation-indentation=1 + +The problem was that the token 'FILE' was either parsed as type 'Y' +or 'Z' depending on the existance of a subsequent space. These have +different line break rules, causing a blinker. The problem was +fixed by modifying the tokenizer to consider a newline to be a space. +Updated 16 Jan 2021. + =item B A conflict arises if both B<-bli> and B<-bar> are set. In this case a warning message -is given and B<-bli> is turned off. +is given and B<-bli> is turned off. Updated 15 Jan 2021. =item B