blib/lib/MarpaX/ESLIF/Symbol.pm

filter: Statementstmt 26.3% 15 / 57 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 97 MC/DCmcdc 0.0% 0 / 39 Subroutinesub 40.0% 4 / 10 Podpod n/a totaltotal 8.7% 19 / 217 CC 43 SCAR 67.6
CC
43
Cov
9%
__ANON__
1260.0
__ANON__
90.0
_CLONABLE
2.0
CRAP 863.9
↑ Summary blib/lib/MarpaX/ESLIF/Base.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package MarpaX::ESLIF::Symbol;
5 1 ▶use parent qw/MarpaX::ESLIF::Base/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #
9 # Base required class methods
10 #
11 0 ▶sub _CLONABLE { return 1 }
Subroutine _CLONABLE: not called CC=1 SCAR=6.9
12 0 ▶sub _ALLOCATE {
Subroutine _ALLOCATE: not called CC=1 SCAR=6.9
13 0 ▶ return sub {
Subroutine __ANON__: not called CC=9 SCAR=45.0
14 0 my ($class, $eslif, %options) = @_;
15  
16 0 ▶ my $type = $options{type} // croak 'type must be defined';
Condition0%0/2
$options{"type"} // croak("type must be defined")
l!l
00
MC/DC0%0/1
$options{"type"} // croak("type must be defined")
$options{"type"}
Truth table0%0/2
A
A= $options{"type"}
Aresult
11
00
17  
18 0 ▶ if (($type eq 'string') or ($type eq 'regex')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'string' or $type eq 'regex') { } 0 0 0
elsif ($type eq 'meta') { } 0 0 0
Condition0%0/3
$type eq "string" or $type eq "regex"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "string" or $type eq "regex"
$type eq "string" $type eq "regex"
Truth table0%0/3
A or B
A= $type eq "string"B= $type eq "regex"
ABresult
1X1
011
000
19 0 ▶ my $pattern = $options{pattern} // croak 'pattern must be defined';
Condition0%0/2
$options{"pattern"} // croak("pattern must be defined")
l!l
00
MC/DC0%0/1
$options{"pattern"} // croak("pattern must be defined")
$options{"pattern"}
Truth table0%0/2
A
A= $options{"pattern"}
Aresult
11
00
20 0 my $encoding = $options{encoding};
21 0 my $modifiers = $options{modifiers};
22 0 my $substitutionPattern = $options{substitutionPattern};
23 0 my $substitutionModifiers = $options{substitutionModifiers};
24  
25 return
26 0 ▶ ($type eq 'string')
Branch: 1 branch
BranchTrueFalseTotal
$type eq 'string' ? : 0 0 0
27 ?
28 MarpaX::ESLIF::Symbol->string_allocate($eslif, $pattern, bytes::length($pattern), $encoding, $modifiers)
29 :
30 MarpaX::ESLIF::Symbol->regex_allocate($eslif, $pattern, bytes::length($pattern), $encoding, $modifiers, $substitutionPattern, $substitutionModifiers)
31 } elsif ($type eq 'meta') {
32 0 ▶ my $grammar = $options{grammar} // croak 'grammar must be defined';
Condition0%0/2
$options{"grammar"} // croak("grammar must be defined")
l!l
00
MC/DC0%0/1
$options{"grammar"} // croak("grammar must be defined")
$options{"grammar"}
Truth table0%0/2
A
A= $options{"grammar"}
Aresult
11
00
33 0 ▶ my $symbol = $options{symbol} // croak 'symbol must be defined';
Condition0%0/2
$options{"symbol"} // croak("symbol must be defined")
l!l
00
MC/DC0%0/1
$options{"symbol"} // croak("symbol must be defined")
$options{"symbol"}
Truth table0%0/2
A
A= $options{"symbol"}
Aresult
11
00
34  
35 0 return MarpaX::ESLIF::Symbol->meta_allocate($eslif, $grammar, $symbol)
36 } else {
37 0 croak "Type must be 'string', 'regex' or 'meta'"
38 }
39 }
40 0 }
41 0 ▶sub _DISPOSE { return \&MarpaX::ESLIF::Symbol::dispose }
Subroutine _DISPOSE: not called CC=1 SCAR=6.9
42 0 ▶sub _EQ {
Subroutine _EQ: not called CC=1 SCAR=6.9
43 0 ▶ return sub {
Subroutine __ANON__: not called CC=35 SCAR=71.4
44 0 my ($class, $args_ref, $eslif, %options) = @_;
45  
46 0 ▶ my $type = $options{type} // croak 'type must be defined';
Condition0%0/2
$options{"type"} // croak("type must be defined")
l!l
00
MC/DC0%0/1
$options{"type"} // croak("type must be defined")
$options{"type"}
Truth table0%0/2
A
A= $options{"type"}
Aresult
11
00
47  
48 0 ▶ if (($type eq 'string') or ($type eq 'regex')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'string' or $type eq 'regex') { } 0 0 0
elsif ($type eq 'meta') { } 0 0 0
Condition0%0/3
$type eq "string" or $type eq "regex"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "string" or $type eq "regex"
$type eq "string" $type eq "regex"
Truth table0%0/3
A or B
A= $type eq "string"B= $type eq "regex"
ABresult
1X1
011
000
49  
50 0 ▶ my $pattern = $options{pattern} // croak 'pattern must be defined';
Condition0%0/2
$options{"pattern"} // croak("pattern must be defined")
l!l
00
MC/DC0%0/1
$options{"pattern"} // croak("pattern must be defined")
$options{"pattern"}
Truth table0%0/2
A
A= $options{"pattern"}
Aresult
11
00
51 0 my $encoding = $options{encoding};
52 0 my $modifiers = $options{modifiers};
53 0 my $substitutionPattern = $options{substitutionPattern};
54 0 my $substitutionModifiers = $options{substitutionModifiers};
55  
56 0 my $definedEncoding = defined($encoding); # It is legal to create a symbol with no encoding
57 0 my $definedModifiers = defined($modifiers); # It is legal to create a symbol with no modifier
58 0 my $definedSubstitutionPattern = defined($substitutionPattern); # It is legal to create a symbol with no substitution pattern
59 0 my $definedSubstitutionModifiers = defined($substitutionModifiers); # It is legal to create a symbol with no substitution modifier
60  
61 0 my ($args_eslif, %args_options) = @{$args_ref};
62 0 my $_definedEncoding = defined($args_options{encoding});
63 0 my $_definedModifiers = defined($args_options{modifiers});
64 0 my $_definedSubstitutionPattern = defined($args_options{substitutionPattern});
65 0 my $_definedSubstitutionModifiers = defined($args_options{substitutionModifiers});
66 return $_ if
67 $eslif == $args_eslif
68 &&
69 $type eq $args_options{type}
70 &&
71 $pattern eq $args_options{pattern}
72 &&
73 ((! $definedEncoding && ! $_definedEncoding) || ($definedEncoding && $_definedEncoding && ($encoding eq $args_options{encoding})))
74 &&
75 ((! $definedModifiers && ! $_definedModifiers) || ($definedModifiers && $_definedModifiers && ($modifiers eq $args_options{modifiers})))
76 &&
77 ((! $definedSubstitutionPattern && ! $_definedSubstitutionPattern) || ($definedSubstitutionPattern && $_definedSubstitutionPattern && ($substitutionPattern eq $args_options{substitutionPattern})))
78 &&
79 0 ▶ ((! $definedSubstitutionModifiers && ! $_definedSubstitutionModifiers) || ($definedSubstitutionModifiers && $_definedSubstitutionModifiers && ($substitutionModifiers eq $args_options{substitutionModifiers})))
Branch: 1 branch
BranchTrueFalseTotal
if $eslif == $args_eslif and $type eq $args_options{"type"} and $pattern eq $args_options{"pattern"} and !($definedEncoding || $_definedEncoding) || $definedEncoding && $_definedEncoding && $encoding eq $args_options{"encoding"} and !($definedModifiers || $_definedModifiers) || $definedModifiers && $_definedModifiers && $modifiers eq $args_options{"modifiers"} and !($definedSubstitutionPattern || $_definedSubstitutionPattern) || $definedSubstitutionPattern && $_definedSubstitutionPattern && $substitutionPattern eq $args_options{"substitutionPattern"} and !($definedSubstitutionModifiers || $_definedSubstitutionModifiers) || $definedSubstitutionModifiers && $_definedSubstitutionModifiers && $substitutionModifiers eq $args_options{"substitutionModifiers"} 0 0 0
Condition0%0/66
$eslif == $args_eslif and $type eq $args_options{"type"} and $pattern eq $args_options{"pattern"} and !($definedEncoding || $_definedEncoding) || $definedEncoding && $_definedEncoding && $encoding eq $args_options{"encoding"} and !($definedModifiers || $_definedModifiers) || $definedModifiers && $_definedModifiers && $modifiers eq $args_options{"modifiers"} and !($definedSubstitutionPattern || $_definedSubstitutionPattern) || $definedSubstitutionPattern && $_definedSubstitutionPattern && $substitutionPattern eq $args_options{"substitutionPattern"} and !($definedSubstitutionModifiers || $_definedSubstitutionModifiers) || $definedSubstitutionModifiers && $_definedSubstitutionModifiers && $substitutionModifiers eq $args_options{"substitutionModifiers"}
!ll&&!rl&&r
000
$eslif == $args_eslif and $type eq $args_options{"type"} and $pattern eq $args_options{"pattern"} and !($definedEncoding || $_definedEncoding) || $definedEncoding && $_definedEncoding && $encoding eq $args_options{"encoding"} and !($definedModifiers || $_definedModifiers) || $definedModifiers && $_definedModifiers && $modifiers eq $args_options{"modifiers"} and !($definedSubstitutionPattern || $_definedSubstitutionPattern) || $definedSubstitutionPattern && $_definedSubstitutionPattern && $substitutionPattern eq $args_options{"substitutionPattern"}
!ll&&!rl&&r
000
$eslif == $args_eslif and $type eq $args_options{"type"} and $pattern eq $args_options{"pattern"} and !($definedEncoding || $_definedEncoding) || $definedEncoding && $_definedEncoding && $encoding eq $args_options{"encoding"} and !($definedModifiers || $_definedModifiers) || $definedModifiers && $_definedModifiers && $modifiers eq $args_options{"modifiers"}
!ll&&!rl&&r
000
$eslif == $args_eslif and $type eq $args_options{"type"} and $pattern eq $args_options{"pattern"} and !($definedEncoding || $_definedEncoding) || $definedEncoding && $_definedEncoding && $encoding eq $args_options{"encoding"}
!ll&&!rl&&r
000
$eslif == $args_eslif and $type eq $args_options{"type"} and $pattern eq $args_options{"pattern"}
!ll&&!rl&&r
000
$eslif == $args_eslif and $type eq $args_options{"type"}
!ll&&!rl&&r
000
not $definedEncoding || $_definedEncoding or $definedEncoding and $_definedEncoding and $encoding eq $args_options{"encoding"}
l!l&&r!l&&!r
000
$definedEncoding || $_definedEncoding
l!l&&r!l&&!r
000
$definedEncoding and $_definedEncoding and $encoding eq $args_options{"encoding"}
!ll&&!rl&&r
000
$definedEncoding and $_definedEncoding
!ll&&!rl&&r
000
not $definedModifiers || $_definedModifiers or $definedModifiers and $_definedModifiers and $modifiers eq $args_options{"modifiers"}
l!l&&r!l&&!r
000
$definedModifiers || $_definedModifiers
l!l&&r!l&&!r
000
$definedModifiers and $_definedModifiers and $modifiers eq $args_options{"modifiers"}
!ll&&!rl&&r
000
$definedModifiers and $_definedModifiers
!ll&&!rl&&r
000
not $definedSubstitutionPattern || $_definedSubstitutionPattern or $definedSubstitutionPattern and $_definedSubstitutionPattern and $substitutionPattern eq $args_options{"substitutionPattern"}
l!l&&r!l&&!r
000
$definedSubstitutionPattern || $_definedSubstitutionPattern
l!l&&r!l&&!r
000
$definedSubstitutionPattern and $_definedSubstitutionPattern and $substitutionPattern eq $args_options{"substitutionPattern"}
!ll&&!rl&&r
000
$definedSubstitutionPattern and $_definedSubstitutionPattern
!ll&&!rl&&r
000
not $definedSubstitutionModifiers || $_definedSubstitutionModifiers or $definedSubstitutionModifiers and $_definedSubstitutionModifiers and $substitutionModifiers eq $args_options{"substitutionModifiers"}
l!l&&r!l&&!r
000
$definedSubstitutionModifiers || $_definedSubstitutionModifiers
l!l&&r!l&&!r
000
$definedSubstitutionModifiers and $_definedSubstitutionModifiers and $substitutionModifiers eq $args_options{"substitutionModifiers"}
!ll&&!rl&&r
000
$definedSubstitutionModifiers and $_definedSubstitutionModifiers
!ll&&!rl&&r
000
MC/DC0%0/23
$eslif == $args_eslif and $type eq $args_options{"type"} and $pattern eq $args_options{"pattern"} and !($definedEncoding || $_definedEncoding) || $definedEncoding && $_definedEncoding && $encoding eq $args_options{"encoding"} and !($definedModifiers || $_definedModifiers) || $definedModifiers && $_definedModifiers && $modifiers eq $args_options{"modifiers"} and !($definedSubstitutionPattern || $_definedSubstitutionPattern) || $definedSubstitutionPattern && $_definedSubstitutionPattern && $substitutionPattern eq $args_options{"substitutionPattern"} and !($definedSubstitutionModifiers || $_definedSubstitutionModifiers) || $definedSubstitutionModifiers && $_definedSubstitutionModifiers && $substitutionModifiers eq $args_options{"substitutionModifiers"}
too many conditions
80  
81 } elsif ($type eq 'meta') {
82 0 ▶ my $grammar = $options{grammar} // croak 'grammar must be defined';
Condition0%0/2
$options{"grammar"} // croak("grammar must be defined")
l!l
00
MC/DC0%0/1
$options{"grammar"} // croak("grammar must be defined")
$options{"grammar"}
Truth table0%0/2
A
A= $options{"grammar"}
Aresult
11
00
83 0 ▶ my $symbol = $options{symbol} // croak 'symbol must be defined';
Condition0%0/2
$options{"symbol"} // croak("symbol must be defined")
l!l
00
MC/DC0%0/1
$options{"symbol"} // croak("symbol must be defined")
$options{"symbol"}
Truth table0%0/2
A
A= $options{"symbol"}
Aresult
11
00
84  
85 0 my ($args_eslif, %args_options) = @{$args_ref};
86  
87 return $_ if
88 $eslif == $args_eslif
89 &&
90 $type eq $args_options{type}
91 &&
92 $grammar == $args_options{grammar}
93 &&
94 $symbol eq $args_options{symbol}
95 0 ▶ } else {
Branch: 1 branch
BranchTrueFalseTotal
if $eslif == $args_eslif and $type eq $args_options{"type"} and $grammar == $args_options{"grammar"} and $symbol eq $args_options{"symbol"} 0 0 0
Condition0%0/9
$eslif == $args_eslif and $type eq $args_options{"type"} and $grammar == $args_options{"grammar"} and $symbol eq $args_options{"symbol"}
!ll&&!rl&&r
000
$eslif == $args_eslif and $type eq $args_options{"type"} and $grammar == $args_options{"grammar"}
!ll&&!rl&&r
000
$eslif == $args_eslif and $type eq $args_options{"type"}
!ll&&!rl&&r
000
MC/DC0%0/4
$eslif == $args_eslif and $type eq $args_options{"type"} and $grammar == $args_options{"grammar"} and $symbol eq $args_options{"symbol"}
$eslif == $args_eslif $type eq $args_options{"type"} $grammar == $args_options{"grammar"} $symbol eq $args_options{"symbol"}
Truth table0%0/5
A and B and C and D
A= $eslif == $args_eslifB= $type eq $args_options{"type"}C= $grammar == $args_options{"grammar"}D= $symbol eq $args_options{"symbol"}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
96 0 croak "Type must be 'string', 'regex' or 'meta'"
97 }
98 }
99 0 }
100  
101 # ABSTRACT: MarpaX::ESLIF's symbol
102  
103 1 our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY
104  
105 1 our $VERSION = '6.0.35.1'; # VERSION
106  
107  
108 1 1;
109  
110 __END__
↑ Summary blib/lib/MarpaX/ESLIF/Base.pm »