Skip to content

Commit 0d92c50

Browse files
Changes
1 parent be65572 commit 0d92c50

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

parse.pl

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,19 @@ sub waitforid {
10971097
#pos($subject) = $+[0];
10981098
my $typedeffound;
10991099
my $taggablefound;
1100-
while(1) {
1100+
#while(1) {
1101+
my sub push_decl {
1102+
my $lastposend = $_[0];
1103+
my $possibleidentlocal = $_[1];
1104+
lock $identstoidmap;
1105+
if (not exists $identstoidmap->{$possibleidentlocal}) {
1106+
$identstoidmap->{$possibleidentlocal} = shared_clone([[$lastposend, 0]])
1107+
}
1108+
else {
1109+
lock (@{$identstoidmap->{$possibleidentlocal}});
1110+
push @{$identstoidmap->{$possibleidentlocal}}, shared_clone([$lastposend, 0]);
1111+
}
1112+
}
11011113
my $posident;
11021114
my $possibleident;
11031115
my $wasinside = 0;
@@ -1118,14 +1130,7 @@ sub waitforid {
11181130
pos($subject) = $+[0];
11191131
if ($subject =~ m{$typeorqualifsreg$initseqlight\G(?&brackets)\s*+}sxx) {
11201132
pos($subject) = $+[0];
1121-
lock $identstoidmap;
1122-
if (not exists $identstoidmap->{$possibleidentlocal}) {
1123-
$identstoidmap->{$possibleidentlocal} = shared_clone([[$lastposend, 0]])
1124-
}
1125-
else {
1126-
lock (@{$identstoidmap->{$possibleidentlocal}});
1127-
push @{$identstoidmap->{$possibleidentlocal}}, shared_clone([$lastposend, 0]);
1128-
}
1133+
push_decl($lastposend, $possibleidentlocal)
11291134
#lock %{$identstoidmap->{$possibleidentlocal}};
11301135
#lock $identstoidmap->{$possibleident};
11311136
#CORE::print("tag setting $possibleidentlocal @ $lastposend\n");
@@ -1144,7 +1149,7 @@ sub waitforid {
11441149
}
11451150
}
11461151

1147-
if (!$possibleident) {
1152+
my sub register_decl_shallow {
11481153
if ($subject =~ m{$typeorqualifsreg$initseqlight\G\s*+(?&ptr)*+((?&rndbrcksdecl)|\K(?<identnormal>(?&identifierpure)))\s*+}sxx) {
11491154
pos($subject) = $+[0];
11501155
if (not exists $+{identnormal}) {
@@ -1160,39 +1165,43 @@ sub waitforid {
11601165
}
11611166
}
11621167

1168+
if (!$possibleident) {
1169+
register_decl_shallow
1170+
}
1171+
11631172
if (!$possibleident and not $taggablefound) {
11641173
CORE::print ("2 failed near ??" . pos($subject) . "\n");
11651174
exit
11661175
}
11671176
elsif($possibleident) {
1168-
lock $identstoidmap;
1169-
if (not exists $identstoidmap->{$possibleident}) {
1170-
$identstoidmap->{$possibleident} = shared_clone([[$lastposend, 0]])
1171-
}
1172-
else {
1173-
lock (@{$identstoidmap->{$possibleident}});
1174-
push @{$identstoidmap->{$possibleident}}, shared_clone([$lastposend, 0]);
1175-
}
1177+
push_decl($lastposend, $possibleident);
11761178
#lock %{$identstoidmap->{$possibleident}};
11771179
#lock $identstoidmap->{$possibleident};
11781180
#CORE::print("setting $possibleident - $lastposend\n");
11791181
#$identstoidmap->{$possibleident}->{(scalar($lastposend))} = 0;
11801182
register_decl({'ident'=>$possibleident, 'typedefkey'=>($matches[-1]{typedefkey})}, 1);
11811183
}
11821184

1183-
pop2 \@matches;
1184-
pop2 \@flags;
1185-
11861185
pos($subject) = $+[0] if ($subject =~ m{$typeorqualifsreg$initseqlight\G(\s*+(?&parens)\s*+)*+}sxx);
11871186

1188-
last if (!($subject =~ m{\G\s*+,\s*+}sxx));
1187+
while ($subject =~ m{$typeorqualifsreg$initseqlight\G\s*+,\s*+(?&ptr)*+((?&rndbrcksdecl)|\K(?<identnormal>(?&identifierpure)))\s*+}sxx) {
1188+
pos($subject) = $+[0];
1189+
my $possibleidentlocal;
1190+
register_decl_shallow();
1191+
push_decl($lastposend, $possibleidentlocal);
1192+
register_decl({'ident'=>$possibleident, 'typedefkey'=>($matches[-1]{typedefkey})}, 1);
1193+
pos($subject) = $+[0] if ($subject =~ m{$typeorqualifsreg$initseqlight\G(\s*+(?&parens)\s*+)*+}sxx);
1194+
}
11891195

1190-
pos($subject) = $+[0];
1196+
pop2 \@matches;
1197+
pop2 \@flags;
1198+
1199+
#pos($subject) = $+[0];
11911200

11921201
undef $possibleident;
11931202
undef $typedeffound;
11941203
undef $taggablefound;
1195-
}
1204+
#}
11961205
}
11971206

11981207
if ($shouldstorelast) {

0 commit comments

Comments
 (0)