| 1 | package Search::Elasticsearch::Compat::QueryParser; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | $Search::Elasticsearch::Compat::QueryParser::VERSION = '0.10'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Search::Elasticsearch::Util qw(parse_params throw); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Scalar::Util qw(weaken); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | @Search::Elasticsearch::Error::QueryParser::ISA | ||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | = 'Search::Elasticsearch::Error'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | # ABSTRACT: Check or filter query strings | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | my ( $proto, $params ) = parse_params(@_); | |||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | my $class = ref $proto || $proto; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table66%2/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | $params = { | |||||||||||||||||||||||||||||||||||||||||
| 19 | escape_reserved => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | fields => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 21 | wildcard_prefix => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 22 | allow_bool => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 23 | allow_boost => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | allow_fuzzy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 25 | allow_slop => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 26 | allow_ranges => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 27 | %$params, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 2 | return bless { | |||||||||||||||||||||||||||||||||||||||||
| 30 | _default_opts => $params, | ||||||||||||||||||||||||||||||||||||||||||
| 31 | _opts => $params, | ||||||||||||||||||||||||||||||||||||||||||
| 32 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 97 | ▶ | sub filter { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
filter: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 97 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 97 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 40 | 97 | my ( undef, $opts ) = parse_params( $self, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 41 | 97 | $opts->{fix} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 97 | return $self->_parse( $text, $opts ); | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 97 | ▶ | sub check { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 97 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 97 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 97 | my ( undef, $opts ) = parse_params( $self, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 51 | 97 | $opts->{fix} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 97 | return $self->_parse( $text, $opts ); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 194 | ▶ | sub _parse { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 58 | 194 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 194 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 194 | ▶ | $text = '' unless defined $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 194 | utf8::upgrade($text); | |||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 194 | my $opts = shift; | |||||||||||||||||||||||||||||||||||||||||
| 64 | 194 | $self->{_opts} = { %{ $self->{_default_opts} }, %$opts }; | |||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | 194 | $self->{_tokeniser} = $self->_init_tokeniser($text); | |||||||||||||||||||||||||||||||||||||||||
| 67 | 194 | $self->{_tokens} = []; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 194 | $self->{_stack} = [ {} ]; | |||||||||||||||||||||||||||||||||||||||||
| 69 | 194 | $self->{_start_pos} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 70 | 194 | $self->{_done} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 194 | my $phrase; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 194 | eval { | |||||||||||||||||||||||||||||||||||||||||
| 74 | 194 | $phrase = $self->_multi_clauses; | |||||||||||||||||||||||||||||||||||||||||
| 75 | die "Syntax error\n" | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 144 | ▶ | unless $self->{_done} || $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->{"_done"} or $opts->{"fix"}
MC/DC50%1/2
$self->{"_done"} or $opts->{"fix"}
$self->{"_done"}
$opts->{"fix"}
Truth table66%2/3
A or B
A= $self->{"_done"}B= $opts->{"fix"}
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 194 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 58 | $@ =~ s/\n$/:\n/; | |||||||||||||||||||||||||||||||||||||||||
| 80 | 58 | substr( $text, $self->{_start_pos}, 0, ' <HERE> ' ); | |||||||||||||||||||||||||||||||||||||||||
| 81 | 58 | throw( 'QueryParser', "$@$text" ); | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 136 | return $phrase; | |||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub _dump_tokens { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump_tokens: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $text = '' unless defined $text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | utf8::upgrade($text); | |||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $tokeniser = $self->_init_tokeniser($text); | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | while ( my $next = $tokeniser->() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | printf "TOKEN: %-15s VARS: %s\n", shift @$next, | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | join( ', ', grep { defined $_ } @$next ); | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 1140 | ▶ | sub _next_token { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_next_token: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 1140 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 1140 | my $next = shift @{ $self->{_tokens} } | |||||||||||||||||||||||||||||||||||||||||
| 107 | 1140 | ▶ | || $self->{_tokeniser}->(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
shift @{$$self{'_tokens'};} || $self->{'_tokeniser'}->()
MC/DC100%2/2
shift @{$$self{'_tokens'};} || $self->{'_tokeniser'}->()
shift @{$$self{'_tokens'};}
$self->{'_tokeniser'}->()
Truth table100%3/3
A || B
A= shift @{$$self{'_tokens'};}B= $self->{'_tokeniser'}->()
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 1140 | ▶ | return $next if $next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 257 | $self->{_done} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 257 | return; | |||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 174 | ▶ | sub _return_token { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_return_token: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 174 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 174 | push @{ $self->{_tokens} }, shift; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 174 | $self->{_done} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | # 1 = Can follow | ||||||||||||||||||||||||||||||||||||||||||
| 122 | # 0 = Cannot follow, drop token and try next token | ||||||||||||||||||||||||||||||||||||||||||
| 123 | # undef = Cannot follow, stop looking | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | my %Clauses = ( | |||||||||||||||||||||||||||||||||||||||||
| 126 | _LPAREN => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 127 | _PLUS_MINUS => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 128 | _EXISTS => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 129 | _FIELD => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 130 | _TERM => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 131 | _PHRASE => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 132 | _WILDTERM => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 133 | _RANGE => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 134 | _NOT => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 135 | _AND_OR => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | _SPACE => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 137 | _RESERVED => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 138 | _ESCAPE => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 139 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 1 | my %Boost = ( _BOOST => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | my %Allowed = ( | |||||||||||||||||||||||||||||||||||||||||
| 144 | _CLAUSE => \%Clauses, | ||||||||||||||||||||||||||||||||||||||||||
| 145 | _LPAREN => { %Clauses, _RPAREN => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 146 | _AND_OR => { %Clauses, _AND_OR => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 147 | _NOT => { %Clauses, _NOT => 0, _AND_OR => 0 }, | ||||||||||||||||||||||||||||||||||||||||||
| 148 | _PLUS_MINUS => { | ||||||||||||||||||||||||||||||||||||||||||
| 149 | %Clauses, | ||||||||||||||||||||||||||||||||||||||||||
| 150 | _NOT => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 151 | _AND_OR => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 152 | _PLUS_MINUS => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 153 | _SPACE => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 154 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 155 | _FIELD => { | ||||||||||||||||||||||||||||||||||||||||||
| 156 | _LPAREN => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 157 | _TERM => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 158 | _WILDTERM => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 159 | _PHRASE => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 160 | _RANGE => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 161 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 162 | _PHRASE => { _BOOST => 1, _FUZZY => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 163 | _TERM => { _BOOST => 1, _FUZZY => 1 }, | ||||||||||||||||||||||||||||||||||||||||||
| 164 | _WILDTERM => \%Boost, | ||||||||||||||||||||||||||||||||||||||||||
| 165 | _RANGE => \%Boost, | ||||||||||||||||||||||||||||||||||||||||||
| 166 | _FUZZY => \%Boost, | ||||||||||||||||||||||||||||||||||||||||||
| 167 | _RPAREN => \%Boost, | ||||||||||||||||||||||||||||||||||||||||||
| 168 | _EXISTS => \%Boost, | ||||||||||||||||||||||||||||||||||||||||||
| 169 | _BOOST => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 170 | _SPACE => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 171 | _RESERVED => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 172 | _ESCAPE => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 173 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 942 | ▶ | sub _parse_context { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_context: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 178 | 942 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 942 | my $context = shift; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 942 | my $allowed = $Allowed{$context}; | |||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||
| 182 | TOKEN: { | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 942 | ▶ | my $token = $self->_next_token or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 856 | my ( $type, @args ) = @$token; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 856 | ▶ | if ( $allowed->{$type} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 666 | ▶ | redo TOKEN if $type eq '_SPACE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 506 | return $self->$type(@args); | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | elsif ( defined $allowed->{$type} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 17 | ▶ | die "Syntax error\n" unless $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 9 | redo TOKEN; | |||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 173 | $self->_return_token($token); | |||||||||||||||||||||||||||||||||||||||||
| 196 | 173 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 214 | ▶ | sub _multi_clauses { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_multi_clauses: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 203 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 214 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 214 | my @clauses; | |||||||||||||||||||||||||||||||||||||||||
| 206 | 214 | while (1) { | |||||||||||||||||||||||||||||||||||||||||
| 207 | 515 | my $clause = $self->_parse_context('_CLAUSE'); | |||||||||||||||||||||||||||||||||||||||||
| 208 | 465 | ▶ | if ( !defined $clause ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | last | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 173 | if @{ $self->{_stack} } > 1 | |||||||||||||||||||||||||||||||||||||||||
| 211 | || !$self->{_opts}{fix} | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 173 | ▶ | || $self->{_done}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
@{$self->{"_stack"};} > 1 or not $self->{"_opts"}{"fix"} or $self->{"_done"}
@{$self->{"_stack"};} > 1 or not $self->{"_opts"}{"fix"}
MC/DC100%3/3
@{$self->{"_stack"};} > 1 or not $self->{"_opts"}{"fix"} or $self->{"_done"}
@{$self->{"_stack"};} > 1
not $self->{"_opts"}{"fix"}
$self->{"_done"}
Truth table100%4/4
A or not(B) or C
A= @{$self->{"_stack"};} > 1B= not $self->{"_opts"}{"fix"}C= $self->{"_done"}
| |||||||||||||||||||||||||||||||||||||||||||
| 213 | 9 | $self->_next_token; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 9 | next; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 292 | ▶ | next unless length $clause; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 264 | push @clauses, $clause; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 264 | $self->{_stack}[-1]{clauses}++; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 164 | return join( ' ', @clauses ); | |||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 45 | ▶ | sub _AND_OR { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_AND_OR: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 45 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 45 | my $op = shift; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 45 | my $opts = $self->{_opts}; | |||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | 45 | ▶ | unless ( $self->{_stack}[-1]{clauses} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 8 | ▶ | return '' if $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 4 | die "$op must be preceded by another clause\n"; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 37 | ▶ | unless ( $opts->{allow_bool} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | ▶ | die qq("$op" not allowed) unless $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 2 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | 34 | my $next = $self->_parse_context('_AND_OR'); | |||||||||||||||||||||||||||||||||||||||||
| 240 | 30 | ▶ | return "$op $next" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $next and length $next
MC/DC50%1/2
defined $next and length $next
defined $next
length $next
Truth table66%2/3
A and B
A= defined $nextB= length $next
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | if defined $next && length $next; | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 4 | ▶ | return '' if $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 2 | die "$op must be followed by a clause\n"; | |||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 248 | 27 | ▶ | sub _NOT { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_NOT: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 27 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 27 | my $op = shift; | |||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 27 | my $opts = $self->{_opts}; | |||||||||||||||||||||||||||||||||||||||||
| 254 | 27 | ▶ | unless ( $opts->{allow_bool} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 3 | ▶ | die qq("$op" not allowed) unless $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | 2 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 24 | my $next = $self->_parse_context('_NOT'); | |||||||||||||||||||||||||||||||||||||||||
| 260 | 21 | ▶ | $next = '' unless defined $next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | die "$op cannot be followed by + or -" | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 21 | ▶ | if $next =~ s/^[+-]+// && !$opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$next =~ s/^[+-]+// and not $opts->{"fix"}
MC/DC100%2/2
$next =~ s/^[+-]+// and not $opts->{"fix"}
$next =~ s/^[+-]+//
not $opts->{"fix"}
Truth table100%3/3
A and not(B)
A= $next =~ s/^[+-]+//B= not $opts->{"fix"}
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 20 | ▶ | return "$op $next" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | if length $next; | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 4 | ▶ | return '' if $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | die "$op must be followed by a clause\n"; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 273 | 21 | ▶ | sub _PLUS_MINUS { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PLUS_MINUS: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 21 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 21 | my $op = shift; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 21 | my $next = $self->_parse_context('_PLUS_MINUS'); | |||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 20 | ▶ | return "$op$next" if defined $next && length $next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $next and length $next
MC/DC50%1/2
defined $next and length $next
defined $next
length $next
Truth table66%2/3
A and B
A= defined $nextB= length $next
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 3 | ▶ | return '' if $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 1 | die "$op must be followed by a clause"; | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||
| 285 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 20 | ▶ | sub _LPAREN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_LPAREN: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 289 | 20 | push @{ $self->{_stack} }, {}; | |||||||||||||||||||||||||||||||||||||||||
| 290 | 20 | my $clause = $self->_multi_clauses; | |||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 20 | my $close = ')'; | |||||||||||||||||||||||||||||||||||||||||
| 293 | 20 | my $rparen = $self->_next_token; | |||||||||||||||||||||||||||||||||||||||||
| 294 | 20 | ▶ | if ( $rparen && $rparen->[0] eq '_RPAREN' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$rparen and $rparen->[0] eq "_RPAREN"
MC/DC50%1/2
$rparen and $rparen->[0] eq "_RPAREN"
$rparen
$rparen->[0] eq "_RPAREN"
Truth table66%2/3
A and B
A= $rparenB= $rparen->[0] eq "_RPAREN"
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | 18 | ▶ | my $next = $self->_parse_context('_RPAREN') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_parse_context('_RPAREN') || ''
MC/DC100%1/1
$self->_parse_context('_RPAREN') || ''
$self->_parse_context('_RPAREN')
Truth table100%2/2
A
A= $self->_parse_context('_RPAREN')
| |||||||||||||||||||||||||||||||||||||||||||
| 296 | 18 | ▶ | $close .= $next if $next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | 18 | pop @{ $self->{_stack} }; | |||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||
| 299 | elsif ( $self->{_opts}{fix} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 300 | 1 | $self->_return_token($rparen); | |||||||||||||||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||||||||||||||||
| 302 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 1 | die "Missing closing parenthesis\n"; | |||||||||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 19 | ▶ | return $clause ? "(${clause}${close}" : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 309 | 46 | ▶ | sub _BOOST { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_BOOST: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 311 | 46 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 46 | ▶ | unless ( $self->{_opts}{allow_boost} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 7 | ▶ | die "Boost not allowed" unless $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 4 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 39 | my $val = shift; | |||||||||||||||||||||||||||||||||||||||||
| 317 | 39 | ▶ | unless ( defined $val && length $val ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $val and length $val
MC/DC50%1/2
defined $val and length $val
defined $val
length $val
Truth table66%2/3
A and B
A= defined $valB= length $val
| |||||||||||||||||||||||||||||||||||||||||||
| 318 | 4 | ▶ | return '' if $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | die "Missing boost value\n"; | |||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 35 | return "^$val"; | |||||||||||||||||||||||||||||||||||||||||
| 322 | } | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 40 | ▶ | sub _FUZZY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_FUZZY: called CC=12 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 40 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 328 | 40 | my $fuzzy = shift; | |||||||||||||||||||||||||||||||||||||||||
| 329 | 40 | my $opts = $self->{_opts}; | |||||||||||||||||||||||||||||||||||||||||
| 330 | 40 | my $fix = $opts->{fix}; | |||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 40 | ▶ | if ( $self->{current} eq '_PHRASE' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | # phrase slop | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 21 | ▶ | if ( $opts->{allow_slop} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 17 | ▶ | $fuzzy = int( $fuzzy || 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$fuzzy || 0
MC/DC100%1/1
$fuzzy || 0
$fuzzy
Truth table100%2/2
A
A= $fuzzy
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | 17 | ▶ | $fuzzy = $fuzzy ? "~$fuzzy" : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 4 | ▶ | die "Phrase slop not allowed\n" unless $fix; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | $fuzzy = ''; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | # fuzzy | ||||||||||||||||||||||||||||||||||||||||||
| 347 | 19 | ▶ | if ( $opts->{allow_fuzzy} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 15 | ▶ | if ( defined $fuzzy ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 11 | ▶ | if ( $fuzzy <= 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 9 | $fuzzy = "~$fuzzy"; | |||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 353 | 2 | ▶ | die "Fuzzy value must be between 0.0 and 1.0\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 354 | unless $fix; | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 1 | $fuzzy = ''; | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 4 | $fuzzy = '~'; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 4 | ▶ | die "Fuzzy not allowed\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | unless $fix; | ||||||||||||||||||||||||||||||||||||||||||
| 365 | 2 | $fuzzy = ''; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 35 | ▶ | my $next = $self->_parse_context('_FUZZY') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_parse_context('_FUZZY') || ''
MC/DC100%1/1
$self->_parse_context('_FUZZY') || ''
$self->_parse_context('_FUZZY')
Truth table100%2/2
A
A= $self->_parse_context('_FUZZY')
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 33 | return "$fuzzy$next"; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 28 | ▶ | sub _PHRASE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_PHRASE: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 375 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 376 | 28 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 377 | 28 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 28 | local $self->{current} = '_PHRASE'; | |||||||||||||||||||||||||||||||||||||||||
| 380 | 28 | ▶ | my $next = $self->_parse_context('_PHRASE') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_parse_context('_PHRASE') || ''
MC/DC100%1/1
$self->_parse_context('_PHRASE') || ''
$self->_parse_context('_PHRASE')
Truth table100%2/2
A
A= $self->_parse_context('_PHRASE')
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 25 | return qq("$string"$next); | |||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||
| 385 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 386 | 14 | ▶ | sub _EXISTS { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_EXISTS: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 14 | my $prefix = shift; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 14 | my $field = shift; | |||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 14 | my $opts = $self->{_opts}; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 14 | ▶ | my $next = $self->_parse_context('_EXISTS') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_parse_context('_EXISTS') || ''
MC/DC100%1/1
$self->_parse_context('_EXISTS') || ''
$self->_parse_context('_EXISTS')
Truth table100%2/2
A
A= $self->_parse_context('_EXISTS')
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 14 | ▶ | unless ( $opts->{fields} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$opts->{"fields"} and !ref($opts->{"fields"}) || $opts->{"fields"}{$field}
not ref $opts->{"fields"} or $opts->{"fields"}{$field}
MC/DC100%3/3
$opts->{"fields"} and !ref($opts->{"fields"}) || $opts->{"fields"}{$field}
$opts->{"fields"}
not ref $opts->{"fields"}
$opts->{"fields"}{$field}
Truth table100%4/4
A and not(B) or C
A= $opts->{"fields"}B= not ref $opts->{"fields"}C= $opts->{"fields"}{$field}
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | and ( !ref $opts->{fields} || $opts->{fields}{$field} ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 396 | { | ||||||||||||||||||||||||||||||||||||||||||
| 397 | 5 | ▶ | return '' if $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 2 | die qq("Field "$field" not allowed); | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 9 | ▶ | return "$prefix:$field$next" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | if $field; | ||||||||||||||||||||||||||||||||||||||||||
| 403 | 3 | ▶ | return '' if $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | die "Missing field name for $prefix\n"; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 18 | ▶ | sub _FIELD { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_FIELD: called CC=8 SCAR=22.1
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 410 | 18 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 411 | 18 | my $field = shift; | |||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||
| 413 | 18 | my $opts = $self->{_opts}; | |||||||||||||||||||||||||||||||||||||||||
| 414 | 18 | my $next = $self->_parse_context('_FIELD'); | |||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | 18 | ▶ | unless ( defined $next && length $next ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $next and length $next
MC/DC0%0/2
defined $next and length $next
defined $next
length $next
Truth table33%1/3
A and B
A= defined $nextB= length $next
| |||||||||||||||||||||||||||||||||||||||||||
| 417 | die "Missing clause after field $field\n" | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | unless $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | return "$field:$next" | ||||||||||||||||||||||||||||||||||||||||||
| 423 | if $opts->{fields} | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 18 | ▶ | and !ref $opts->{fields} || $opts->{fields}{$field}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$opts->{"fields"} and !ref($opts->{"fields"}) || $opts->{"fields"}{$field}
not ref $opts->{"fields"} or $opts->{"fields"}{$field}
MC/DC100%3/3
$opts->{"fields"} and !ref($opts->{"fields"}) || $opts->{"fields"}{$field}
$opts->{"fields"}
not ref $opts->{"fields"}
$opts->{"fields"}{$field}
Truth table100%4/4
A and not(B) or C
A= $opts->{"fields"}B= not ref $opts->{"fields"}C= $opts->{"fields"}{$field}
| |||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | die qq("Field "$field" not allowed) | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 10 | ▶ | unless $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | 5 | return $next; | |||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 433 | 196 | ▶ | sub _TERM { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_TERM: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 435 | 196 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 436 | 196 | local $self->{current} = '_TERM'; | |||||||||||||||||||||||||||||||||||||||||
| 437 | 196 | ▶ | my $next = $self->_parse_context('_TERM') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_parse_context('_TERM') || ''
MC/DC100%1/1
$self->_parse_context('_TERM') || ''
$self->_parse_context('_TERM')
Truth table100%2/2
A
A= $self->_parse_context('_TERM')
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 189 | return shift(@_) . $next; | |||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 442 | 13 | ▶ | sub _WILDTERM { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_WILDTERM: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 13 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 445 | 13 | my $term = shift; | |||||||||||||||||||||||||||||||||||||||||
| 446 | 13 | my $min = $self->{_opts}{wildcard_prefix}; | |||||||||||||||||||||||||||||||||||||||||
| 447 | 13 | ▶ | my $next = $self->_parse_context('_WILDTERM') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->_parse_context('_WILDTERM') || ''
MC/DC0%0/1
$self->_parse_context('_WILDTERM') || ''
$self->_parse_context('_WILDTERM')
Truth table50%1/2
A
A= $self->_parse_context('_WILDTERM')
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 13 | ▶ | if ( $term !~ /^[^*?]{$min}/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 449 | die "Wildcard cannot have * or ? " | ||||||||||||||||||||||||||||||||||||||||||
| 450 | . ( | ||||||||||||||||||||||||||||||||||||||||||
| 451 | $min == 1 ? 'as first character' : "in first $min characters" ) | ||||||||||||||||||||||||||||||||||||||||||
| 452 | 5 | ▶ | unless $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 3 | $term =~ s/[*?].*//; | |||||||||||||||||||||||||||||||||||||||||
| 454 | 3 | ▶ | return '' unless length $term; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | 10 | return "$term$next"; | |||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 460 | 26 | ▶ | sub _RANGE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_RANGE: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 461 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 462 | 26 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 463 | 26 | my ( $open, $close, $from, $to ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 464 | 26 | my $opts = $self->{_opts}; | |||||||||||||||||||||||||||||||||||||||||
| 465 | 26 | ▶ | my $next = $self->_parse_context('_RANGE') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->_parse_context('_RANGE') || ''
MC/DC100%1/1
$self->_parse_context('_RANGE') || ''
$self->_parse_context('_RANGE')
Truth table100%2/2
A
A= $self->_parse_context('_RANGE')
| |||||||||||||||||||||||||||||||||||||||||||
| 466 | 26 | ▶ | unless ( $opts->{allow_ranges} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | die "Ranges not allowed\n" | ||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | ▶ | unless $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 1 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 470 | } | ||||||||||||||||||||||||||||||||||||||||||
| 471 | 24 | ▶ | unless ( defined $to ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | 4 | ▶ | die "Malformed range\n" unless $opts->{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 2 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 20 | return "$open$from TO $to$close$next"; | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 479 | 10 | ▶ | sub _RESERVED { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_RESERVED: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 480 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 482 | 10 | my $char = shift; | |||||||||||||||||||||||||||||||||||||||||
| 483 | die "Reserved character $char\n" | ||||||||||||||||||||||||||||||||||||||||||
| 484 | 10 | ▶ | unless $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | return $self->{_opts}{escape_reserved} | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 5 | ▶ | ? "\\$char" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | : ''; | ||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 491 | 2 | ▶ | sub _ESCAPE { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ESCAPE: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 492 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 493 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 494 | die qq(Cannot end with "\\"\n) | ||||||||||||||||||||||||||||||||||||||||||
| 495 | 2 | ▶ | unless $self->{_opts}{fix}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 1 | return ''; | |||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||
| 499 | 1 | my $DECIMAL = qr/[0-9]+(?:[.][0-9]+)?/; | |||||||||||||||||||||||||||||||||||||||||
| 500 | 1 | my $NUM_CHAR = qr/[0-9]/; | |||||||||||||||||||||||||||||||||||||||||
| 501 | 1 | my $ESC_CHAR = qr/\\./; | |||||||||||||||||||||||||||||||||||||||||
| 502 | 1 | my $WS = qr/[ \t\n\r\x{3000}]/; | |||||||||||||||||||||||||||||||||||||||||
| 503 | 1 | my $TERM_START_CHAR | |||||||||||||||||||||||||||||||||||||||||
| 504 | = qr/[^ \t\n\r\x{3000}+\-!():^[\]"{}~*?\\&|] | $ESC_CHAR/x; | ||||||||||||||||||||||||||||||||||||||||||
| 505 | 1 | my $TERM_CHAR = qr/$TERM_START_CHAR |$ESC_CHAR | [-+]/x; | |||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | my $QUOTE_RANGE = qr/(?: " (?: \\" | [^"] )* ")/x; | |||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | my $RANGE_SEP = qr/ \s+ (?: TO \s+)?/x; | |||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 510 | 207 | ▶ | sub _init_tokeniser { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init_tokeniser: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | #=================================== | ||||||||||||||||||||||||||||||||||||||||||
| 512 | 207 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 513 | 207 | my $text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 207 | my $weak_self = $self; | |||||||||||||||||||||||||||||||||||||||||
| 516 | 207 | Scalar::Util::weaken($weak_self); | |||||||||||||||||||||||||||||||||||||||||
| 517 | 1046 | ▶ | return sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=19 SCAR=29.4
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | TOKEN: { | ||||||||||||||||||||||||||||||||||||||||||
| 519 | 1046 | ▶ | $weak_self->{_start_pos} = pos($text) || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
pos $text || 0
MC/DC100%1/1
pos $text || 0
pos $text
Truth table100%2/2
A
A= pos $text
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | 1046 | ▶ | return ['_SPACE'] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | if $text =~ m/\G$WS/gc; | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 866 | ▶ | return [ '_AND_OR', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 523 | if $text =~ m/\G(AND\b | && | OR\b | \|{2})/gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 524 | 805 | ▶ | return [ '_NOT', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 525 | if $text =~ m/\G(NOT\b | !)/gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 526 | 774 | ▶ | return [ '_PLUS_MINUS', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 527 | if $text =~ m/\G([-+])/gc; | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 748 | ▶ | return ['_LPAREN'] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | if $text =~ m/\G[(]/gc; | ||||||||||||||||||||||||||||||||||||||||||
| 530 | 727 | ▶ | return ['_RPAREN'] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 531 | if $text =~ m/\G[)]/gc; | ||||||||||||||||||||||||||||||||||||||||||
| 532 | 706 | ▶ | return [ '_BOOST', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 533 | if $text =~ m/\G\^($DECIMAL)?/gc; | ||||||||||||||||||||||||||||||||||||||||||
| 534 | 654 | ▶ | return [ '_FUZZY', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | if $text =~ m/\G[~]($DECIMAL)?/gc; | ||||||||||||||||||||||||||||||||||||||||||
| 536 | 603 | ▶ | return [ '_PHRASE', $1, $2 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | if $text =~ m/\G " ( (?: $ESC_CHAR | [^"\\])*) "/gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 538 | 574 | ▶ | return [ '_EXISTS', $1, $2 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | if $text =~ m/\G | ||||||||||||||||||||||||||||||||||||||||||
| 540 | (_exists_|_missing_): | ||||||||||||||||||||||||||||||||||||||||||
| 541 | ((?:$TERM_START_CHAR $TERM_CHAR*)?) | ||||||||||||||||||||||||||||||||||||||||||
| 542 | /gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 543 | 558 | ▶ | return [ '_FIELD', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | if $text =~ m/\G ($TERM_START_CHAR $TERM_CHAR*):/gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 545 | 539 | ▶ | return [ '_TERM', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 546 | if $text =~ m/\G | ||||||||||||||||||||||||||||||||||||||||||
| 547 | ( $TERM_START_CHAR $TERM_CHAR*) | ||||||||||||||||||||||||||||||||||||||||||
| 548 | (?!$TERM_CHAR | [*?]) | ||||||||||||||||||||||||||||||||||||||||||
| 549 | /gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 550 | 338 | ▶ | return [ '_WILDTERM', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | if $text =~ m/\G ( | ||||||||||||||||||||||||||||||||||||||||||
| 552 | (?:$TERM_START_CHAR | [*?]) | ||||||||||||||||||||||||||||||||||||||||||
| 553 | (?:$TERM_CHAR | [*?])* | ||||||||||||||||||||||||||||||||||||||||||
| 554 | )/gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 321 | ▶ | return [ '_RANGE', '[', ']', $1, $2 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 556 | if $text =~ m/\G \[ | ||||||||||||||||||||||||||||||||||||||||||
| 557 | ( $QUOTE_RANGE | [^ \]]+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 558 | (?: $RANGE_SEP | ||||||||||||||||||||||||||||||||||||||||||
| 559 | ( $QUOTE_RANGE | [^ \]]* ) | ||||||||||||||||||||||||||||||||||||||||||
| 560 | )? | ||||||||||||||||||||||||||||||||||||||||||
| 561 | \] | ||||||||||||||||||||||||||||||||||||||||||
| 562 | /gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 563 | 293 | ▶ | return [ '_RANGE', '{', '}', $1, $2 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 564 | if $text =~ m/\G \{ | ||||||||||||||||||||||||||||||||||||||||||
| 565 | ( $QUOTE_RANGE | [^ }]+ ) | ||||||||||||||||||||||||||||||||||||||||||
| 566 | (?: | ||||||||||||||||||||||||||||||||||||||||||
| 567 | $RANGE_SEP | ||||||||||||||||||||||||||||||||||||||||||
| 568 | ( $QUOTE_RANGE | [^ }]* ) | ||||||||||||||||||||||||||||||||||||||||||
| 569 | )? | ||||||||||||||||||||||||||||||||||||||||||
| 570 | \} | ||||||||||||||||||||||||||||||||||||||||||
| 571 | /gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | 291 | ▶ | return [ '_RESERVED', $1 ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | if $text =~ m/\G ( ["&|!(){}[\]~^:+\-] )/gcx; | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 273 | ▶ | return ['_ESCAPE'] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 577 | if $text =~ m/\G\\$/gc; | ||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||
| 579 | 270 | return; | |||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||
| 581 | 207 | }; | |||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | __END__ | ||||||||||||||||||||||||||||||||||||||||||