« /usr/local/lib/perl5/5.44.0/IO/Socket/IP.pm
↑ Summary
/usr/local/lib/perl5/5.44.0/Exporter/Heavy.pm »
| 1 | package re; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # pragma for controlling the regexp engine | ||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | our $VERSION = "0.48"; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | our @ISA = qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | our @EXPORT_OK = qw{ | ||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | is_regexp regexp_pattern | ||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | regname regnames regnames_count | ||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | regmust optimization | ||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | our %EXPORT_OK = map { $_ => 1 } @EXPORT_OK; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | my %bitmask = ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | taint => 0x00100000, # HINT_RE_TAINT | ||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | eval => 0x00200000, # HINT_RE_EVAL | ||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | my $flags_hint = 0x02000000; # HINT_RE_FLAGS | ||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | my $PMMOD_SHIFT = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | my %reflags = ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | m => 1 << ($PMMOD_SHIFT + 0), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | s => 1 << ($PMMOD_SHIFT + 1), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | i => 1 << ($PMMOD_SHIFT + 2), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | x => 1 << ($PMMOD_SHIFT + 3), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | xx => 1 << ($PMMOD_SHIFT + 4), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | n => 1 << ($PMMOD_SHIFT + 5), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | p => 1 << ($PMMOD_SHIFT + 6), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | strict => 1 << ($PMMOD_SHIFT + 10), | ||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # special cases: | ||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | d => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | l => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | u => 2, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | a => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | aa => 4, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | sub setcolor { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | eval { # Ignore errors | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setcolor: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | require Term::Cap; | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $terminal = Tgetent Term::Cap ({OSPEED => 9600}); # Avoid warning. | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | my $props = $ENV{PERL_RE_TC} || 'md,me,so,se,us,ue'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'PERL_RE_TC'} || 'md,me,so,se,us,ue'
MC/DC0%0/1
$ENV{'PERL_RE_TC'} || 'md,me,so,se,us,ue'
$ENV{'PERL_RE_TC'}
Truth table0%0/2
A
A= $ENV{'PERL_RE_TC'}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my @props = split /,/, $props; | |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $colors = join "\t", map {$terminal->Tputs($_,1)} @props; | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $colors =~ s/\0//g; | |||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $ENV{PERL_RE_COLORS} = $colors; | |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $ENV{PERL_RE_COLORS} ||= qq'\t\t> <\t> <\t\t'; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{"PERL_RE_COLORS"} ||= "\t\t> <\t> <\t\t"
MC/DC0%0/1
$ENV{"PERL_RE_COLORS"} ||= "\t\t> <\t> <\t\t"
$ENV{"PERL_RE_COLORS"}
Truth table0%0/2
A
A= $ENV{"PERL_RE_COLORS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | my %flags = ( | ||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | COMPILE => 0x0000FF, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | PARSE => 0x000001, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | OPTIMISE => 0x000002, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | TRIEC => 0x000004, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | DUMP => 0x000008, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | FLAGS => 0x000010, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | TEST => 0x000020, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | EXECUTE => 0x00FF00, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | INTUIT => 0x000100, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | MATCH => 0x000200, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | TRIEE => 0x000400, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | EXTRA => 0x3FF0000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | TRIEM => 0x0010000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | STATE => 0x0080000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | OPTIMISEM => 0x0100000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | STACK => 0x0280000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | BUFFERS => 0x0400000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | GPOS => 0x0800000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | DUMP_PRE_OPTIMIZE => 0x1000000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | WILDCARD => 0x2000000, | ||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | $flags{ALL} = -1 & ~($flags{BUFFERS} | ||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |$flags{DUMP_PRE_OPTIMIZE} | ||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |$flags{WILDCARD} | ||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | $flags{All} = $flags{all} = $flags{DUMP} | $flags{EXECUTE}; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | $flags{Extra} = $flags{EXECUTE} | $flags{COMPILE} | $flags{GPOS}; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | $flags{More} = $flags{MORE} = | ||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | $flags{All} | $flags{TRIEC} | $flags{TRIEM} | $flags{STATE}; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | $flags{State} = $flags{DUMP} | $flags{EXECUTE} | $flags{STATE}; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | $flags{TRIE} = $flags{DUMP} | $flags{EXECUTE} | $flags{TRIEC}; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | if (defined &DynaLoader::boot_DynaLoader) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | require XSLoader; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | XSLoader::load(); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # else we're miniperl | ||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # We need to work for miniperl, because the XS toolchain uses Text::Wrap, which | ||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # uses re 'taint'. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | sub _load_unload { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | my ($on)= @_; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_unload: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if ($on) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # We call install() every time, as if we didn't, we wouldn't | ||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # "see" any changes to the color environment var since | ||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # the last time it was called. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # install() returns an integer, which if casted properly | ||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # in C resolves to a structure containing the regexp | ||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # hooks. Setting it to a random integer will guarantee | ||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # segfaults. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $^H{regcomp} = install(); | |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | delete $^H{regcomp}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | sub bits { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | my $on = shift; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bits: not called CC=45 SCAR=76.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $bits = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | my $turning_all_off = ! @_ && ! $on; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
@_ || $on
MC/DC0%0/2
@_ || $on
@_
$on
Truth table0%0/3
A || B
A= @_B= $on
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $seen_Debug = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $seen_debug = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ($turning_all_off) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # Pretend were called with certain parameters, which are best dealt | ||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # with that way. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | push @_, keys %bitmask; # taint and eval | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | push @_, 'strict'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # Process each subpragma parameter | ||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | ARG: | ||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | foreach my $idx (0..$#_){ | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my $s=$_[$idx]; | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | if ($s eq 'Debug' or $s eq 'Debugcolor') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
Condition0%0/3
$s eq "Debug" or $s eq "Debugcolor"
MC/DC0%0/2
$s eq "Debug" or $s eq "Debugcolor"
$s eq "Debug"
$s eq "Debugcolor"
Truth table0%0/3
A or B
A= $s eq "Debug"B= $s eq "Debugcolor"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | if (! $seen_Debug) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $seen_Debug = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # Reset to nothing, and then add what follows. $seen_Debug | ||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # allows, though unlikely someone would do it, more than one | ||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | # Debug and flags in the arguments | ||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ${^RE_DEBUG_FLAGS} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | setcolor() if $s =~/color/i; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | for my $idx ($idx+1..$#_) { | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | if ($flags{$_[$idx]}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | if ($on) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ${^RE_DEBUG_FLAGS} |= $flags{$_[$idx]}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ${^RE_DEBUG_FLAGS} &= ~ $flags{$_[$idx]}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | Carp::carp("Unknown \"re\" Debug flag '$_[$idx]', possible flags: ", | |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | join(", ",sort keys %flags ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | _load_unload($on ? 1 : ${^RE_DEBUG_FLAGS}); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||
| 161 | ▶ | } elsif ($s eq 'debug' or $s eq 'debugcolor') { | |||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$s eq "debug" or $s eq "debugcolor"
MC/DC0%0/2
$s eq "debug" or $s eq "debugcolor"
$s eq "debug"
$s eq "debugcolor"
Truth table0%0/3
A or B
A= $s eq "debug"B= $s eq "debugcolor"
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # These default flags should be kept in sync with the same values | ||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | # in regcomp.h | ||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ${^RE_DEBUG_FLAGS} = $flags{'EXECUTE'} | $flags{'DUMP'}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | setcolor() if $s =~/color/i; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | _load_unload($on); | |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $seen_debug = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } elsif (exists $bitmask{$s}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $bits |= $bitmask{$s}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } elsif ($EXPORT_OK{$s}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | re->export_to_level(2, 're', $s); | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } elsif ($s eq 'strict') { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ($on) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $^H{reflags} |= $reflags{$s}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | warnings::warnif('experimental::re_strict', | |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | "\"use re 'strict'\" is experimental"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | # Turn on warnings if not already done. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | if (! warnings::enabled('regexp')) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | require warnings; | |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | warnings->import('regexp'); | |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $^H{re_strict} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | $^H{reflags} &= ~$reflags{$s} if $^H{reflags}; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # Turn off warnings if we turned them on. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | warnings->unimport('regexp') if $^H{re_strict}; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ($^H{reflags}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $^H |= $flags_hint; | |||||||||||||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $^H &= ~$flags_hint; | |||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | } elsif ($s =~ s/^\///) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | ▶ | my $reflags = $^H{reflags} || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$^H{'reflags'} || 0
MC/DC0%0/1
$^H{'reflags'} || 0
$^H{'reflags'}
Truth table0%0/2
A
A= $^H{'reflags'}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | my $seen_charset; | |||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $x_count = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | while ($s =~ m/( . )/gx) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | local $_ = $1; | |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if (/[adul]/) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | # The 'a' may be repeated; hide this from the rest of the | ||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # code by counting and getting rid of all of them, then | ||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | # changing to 'aa' if there is a repeat. | ||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if ($_ eq 'a') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $sav_pos = pos $s; | |||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my $a_count = $s =~ s/a//g; | |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | pos $s = $sav_pos - 1; # -1 because got rid of the 'a' | |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if ($a_count > 2) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | Carp::carp( | |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | qq 'The "a" flag may only appear a maximum of twice' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | elsif ($a_count == 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $_ = 'aa'; | |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | if ($on) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | ▶ | if ($seen_charset) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | if ($seen_charset ne $_) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | Carp::carp( | |||||||||||||||||||||||||||||||||||||||||||||||
| 228 | qq 'The "$seen_charset" and "$_" flags ' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | .qq 'are exclusive' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | Carp::carp( | |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | qq 'The "$seen_charset" flag may not appear ' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | .qq 'twice' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $^H{reflags_charset} = $reflags{$_}; | |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $seen_charset = $_; | |||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | delete $^H{reflags_charset} | ||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | if defined $^H{reflags_charset} | ||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | && $^H{reflags_charset} == $reflags{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $^H{"reflags_charset"} and $^H{"reflags_charset"} == $reflags{$_}
MC/DC0%0/2
defined $^H{"reflags_charset"} and $^H{"reflags_charset"} == $reflags{$_}
defined $^H{"reflags_charset"}
$^H{"reflags_charset"} == $reflags{$_}
Truth table0%0/3
A and B
A= defined $^H{"reflags_charset"}B= $^H{"reflags_charset"} == $reflags{$_}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } elsif (exists $reflags{$_}) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | if ($_ eq 'x') { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $x_count++; | |||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if ($x_count > 2) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | Carp::carp( | |||||||||||||||||||||||||||||||||||||||||||||||
| 253 | qq 'The "x" flag may only appear a maximum of twice' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | elsif ($x_count == 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $_ = 'xx'; # First time through got the /x | |||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | $on | ||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | ? $reflags |= $reflags{$_} | ||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | : ($reflags &= ~$reflags{$_}); | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | Carp::carp( | |||||||||||||||||||||||||||||||||||||||||||||||
| 267 | qq'Unknown regular expression flag "$_"' | ||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | next ARG; | |||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | ($^H{reflags} = $reflags or defined $^H{reflags_charset}) | ||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | ? $^H |= $flags_hint | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$^H{"reflags"} = $reflags or defined $^H{"reflags_charset"}
MC/DC0%0/2
$^H{"reflags"} = $reflags or defined $^H{"reflags_charset"}
$^H{"reflags"} = $reflags
defined $^H{"reflags_charset"}
Truth table0%0/3
A or B
A= $^H{"reflags"} = $reflagsB= defined $^H{"reflags_charset"}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | : ($^H &= ~$flags_hint); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | if ($seen_debug && defined $flags{$s}) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$seen_debug and defined $flags{$s}
MC/DC0%0/2
$seen_debug and defined $flags{$s}
$seen_debug
defined $flags{$s}
Truth table0%0/3
A and B
A= $seen_debugB= defined $flags{$s}
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | Carp::carp("Use \"Debug\" not \"debug\", to list debug types" | |||||||||||||||||||||||||||||||||||||||||||||||
| 279 | . " in \"re\". \"$s\" ignored"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | Carp::carp("Unknown \"re\" subpragma '$s' (known ones are: ", | ||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | join(', ', map {qq('$_')} 'debug', 'debugcolor', sort keys %bitmask), | |||||||||||||||||||||||||||||||||||||||||||||||
| 284 | ")"); | ||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if ($turning_all_off) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | _load_unload(0); | |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $^H{reflags} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $^H{reflags_charset} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $^H &= ~$flags_hint; | |||||||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | $bits; | |||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | sub import { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | shift; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | $^H |= bits(1, @_); | |||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | sub unimport { | ||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | shift; | ||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unimport: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | $^H &= ~ bits(0, @_); | |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||