| 1 | package TUI::Validate::PXPictureValidator; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Validator for picture-based input validation with auto-fill support | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | our $VERSION = '2.000002'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||
| 14 | TPXPictureValidator | ||||||||||||||||||||||||||||||||||||||||||
| 15 | new_TPXPictureValidator | ||||||||||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | use Scalar::Util qw( readonly ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 4 | ▶ | use TUI::toolkit; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | ▶ | use TUI::toolkit::Types qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | Maybe | ||||||||||||||||||||||||||||||||||||||||||
| 22 | :is | ||||||||||||||||||||||||||||||||||||||||||
| 23 | :types | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | ▶ | use TUI::MsgBox::Const qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | mfError | ||||||||||||||||||||||||||||||||||||||||||
| 28 | mfOKButton | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | ▶ | use TUI::MsgBox::MsgBoxText qw( messageBox ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 4 | ▶ | use TUI::Validate::Const qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | :TPicResult | ||||||||||||||||||||||||||||||||||||||||||
| 33 | vsSyntax | ||||||||||||||||||||||||||||||||||||||||||
| 34 | voFill | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | ▶ | use TUI::Validate::Validator; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | sub TPXPictureValidator() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | sub name() { 'TPXPictureValidator' }; | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub new_TPXPictureValidator { __PACKAGE__->from(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_TPXPictureValidator: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | extends TValidator; | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | # declare global variables | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 4 | our $errorMsg = "Error in picture format.\n %s"; | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | # private attributes | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 4 | has index => ( is => 'bare' ); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 4 | has jndex => ( is => 'bare' ); | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # protected attributes | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | has pic => ( is => 'ro', default => sub { die 'required '} ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | # private methods | ||||||||||||||||||||||||||||||||||||||||||
| 55 | my ( | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | $consume, | |||||||||||||||||||||||||||||||||||||||||
| 57 | $toGroupEnd, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | $skipToComma, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | $calcTerm, | ||||||||||||||||||||||||||||||||||||||||||
| 60 | $iteration, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | $group, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | $checkComplete, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | $scan, | ||||||||||||||||||||||||||||||||||||||||||
| 64 | $process, | ||||||||||||||||||||||||||||||||||||||||||
| 65 | $syntaxCheck, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 70 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 71 | named => [ | ||||||||||||||||||||||||||||||||||||||||||
| 72 | pic => Str, { alias => 'aPic' }, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | autoFill => Bool, | ||||||||||||||||||||||||||||||||||||||||||
| 74 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 75 | caller_level => +1, | ||||||||||||||||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my ( $class, $args ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | return { %$args }; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | assert ( is_HashRef $args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | $self->{options} |= voFill | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if ( $args->{autoFill} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my $s = ''; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $self->{status} = vsSyntax | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | if $self->picture( $s, false ) != prEmpty; | ||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub from { # $obj ($aPic, $autoFill) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 96 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 97 | pos => [Str, Bool], | ||||||||||||||||||||||||||||||||||||||||||
| 98 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my ( $class, @args ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | return $class->new( pic => $args[0], autoFill => $args[1] ); | |||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub DEMOLISH { # void ($in_global_destruction) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEMOLISH: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my ( $self, $in_global_destruction ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | $self->{pic} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | sub error { # void () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 113 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 114 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||
| 115 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | messageBox( mfError | mfOKButton, $errorMsg, $self->{pic} ); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | sub isValidInput { # $bool ($s, $suppressFill) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isValidInput: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 123 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 124 | pos => [Str, Bool], | ||||||||||||||||||||||||||||||||||||||||||
| 125 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my ( $self, $s, $suppressFill ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | alias: for $s ( $_[1] ) { | |||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | my $doFill = ( $self->{options} & voFill ) && !$suppressFill; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'options'} & 1 && !$suppressFill
MC/DC0%0/2
$self->{'options'} & 1 && !$suppressFill
$self->{'options'} & 1
!$suppressFill
Truth table0%0/3
A && not(B)
A= $self->{'options'} & 1B= !$suppressFill
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | return $self->{pic} eq '' || $self->picture( $s, $doFill ) != prError; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'pic'} eq '' || $self->picture($s, $doFill) != 3
MC/DC0%0/2
$self->{'pic'} eq '' || $self->picture($s, $doFill) != 3
$self->{'pic'} eq ''
$self->picture($s, $doFill) != 3
Truth table0%0/3
A || B
A= $self->{'pic'} eq ''B= $self->picture($s, $doFill) != 3
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | } #/ alias: | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub isValid { # $bool ($s) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
isValid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 135 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | pos => [Str], | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my ( $self, $s ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | return $self->{pic} eq '' || $self->picture( $s, false ) == prComplete; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'pic'} eq '' || $self->picture($s, !1) == 0
MC/DC0%0/2
$self->{'pic'} eq '' || $self->picture($s, !1) == 0
$self->{'pic'} eq ''
$self->picture($s, !1) == 0
Truth table0%0/3
A || B
A= $self->{'pic'} eq ''B= $self->picture($s, !1) == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | my $toUpper = sub { length( uc( $_[0] ) ) == 1 ? uc( $_[0] ) : $_[0] }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | my $isNumber = sub { $_[0] =~ /^\d$/ }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | my $isLetter = sub { $_[0] =~ /^[[:alpha:]]$/ }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | my $isSpecial = sub { length $_[0] == 1 && index( $_[1], $_[0] ) != -1 }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | my $numChar = sub { return () = ( $_[1] =~ /\Q$_[0]\E/g ) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | my $isComplete = sub { $_[0] == prComplete || $_[0] == prAmbiguous }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $isIncomplete = sub { $_[0] == prIncomplete || $_[0] == prIncompNoFill }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub picture { # $picResult ($input, $autoFill) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
picture: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 152 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 153 | pos => [Maybe[Str], Bool], | ||||||||||||||||||||||||||||||||||||||||||
| 154 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my ( $self, $input, $autoFill ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | alias: for $input ( $_[1] ) { | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $reprocess; | |||||||||||||||||||||||||||||||||||||||||
| 159 | my $rslt; | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if ( !$self->$syntaxCheck() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | return prSyntax; | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ( !defined( $input ) || !length( $input ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $input and length $input
MC/DC0%0/2
defined $input and length $input
defined $input
length $input
Truth table0%0/3
A and B
A= defined $inputB= length $input
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | return prEmpty; | |||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $self->{jndex} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->{index} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $rslt = $self->$process( $input, length( $self->{pic} ) ); | |||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if ( $rslt != prError && $self->{jndex} < length( $input ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rslt != 3 and $self->{"jndex"} < length $input
MC/DC0%0/2
$rslt != 3 and $self->{"jndex"} < length $input
$rslt != 3
$self->{"jndex"} < length $input
Truth table0%0/3
A and B
A= $rslt != 3B= $self->{"jndex"} < length $input
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $rslt = prError; | |||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | if ( ( $rslt == prIncomplete ) && $autoFill ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rslt == 1 and $autoFill
MC/DC0%0/2
$rslt == 1 and $autoFill
$rslt == 1
$autoFill
Truth table0%0/3
A and B
A= $rslt == 1B= $autoFill
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $reprocess = false; | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | ▶ | while ( ( $self->{index} < length( $self->{pic} ) ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"index"} < length $self->{"pic"} and not &$isSpecial(substr($self->{"pic"}, $self->{"index"}, 1), "#?&!\@*{}[],")
MC/DC0%0/2
$self->{"index"} < length $self->{"pic"} and not &$isSpecial(substr($self->{"pic"}, $self->{"index"}, 1), "#?&!\@*{}[],")
$self->{"index"} < length $self->{"pic"}
not &$isSpecial(substr($self->{"pic"}, $self->{"index"}, 1), "#?&!\@*{}[],")
Truth table0%0/3
A and not(B)
A= $self->{"index"} < length $self->{"pic"}B= not &$isSpecial(substr($self->{"pic"}, $self->{"index"}, 1), "#?&!\@*{}[],")
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | && !&$isSpecial( substr($self->{pic}, $self->{index}, 1), "#?&!@*{}[]," ) | ||||||||||||||||||||||||||||||||||||||||||
| 183 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my $pchar = substr( $self->{pic}, $self->{index}, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if ( $pchar eq ';' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $self->{index}++; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | last if $self->{index} >= length( $self->{pic} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | $pchar = substr( $self->{pic}, $self->{index}, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | $input .= $pchar; | |||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->{index}++; | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $reprocess = true; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | $self->{jndex} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $self->{index} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ( $reprocess ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $rslt = $self->$process( $input, length( $self->{pic} ) ); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | } #/ if ( ( $rslt == prIncomplete...)) | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ( $rslt == prAmbiguous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | return prComplete; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | elsif ( $rslt == prIncompNoFill ) { | ||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return prIncomplete; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | } #/ alias: | ||||||||||||||||||||||||||||||||||||||||||
| 213 | }; #/ $picture = sub | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | # Consume input | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | $consume = sub { # void ($ch, $input) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | my ( $self, $ch, $input ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | ▶ | assert ( is_Str $ch ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | assert ( is_Str $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | alias: for $input ( $_[2] ) { | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | assert ( !readonly $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | substr( $input, $self->{jndex}, 1 ) = $ch; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $self->{index}++; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $self->{jndex}++; | |||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | } #/ alias: | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | # Skip a character or a picture group | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | $toGroupEnd = sub { # void (\$i, $termCh) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | my ( $self, $i, $termCh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | assert ( is_ScalarRef $i ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | assert ( is_Int $termCh ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my $brkLevel = 0; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $brcLevel = 0; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$brkLevel == 0 and $brcLevel == 0
MC/DC0%0/2
$brkLevel == 0 and $brcLevel == 0
$brkLevel == 0
$brcLevel == 0
Truth table0%0/3
A and B
A= $brkLevel == 0B= $brcLevel == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | return if $$i == $termCh; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | SWITCH: for ( substr( $self->{pic}, $$i, 1 ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | $_ eq '[' and do { $brkLevel++; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | $_ eq ']' and do { $brkLevel--; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | $_ eq '{' and do { $brcLevel++; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | $_ eq '}' and do { $brcLevel--; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | $_ eq ';' and do { $$i++; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | $$i++; | |||||||||||||||||||||||||||||||||||||||||
| 253 | } while ( !( $brkLevel == 0 && $brcLevel == 0 ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 255 | 4 | }; #/ $toGroupEnd = sub | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | # Find a comma separator | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $skipToComma = sub { # $bool ($termCh) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | my ( $self, $termCh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | assert ( is_Int $termCh ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 263 | do { | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $self->$toGroupEnd( \$self->{index}, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 265 | } while ( !( $self->{index} == $termCh | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | || substr( $self->{pic}, $self->{index}, 1 ) eq ',' ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"index"} == $termCh or substr($self->{"pic"}, $self->{"index"}, 1) eq ","
MC/DC0%0/2
$self->{"index"} == $termCh or substr($self->{"pic"}, $self->{"index"}, 1) eq ","
$self->{"index"} == $termCh
substr($self->{"pic"}, $self->{"index"}, 1) eq ","
Truth table0%0/3
A or B
A= $self->{"index"} == $termChB= substr($self->{"pic"}, $self->{"index"}, 1) eq ","
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | $self->{index}++ | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | if substr( $self->{pic}, $self->{index}, 1 ) eq ','; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | return $self->{index} < $termCh; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | # Calculate the end of a group | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | $calcTerm = sub { # $int ($termCh) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my ( $self, $termCh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | assert ( is_Int $termCh ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $k = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $self->$toGroupEnd( \$k, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | return $k; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | # The next group is repeated X times | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | $iteration = sub { # $picResult ($input, $inTerm) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=15 SCAR=54.8
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | my ( $self, $input, $inTerm ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | assert ( is_Str $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | assert ( is_Int $inTerm ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | for $input ( $_[1] ) { | |||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | assert ( !readonly $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $itr = 0; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my $rslt = prError; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | my $termCh; | |||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $self->{index}++; # Skip '*' | |||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | # Retrieve number | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | while ( &$isNumber( substr( $self->{pic}, $self->{index}, 1 ) ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my $digit = substr( $self->{pic}, $self->{index}, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $itr = $itr * 10 + ( ord( $digit ) - ord( '0' ) ); | |||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $self->{index}++; | |||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | my $k = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | $termCh = $self->$calcTerm( $inTerm ); | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | # If $itr is 0 allow any number, otherwise enforce the number | ||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | if ( $itr != 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | for ( my $l = 1 ; $l <= $itr ; $l++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{index} = $k; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $rslt = $self->$process( $input, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | ▶ | if ( !&$isComplete( $rslt ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||
| 318 | # Empty means incomplete since all are required | ||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if ( $rslt == prEmpty ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | $rslt = prIncomplete; | |||||||||||||||||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | $self->{index} = $k; | |||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $rslt = $self->$process( $input, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 330 | } while ( $rslt == prComplete ); | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | if ( $rslt == prEmpty || $rslt == prError ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rslt == 2 or $rslt == 3
MC/DC0%0/2
$rslt == 2 or $rslt == 3
$rslt == 2
$rslt == 3
Truth table0%0/3
A or B
A= $rslt == 2B= $rslt == 3
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $self->{index}++; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | $rslt = prAmbiguous; | |||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $self->{index} = $termCh; | |||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 340 | } #/ alias: | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 4 | }; #/ $iteration = sub | |||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | # Process a picture group | ||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | $group = sub { # $picResult ($input, $inTerm) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my ( $self, $input, $inTerm ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | assert ( is_Str $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | assert ( is_Int $inTerm ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | alias: for $input ( $_[1] ) { | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | assert ( !readonly $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 354 | my $termCh; | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $termCh = $self->$calcTerm( $inTerm ); | |||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $self->{index}++; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | $rslt = $self->$process( $input, $termCh - 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if ( !&$isIncomplete( $rslt ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $self->{index} = $termCh; | |||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 365 | } #/ alias: | ||||||||||||||||||||||||||||||||||||||||||
| 366 | 4 | }; | |||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | $checkComplete = sub { # $picResult ($rslt, $termCh) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my ( $self, $rslt, $termCh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | assert ( is_PositiveOrZeroInt $rslt ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | assert ( is_Int $termCh ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $j = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $status = true; | |||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | ▶ | if ( &$isIncomplete( $rslt ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | # Skip optional pieces | ||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | while ( $status ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | my $ch = substr( $self->{pic}, $j, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | ▶ | if ( $ch eq '[' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | $self->$toGroupEnd( \$j, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||
| 387 | elsif ( $ch eq '*' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | if ( !&$isNumber( substr( $self->{pic}, $j + 1, 1 ) ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $j++; | |||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $self->$toGroupEnd( \$j, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | $status = false; | |||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | if ( $j == $termCh ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $rslt = prAmbiguous; | |||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 401 | } #/ if ( $self->isIncomplete...) | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 4 | }; #/ $checkComplete = sub | |||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | $scan = sub { # $picResult ($input, $termCh) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=32 SCAR=69.6
| |||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | my ( $self, $input, $termCh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | assert ( is_Str $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | assert ( is_Int $termCh ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | alias: for $input ( $_[1] ) { | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | ▶ | assert ( !readonly $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | my $ch; | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | my ( $rslt, $rScan ); | |||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | $rScan = prError; | |||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $rslt = prEmpty; | |||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | while ( ( $self->{index} != $termCh ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"index"} != $termCh and substr($self->{"pic"}, $self->{"index"}, 1) ne ","
MC/DC0%0/2
$self->{"index"} != $termCh and substr($self->{"pic"}, $self->{"index"}, 1) ne ","
$self->{"index"} != $termCh
substr($self->{"pic"}, $self->{"index"}, 1) ne ","
Truth table0%0/3
A and B
A= $self->{"index"} != $termChB= substr($self->{"pic"}, $self->{"index"}, 1) ne ","
| |||||||||||||||||||||||||||||||||||||||||||
| 422 | && ( substr( $self->{pic}, $self->{index}, 1 ) ne ',' ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 423 | { | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if ( $self->{jndex} >= length( $input ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | return $self->$checkComplete( $rslt, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $ch = substr( $input, $self->{jndex}, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | SWITCH: for ( substr( $self->{pic}, $self->{index}, 1 ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | $_ eq '#' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | if ( !&$isNumber( $ch ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | return prError(); | |||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 436 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $self->$consume( $ch, $input ); | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 440 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | $_ eq '?' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | if ( !&$isLetter( $ch ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | return prError; | |||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $self->$consume( $ch, $input ); | |||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 450 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | $_ eq '&' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | if ( !&$isLetter( $ch ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | return prError(); | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->$consume( &$toUpper( $ch ), $input ); | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 460 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | $_ eq '!' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $self->$consume( &$toUpper( $ch ), $input ); | |||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 465 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | ▶ | $_ eq '@' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | $self->$consume( $ch, $input ); | |||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 470 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | $_ eq '*' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $rslt = $self->$iteration( $input, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | if ( !&$isComplete( $rslt ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | if ( $rslt == prError ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $rslt = prAmbiguous; | |||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 482 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | $_ eq '{' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | $rslt = $self->$group( $input, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | ▶ | if ( !&$isComplete( $rslt ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 490 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | $_ eq '[' and do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | $rslt = $self->$group( $input, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | if ( &$isIncomplete( $rslt ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | ▶ | if ( $rslt == prError ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | $rslt = prAmbiguous; | |||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 501 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | DEFAULT: { | ||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | my $p = substr( $self->{pic}, $self->{index}, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ▶ | if ( $p eq ';' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | $self->{index}++; | |||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | $p = substr( $self->{pic}, $self->{index}, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | ▶ | if ( &$toUpper( $p ) ne &$toUpper( $ch ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | if ( $ch ne ' ' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | return $rScan; | |||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | $self->$consume( $p, $input ); | |||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 519 | } #/ SWITCH: for ( substr( $self->{pic...})) | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | ▶ | if ( $rslt == prAmbiguous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $rslt = prIncompNoFill; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 524 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 525 | 0 | $rslt = prIncomplete; | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | } #/ while ( ( $self->{index} ...)) | ||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | if ( $rslt == prIncompNoFill ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | return prAmbiguous; | |||||||||||||||||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||||||||||||||||
| 532 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | return prComplete; | |||||||||||||||||||||||||||||||||||||||||
| 534 | } | ||||||||||||||||||||||||||||||||||||||||||
| 535 | } #/ alias: | ||||||||||||||||||||||||||||||||||||||||||
| 536 | 4 | }; #/ $scan = sub | |||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | $process = sub { # $picResult ($input, $termCh) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=20 SCAR=60.4
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | my ( $self, $input, $termCh ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | assert ( @_ == 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | assert ( is_Str $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | assert ( is_Int $termCh ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | alias: for $input ( $_[1] ) { | |||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | assert ( !readonly $input ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my ( $rslt, $rProcess ); | |||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | my $incomp; | |||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | my ( $oldI, $oldJ, $incompJ, $incompI ); | |||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $incomp = false; | |||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $oldI = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $oldJ = $self->{jndex}; | |||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | $incompJ = 0; | |||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rslt == 3 or $rslt == 1
MC/DC0%0/2
$rslt == 3 or $rslt == 1
$rslt == 3
$rslt == 1
Truth table0%0/3
A or B
A= $rslt == 3B= $rslt == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | $rslt = $self->$scan( $input, $termCh ); | |||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | # Only accept completes if they make it farther in the input stream | ||||||||||||||||||||||||||||||||||||||||||
| 560 | # from the last incomplete | ||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | if ( $rslt == prComplete && $incomp && $self->{jndex} < $incompJ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$rslt == 0 and $incomp and $self->{"jndex"} < $incompJ
$rslt == 0 and $incomp
MC/DC0%0/3
$rslt == 0 and $incomp and $self->{"jndex"} < $incompJ
$rslt == 0
$incomp
$self->{"jndex"} < $incompJ
Truth table0%0/4
A and B and C
A= $rslt == 0B= $incompC= $self->{"jndex"} < $incompJ
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | $rslt = prIncomplete; | |||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | $self->{jndex} = $incompJ; | |||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | if ( $rslt == prError || $rslt == prIncomplete ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rslt == 3 or $rslt == 1
MC/DC0%0/2
$rslt == 3 or $rslt == 1
$rslt == 3
$rslt == 1
Truth table0%0/3
A or B
A= $rslt == 3B= $rslt == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | $rProcess = $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | if ( !$incomp && $rslt == prIncomplete ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $incomp and $rslt == 1
MC/DC0%0/2
not $incomp and $rslt == 1
not $incomp
$rslt == 1
Truth table0%0/3
not(A) and B
A= not $incompB= $rslt == 1
| |||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | $incomp = true; | |||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | $incompI = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $incompJ = $self->{jndex}; | |||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $self->{index} = $oldI; | |||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | $self->{jndex} = $oldJ; | |||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | ▶ | if ( !$self->$skipToComma( $termCh ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | if ( $incomp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | $rProcess = prIncomplete; | |||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $self->{index} = $incompI; | |||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | $self->{jndex} = $incompJ; | |||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | return $rProcess; | |||||||||||||||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | $oldI = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 588 | } #/ if ( ( $rslt == prError...)) | ||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | } while ( $rslt == prError || $rslt == prIncomplete ); | ||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | if ( $rslt == prComplete && $incomp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$rslt == 0 and $incomp
MC/DC0%0/2
$rslt == 0 and $incomp
$rslt == 0
$incomp
Truth table0%0/3
A and B
A= $rslt == 0B= $incomp
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | return prAmbiguous; | |||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||
| 595 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | return $rslt; | |||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | } #/ alias: | ||||||||||||||||||||||||||||||||||||||||||
| 599 | 4 | }; #/ $process = sub | |||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | ▶ | $syntaxCheck = sub { # $bool () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | if ( !defined $self->{pic} || length( $self->{pic} ) == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $self->{"pic"} or length $self->{"pic"} == 0
MC/DC0%0/2
not defined $self->{"pic"} or length $self->{"pic"} == 0
not defined $self->{"pic"}
length $self->{"pic"} == 0
Truth table0%0/3
not(A) or B
A= not defined $self->{"pic"}B= length $self->{"pic"} == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | return false; | |||||||||||||||||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | if ( substr( $self->{pic}, -1, 1 ) eq ';' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | return false; | |||||||||||||||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | my $brkLevel = 0; | |||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | my $brcLevel = 0; | |||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | my $len = length( $self->{pic} ); | |||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | ▶ | while ( $i < $len ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | SWITCH: for ( substr( $self->{pic}, $i, 1 ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | $_ eq '[' and do { $brkLevel++; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | ▶ | $_ eq ']' and do { $brkLevel--; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | $_ eq '{' and do { $brcLevel++; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | ▶ | $_ eq '}' and do { $brcLevel--; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | $_ eq ';' and do { $i++; last }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 628 | } | ||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | 0 | ▶ | return $brkLevel == 0 && $brcLevel == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$brkLevel == 0 && $brcLevel == 0
MC/DC0%0/2
$brkLevel == 0 && $brcLevel == 0
$brkLevel == 0
$brcLevel == 0
Truth table0%0/3
A && B
A= $brkLevel == 0B= $brcLevel == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 631 | 4 | }; #/ $syntaxCheck = sub | |||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||
| 633 | 4 | 1 | |||||||||||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||||||||||||
| 635 | __END__ | ||||||||||||||||||||||||||||||||||||||||||