]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix b1475
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 6 Jun 2024 14:18:11 +0000 (07:18 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 6 Jun 2024 14:18:11 +0000 (07:18 -0700)
dev-bin/run_convergence_tests.pl.data
dev-bin/run_convergence_tests.pl.expect
lib/Perl/Tidy/Formatter.pm

index 27c455cee4a20b39a6294426f749127a8e12a1bd..59db65ca09ef64e8b0445d5be23fab2855ec2563 100644 (file)
@@ -12149,6 +12149,23 @@ my @global_ops = (
 --extended-continuation-indentation
 --brace-tightness=2
 
+==> b1475.in <==
+run_sub (
+         ->$blah{ say "ok 5" ; } ) ;
+
+run_sub ( ->$blah{ say "ok 5" ; }
+) ;
+
+
+==> b1475.par <==
+--maximum-line-length=36
+--extended-continuation-indentation
+--paren-vertical-tightness=2
+--extended-line-up-parentheses
+--space-function-paren
+--space-terminal-semicolon
+--break-at-old-method-breakpoints
+
 ==> b148.in <==
 # state 1
 @yydgoto=(
index f761d75adcf2172a32f3f7f9621c62004eaf2a9a..63e0b9fc4ba80c8bde643a2b4a8218eb2c7dad35 100644 (file)
@@ -8243,6 +8243,14 @@ my @global_ops = (
                   iparse(  {Maxiter => 200, Eps => 1e-4,}, ifhref($opt) )
          };
 
+==> b1475 <==
+run_sub (
+         ->$blah{ say "ok 5" ; } ) ;
+
+run_sub (
+         ->$blah{ say "ok 5" ; } ) ;
+
+
 ==> b148 <==
 # state 1
 @yydgoto=(
index 31ee35ba99cbadc91727747aa35b21aa488c4459..db5d72592a265b1a09ce5826d7d8ec4aeac02a50 100644 (file)
@@ -15650,6 +15650,12 @@ sub keep_old_line_breaks {
             # leading '->' use a value of 2 which causes a soft
             # break rather than a hard break
             if ( $type eq '->' ) {
+
+                # ignore -bom after an opening token ( a syntax error, b1475 )
+                my $Kp = $self->K_previous_nonblank($Kfirst);
+                next if ( !defined($Kp) );
+                next if ( $is_opening_type{ $rLL->[$Kp]->[_TYPE_] } );
+
                 $rbreak_before_Kfirst->{$Kfirst} = 2;
             }