Skip to content

Commit 51303bd

Browse files
Less recursion
Perl/perl5#20530 is recommended though
1 parent 5980b21 commit 51303bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

parse.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ sub waitforid {
690690
#use re qw(Debug EXECUTE);
691691
#CORE::print("here1\n");
692692
$regexstr = $_[0];
693-
$regex = qr{(?(DEFINE)$regexstr)\G\s*+(?&cprogram)}sxx;
693+
$regex = qr{(?(DEFINE)$regexstr)\G\s*+((?&cprogram)(?(?{pos() >= $nextpos})(*ACCEPT)))*+}sxx;
694694
$subject = $_[1];
695695
$fasterregex = $_[2];
696696
$threadid = $_[3];
@@ -874,7 +874,7 @@ sub waitforid {
874874
#$silent = 1;
875875
CORE::print ("retrying...");
876876

877-
$regex = eval { use re qw(Debug EXECUTE); qr{(?(DEFINE)$regexstr)\G\s*+(?&cprogram)}sxx; };
877+
$regex = eval { use re qw(Debug EXECUTE); qr{(?(DEFINE)$regexstr)\G\s*+((?&cprogram)(?(?{pos() >= $nextpos})(*ACCEPT)))*+}sxx; };
878878
}
879879
$tryingagainlocal = 1;
880880
$entertryagain = 0;
@@ -996,7 +996,7 @@ sub waitforid {
996996
my $tryagain = 2;
997997
my $lasrtypedefobj = {%{$typedefidentifiersvector->[0]}};
998998
my $lastposcurrlast = 0;
999-
my $compreg = qr{$initseqlight\G\s*+(?<globaloutter>(?<globalinner>(?&fasterdecls))*+((?&globalinner)(?&globaloutter))?+)}sxx;
999+
my $compreg = qr{$initseqlight\G\s*+(?&fasterdecls)*+}sxx;
10001000

10011001
#while(1) {
10021002
{
@@ -1023,7 +1023,7 @@ sub waitforid {
10231023
}
10241024
elsif($tryagain++ == 1) {
10251025
use re qw(Debug EXECUTE);
1026-
$compreg = qr{(?(DEFINE)$finitseqlight)\G\s*+(?<globaloutter>(?<globalinner>(?&fasterdecls))*+((?&globalinner)(?&globaloutter))?+)}sxx;
1026+
$compreg = qr{(?(DEFINE)$finitseqlight)\G\s*+(?&fasterdecls)*+}sxx;
10271027
#CORE::print("trying again with debug\n" . $initseqlight );
10281028
pos($subject) = $lastposcurrlast;
10291029
goto tryagain_main

0 commit comments

Comments
 (0)