@@ -1977,21 +1977,25 @@ sub raw_line {
1977
1977
$cnt ++;
1978
1978
1979
1979
my $line ;
1980
+ my $consumed ;
1980
1981
while ($cnt ) {
1981
1982
$line = $rawlines [$offset ++];
1983
+ $consumed ++;
1982
1984
next if (defined ($line ) && $line =~ / ^-/ );
1983
1985
$cnt --;
1984
1986
}
1985
1987
1986
- return $line ;
1988
+ return ( $line , $consumed ) ;
1987
1989
}
1988
1990
1989
1991
sub get_stat_real {
1990
1992
my ($linenr , $lc ) = @_ ;
1991
1993
1992
- my $stat_real = raw_line($linenr , 0);
1994
+ my ( $stat_real , $consumed ) = raw_line($linenr , 0);
1993
1995
for (my $count = $linenr + 1; $count <= $lc ; $count ++) {
1994
- $stat_real = $stat_real . " \n " . raw_line($count , 0);
1996
+ my ($more , $consumed ) = raw_line($count , 0);
1997
+ $stat_real = $stat_real . " \n " . $more ;
1998
+ $count += $consumed - 1;
1995
1999
}
1996
2000
1997
2001
return $stat_real ;
@@ -2002,7 +2006,8 @@ sub get_stat_here {
2002
2006
2003
2007
my $herectx = $here . " \n " ;
2004
2008
for (my $n = 0; $n < $cnt ; $n ++) {
2005
- $herectx .= raw_line($linenr , $n ) . " \n " ;
2009
+ my ($more , $consumed ) = raw_line($linenr , $n );
2010
+ $herectx .= $more . " \n " ;
2006
2011
}
2007
2012
2008
2013
return $herectx ;
@@ -4373,7 +4378,7 @@ sub process {
4373
4378
}
4374
4379
4375
4380
my (undef , $sindent ) = line_stats(" +" . $s );
4376
- my $stat_real = raw_line($linenr , $cond_lines );
4381
+ my ( $stat_real , $consumed ) = raw_line($linenr , $cond_lines );
4377
4382
4378
4383
# Check if either of these lines are modified, else
4379
4384
# this is not this patch's fault.
@@ -5470,7 +5475,7 @@ sub process {
5470
5475
$herectx = $here . " \n " ;
5471
5476
my $cnt = statement_rawlines($if_stat );
5472
5477
for (my $n = 0; $n < $cnt ; $n ++) {
5473
- my $rl = raw_line($linenr , $n );
5478
+ my ( $rl , $consumed ) = raw_line($linenr , $n );
5474
5479
$herectx .= $rl . " \n " ;
5475
5480
last if $rl =~ / ^[ \+ ].*\{ / ;
5476
5481
}
@@ -5667,8 +5672,9 @@ sub process {
5667
5672
my $cond_lines = 1 + $#newlines ;
5668
5673
my $stat_real = ' ' ;
5669
5674
5670
- $stat_real = raw_line($linenr , $cond_lines )
5671
- . " \n " if ($cond_lines );
5675
+ my $consumed ;
5676
+ ($stat_real , $consumed ) = raw_line($linenr , $cond_lines )
5677
+ . " \n " if ($cond_lines );
5672
5678
if (defined ($stat_real ) && $cond_lines > 1) {
5673
5679
$stat_real = " [...]\n $stat_real " ;
5674
5680
}
@@ -7074,7 +7080,7 @@ sub process {
7074
7080
my $cnt = statement_rawlines($stat );
7075
7081
my $herectx = $here . " \n " ;
7076
7082
for (my $n = 0; $n < $cnt ; $n ++) {
7077
- my $rl = raw_line($linenr , $n );
7083
+ my ( $rl , $consumed ) = raw_line($linenr , $n );
7078
7084
$herectx .= $rl . " \n " ;
7079
7085
$ok = 1 if ($rl =~ / ^[ \+ ]\{ / );
7080
7086
$ok = 1 if ($rl =~ / \{ / && $n == 0);
0 commit comments