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