forked from Perl/perl5
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
regcomp.pl - fixup intflags debug data to handle gaps properly
We were not handling gaps in the sequence properly, and effectively showing the wrong flag names or missing the last flag. Now we die if there are any collisions or if any of the PREGf defines set more than one bit. This also adds some crude tests to validate that intflags serialization is working properly. Note, extflags handles more complex scenarios and seems to handle this gracefully already, hence the reason I haven't touched it as well. This also tweaks a comment in lexical_debug.t which part of this was cribbed from.
- Loading branch information
Showing
7 changed files
with
79 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use re 'Debug' => qw(DUMP FLAGS); | ||
our $count; | ||
my $code= '(?{$count++})'; | ||
my @p= ( | ||
qr/(foo)(?1)?/, | ||
qr/\Gfoo/, | ||
qr/.*foo/, | ||
qr/^foo/, | ||
qr/(foo(*THEN)bar|food)/, | ||
qr/a.*b.*/, | ||
qr/a{1,4}\Gfoo/, | ||
qr/a+/, | ||
do { use re 'eval'; qr/a$code/}, | ||
); | ||
|
||
print STDERR "-OK-\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!./perl | ||
|
||
BEGIN { | ||
require Config; | ||
if (($Config::Config{'extensions'} !~ /\bre\b/) ){ | ||
print "1..0 # Skip -- Perl configured without re module\n"; | ||
exit 0; | ||
} | ||
} | ||
|
||
use strict; | ||
|
||
# must use a BEGIN or the prototypes wont be respected meaning | ||
# tests could pass that shouldn't. | ||
BEGIN { require "../../t/test.pl"; } | ||
my $out = runperl(progfile => "t/intflags.pl", stderr => 1 ); | ||
like($out,qr/-OK-\n/, "intflags.pl ran to completion"); | ||
|
||
my %seen; | ||
foreach my $line (split /\n/, $out) { | ||
$line=~s/^r->intflags:\s+// or next; | ||
length($_) and $seen{$_}++ for split /\s+/, $line; | ||
} | ||
is(0+keys %seen,14); | ||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters